| 1 | //===- OpenACCRuntimeDescriptors.def - ACC descriptor catalog ---*- C++ -*-===// |
| 2 | // |
| 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 4 | // See https://llvm.org/LICENSE.txt for license information. |
| 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | /// \file |
| 9 | /// |
| 10 | /// X-macro catalog of the argument descriptors the compiler materializes for |
| 11 | /// the `arg_descs` parameter of the `__tgt_acc_data_*` entry points. Field |
| 12 | /// order, field types, and padding are part of the runtime ABI and must match |
| 13 | /// the `AccDataDesc*` types of the offload runtime, which are not restated |
| 14 | /// here. Include this file after defining ACC_DESC_BEGIN. |
| 15 | /// |
| 16 | /// ACC_DESC_BEGIN(Enum, NameStr, DescKind) |
| 17 | /// Enum - enumerator used as DataDescriptor::Enum |
| 18 | /// NameStr - name of the runtime type this layout materializes |
| 19 | /// DescKind - `acc::DataDescKind` the runtime reads from the version field |
| 20 | /// |
| 21 | /// ACC_DESC_FIELD(Enum, Field, TypeToken) |
| 22 | /// Field - enumerator used as Enum##Field::Field, in declaration order |
| 23 | /// TypeToken - MLIR LLVM type token (Int8, Int32, Int64, Ptr), or Base for |
| 24 | /// the descriptor a layout nests |
| 25 | /// |
| 26 | /// ACC_DESC_END(Enum) |
| 27 | /// |
| 28 | //===----------------------------------------------------------------------===// |
| 29 | |
| 30 | #ifndef ACC_DESC_BEGIN |
| 31 | #error "define ACC_DESC_BEGIN before including OpenACCRuntimeDescriptors.def" |
| 32 | #endif |
| 33 | |
| 34 | #ifndef ACC_DESC_FIELD |
| 35 | #define ACC_DESC_FIELD(Enum, Field, TypeToken) |
| 36 | #endif |
| 37 | |
| 38 | #ifndef ACC_DESC_END |
| 39 | #define ACC_DESC_END(Enum) |
| 40 | #endif |
| 41 | |
| 42 | // A mapping that needs no descriptor of its own, used as the base of an |
| 43 | // OpenACC overlay that only carries bounds. |
| 44 | ACC_DESC_BEGIN(AccDataDescGeneric, "AccDataDescGeneric" , DataDescKind::none) |
| 45 | ACC_DESC_FIELD(AccDataDescGeneric, Version, Int32) |
| 46 | ACC_DESC_FIELD(AccDataDescGeneric, Padding, Int32) |
| 47 | ACC_DESC_END(AccDataDescGeneric) |
| 48 | |
| 49 | // A mapping described by a Fortran descriptor (`CFI_cdesc_t` of |
| 50 | // ISO_Fortran_binding.h), which the descriptor field addresses. |
| 51 | ACC_DESC_BEGIN(AccDataDescCFI, "AccDataDescCFI" , DataDescKind::cfi) |
| 52 | ACC_DESC_FIELD(AccDataDescCFI, Version, Int32) |
| 53 | ACC_DESC_FIELD(AccDataDescCFI, CFIDescriptor, Ptr) |
| 54 | ACC_DESC_END(AccDataDescCFI) |
| 55 | |
| 56 | // A mapping described by the memref descriptor the memref-to-LLVM conversion |
| 57 | // produced, which the descriptor field addresses. |
| 58 | ACC_DESC_BEGIN(AccDataDescMemRef, "AccDataDescMemRef" , DataDescKind::memref) |
| 59 | ACC_DESC_FIELD(AccDataDescMemRef, Version, Int32) |
| 60 | ACC_DESC_FIELD(AccDataDescMemRef, Rank, Int8) |
| 61 | ACC_DESC_FIELD(AccDataDescMemRef, ElementSize, Int64) |
| 62 | ACC_DESC_FIELD(AccDataDescMemRef, MemRefDescriptor, Ptr) |
| 63 | ACC_DESC_END(AccDataDescMemRef) |
| 64 | |
| 65 | // Bounds of a mapping, overlaid on the descriptor that states its storage. |
| 66 | // Rank is the number of bounds and each array below holds that many entries, |
| 67 | // in dimension order. |
| 68 | ACC_DESC_BEGIN(AccDataDescOpenACC, "AccDataDescOpenACC" , DataDescKind::openacc) |
| 69 | ACC_DESC_FIELD(AccDataDescOpenACC, Base, Base) |
| 70 | ACC_DESC_FIELD(AccDataDescOpenACC, Rank, Int8) |
| 71 | ACC_DESC_FIELD(AccDataDescOpenACC, ElementSize, Int64) |
| 72 | ACC_DESC_FIELD(AccDataDescOpenACC, LowerBounds, Ptr) |
| 73 | ACC_DESC_FIELD(AccDataDescOpenACC, UpperBounds, Ptr) |
| 74 | ACC_DESC_FIELD(AccDataDescOpenACC, Extents, Ptr) |
| 75 | ACC_DESC_FIELD(AccDataDescOpenACC, StridesInBytes, Ptr) |
| 76 | ACC_DESC_FIELD(AccDataDescOpenACC, StartIndices, Ptr) |
| 77 | ACC_DESC_END(AccDataDescOpenACC) |
| 78 | |
| 79 | #undef ACC_DESC_BEGIN |
| 80 | #undef ACC_DESC_FIELD |
| 81 | #undef ACC_DESC_END |
| 82 | |