Yaxun Liu | a711cc7 | 2016-07-16 05:09:21 +0000 | [diff] [blame] | 1 | //===-- AMDGPURuntimeMetadata.h - AMDGPU Runtime Metadata -------*- C++ -*-===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
| 10 | /// \file |
| 11 | /// |
| 12 | /// Enums and structure types used by runtime metadata. |
| 13 | /// |
| 14 | /// Runtime requests certain information (metadata) about kernels to be able |
| 15 | /// to execute the kernels and answer the queries about the kernels. |
Yaxun Liu | d6fbe65 | 2016-11-10 21:18:49 +0000 | [diff] [blame^] | 16 | /// The metadata is represented as a note element in the .note ELF section of a |
| 17 | /// binary (code object). The desc field of the note element consists of |
| 18 | /// key-value pairs. Each key is an 8 bit unsigned integer. Each value can be |
| 19 | /// an integer, a string, or a stream of key-value pairs. There are 3 levels of |
| 20 | /// key-value pair streams. At the beginning of the ELF section is the top level |
Yaxun Liu | a711cc7 | 2016-07-16 05:09:21 +0000 | [diff] [blame] | 21 | /// key-value pair stream. A kernel-level key-value pair stream starts after |
| 22 | /// encountering KeyKernelBegin and ends immediately before encountering |
| 23 | /// KeyKernelEnd. A kernel-argument-level key-value pair stream starts |
| 24 | /// after encountering KeyArgBegin and ends immediately before encountering |
| 25 | /// KeyArgEnd. A kernel-level key-value pair stream can only appear in a top |
| 26 | /// level key-value pair stream. A kernel-argument-level key-value pair stream |
| 27 | /// can only appear in a kernel-level key-value pair stream. |
| 28 | /// |
| 29 | /// The format should be kept backward compatible. New enum values and bit |
| 30 | /// fields should be appended at the end. It is suggested to bump up the |
| 31 | /// revision number whenever the format changes and document the change |
| 32 | /// in the revision in this header. |
| 33 | /// |
| 34 | // |
| 35 | //===----------------------------------------------------------------------===// |
| 36 | // |
| 37 | #ifndef LLVM_LIB_TARGET_AMDGPU_AMDGPURUNTIMEMETADATA_H |
| 38 | #define LLVM_LIB_TARGET_AMDGPU_AMDGPURUNTIMEMETADATA_H |
| 39 | |
| 40 | #include <stdint.h> |
| 41 | |
| 42 | namespace AMDGPU { |
| 43 | |
| 44 | namespace RuntimeMD { |
| 45 | |
| 46 | // Version and revision of runtime metadata |
| 47 | const unsigned char MDVersion = 1; |
| 48 | const unsigned char MDRevision = 0; |
| 49 | |
Yaxun Liu | a711cc7 | 2016-07-16 05:09:21 +0000 | [diff] [blame] | 50 | // Enumeration values of keys in runtime metadata. |
| 51 | enum Key { |
| 52 | KeyNull = 0, // Place holder. Ignored when encountered |
| 53 | KeyMDVersion = 1, // Runtime metadata version |
| 54 | KeyLanguage = 2, // Language |
| 55 | KeyLanguageVersion = 3, // Language version |
| 56 | KeyKernelBegin = 4, // Beginning of kernel-level stream |
| 57 | KeyKernelEnd = 5, // End of kernel-level stream |
| 58 | KeyKernelName = 6, // Kernel name |
| 59 | KeyArgBegin = 7, // Beginning of kernel-arg-level stream |
| 60 | KeyArgEnd = 8, // End of kernel-arg-level stream |
| 61 | KeyArgSize = 9, // Kernel arg size |
| 62 | KeyArgAlign = 10, // Kernel arg alignment |
| 63 | KeyArgTypeName = 11, // Kernel type name |
| 64 | KeyArgName = 12, // Kernel name |
Yaxun Liu | 6389140 | 2016-09-07 17:44:00 +0000 | [diff] [blame] | 65 | KeyArgKind = 13, // Kernel argument kind |
Yaxun Liu | a711cc7 | 2016-07-16 05:09:21 +0000 | [diff] [blame] | 66 | KeyArgValueType = 14, // Kernel argument value type |
| 67 | KeyArgAddrQual = 15, // Kernel argument address qualifier |
| 68 | KeyArgAccQual = 16, // Kernel argument access qualifier |
| 69 | KeyArgIsConst = 17, // Kernel argument is const qualified |
| 70 | KeyArgIsRestrict = 18, // Kernel argument is restrict qualified |
| 71 | KeyArgIsVolatile = 19, // Kernel argument is volatile qualified |
| 72 | KeyArgIsPipe = 20, // Kernel argument is pipe qualified |
| 73 | KeyReqdWorkGroupSize = 21, // Required work group size |
| 74 | KeyWorkGroupSizeHint = 22, // Work group size hint |
| 75 | KeyVecTypeHint = 23, // Vector type hint |
| 76 | KeyKernelIndex = 24, // Kernel index for device enqueue |
Yaxun Liu | 6389140 | 2016-09-07 17:44:00 +0000 | [diff] [blame] | 77 | KeyMinWavesPerSIMD = 25, // Minimum number of waves per SIMD |
| 78 | KeyMaxWavesPerSIMD = 26, // Maximum number of waves per SIMD |
| 79 | KeyFlatWorkGroupSizeLimits = 27, // Flat work group size limits |
| 80 | KeyMaxWorkGroupSize = 28, // Maximum work group size |
| 81 | KeyNoPartialWorkGroups = 29, // No partial work groups |
| 82 | KeyPrintfInfo = 30, // Prinf function call information |
| 83 | KeyArgActualAcc = 31, // The actual kernel argument access qualifier |
Yaxun Liu | add05a8 | 2016-09-01 18:46:49 +0000 | [diff] [blame] | 84 | KeyArgPointeeAlign = 32, // Alignment of pointee type |
Yaxun Liu | a711cc7 | 2016-07-16 05:09:21 +0000 | [diff] [blame] | 85 | }; |
| 86 | |
| 87 | enum Language : uint8_t { |
| 88 | OpenCL_C = 0, |
| 89 | HCC = 1, |
| 90 | OpenMP = 2, |
| 91 | OpenCL_CPP = 3, |
| 92 | }; |
| 93 | |
| 94 | enum LanguageVersion : uint16_t { |
| 95 | V100 = 100, |
| 96 | V110 = 110, |
| 97 | V120 = 120, |
| 98 | V200 = 200, |
| 99 | V210 = 210, |
| 100 | }; |
| 101 | |
| 102 | namespace KernelArg { |
Yaxun Liu | 6389140 | 2016-09-07 17:44:00 +0000 | [diff] [blame] | 103 | enum Kind : uint8_t { |
| 104 | ByValue = 0, |
| 105 | GlobalBuffer = 1, |
| 106 | DynamicSharedPointer = 2, |
| 107 | Sampler = 3, |
| 108 | Image = 4, |
| 109 | Pipe = 5, |
| 110 | Queue = 6, |
| 111 | HiddenGlobalOffsetX = 7, |
| 112 | HiddenGlobalOffsetY = 8, |
| 113 | HiddenGlobalOffsetZ = 9, |
| 114 | HiddenNone = 10, |
| 115 | HiddenPrintfBuffer = 11, |
| 116 | HiddenDefaultQueue = 12, |
| 117 | HiddenCompletionAction = 13, |
Yaxun Liu | a711cc7 | 2016-07-16 05:09:21 +0000 | [diff] [blame] | 118 | }; |
| 119 | |
| 120 | enum ValueType : uint16_t { |
| 121 | Struct = 0, |
| 122 | I8 = 1, |
| 123 | U8 = 2, |
| 124 | I16 = 3, |
| 125 | U16 = 4, |
| 126 | F16 = 5, |
| 127 | I32 = 6, |
| 128 | U32 = 7, |
| 129 | F32 = 8, |
| 130 | I64 = 9, |
| 131 | U64 = 10, |
| 132 | F64 = 11, |
| 133 | }; |
| 134 | |
| 135 | enum AccessQualifer : uint8_t { |
| 136 | None = 0, |
| 137 | ReadOnly = 1, |
| 138 | WriteOnly = 2, |
| 139 | ReadWrite = 3, |
| 140 | }; |
Yaxun Liu | c7cbd72 | 2016-08-15 16:54:25 +0000 | [diff] [blame] | 141 | |
| 142 | enum AddressSpaceQualifer : uint8_t { |
| 143 | Private = 0, |
| 144 | Global = 1, |
| 145 | Constant = 2, |
| 146 | Local = 3, |
Yaxun Liu | 6389140 | 2016-09-07 17:44:00 +0000 | [diff] [blame] | 147 | Generic = 4, |
| 148 | Region = 5, |
Yaxun Liu | c7cbd72 | 2016-08-15 16:54:25 +0000 | [diff] [blame] | 149 | }; |
Yaxun Liu | a711cc7 | 2016-07-16 05:09:21 +0000 | [diff] [blame] | 150 | } // namespace KernelArg |
| 151 | } // namespace RuntimeMD |
| 152 | } // namespace AMDGPU |
| 153 | |
| 154 | #endif // LLVM_LIB_TARGET_AMDGPU_AMDGPURUNTIMEMETADATA_H |