Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1 | //===--- AMDGPUMetadata.h ---------------------------------------*- C++ -*-===// |
| 2 | // |
Andrew Walbran | 16937d0 | 2019-10-22 13:54:20 +0100 | [diff] [blame] | 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 |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | // |
| 9 | /// \file |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 10 | /// AMDGPU metadata definitions and in-memory representations. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 11 | /// |
| 12 | // |
| 13 | //===----------------------------------------------------------------------===// |
| 14 | |
| 15 | #ifndef LLVM_SUPPORT_AMDGPUMETADATA_H |
| 16 | #define LLVM_SUPPORT_AMDGPUMETADATA_H |
| 17 | |
| 18 | #include <cstdint> |
| 19 | #include <string> |
| 20 | #include <system_error> |
| 21 | #include <vector> |
| 22 | |
| 23 | namespace llvm { |
| 24 | namespace AMDGPU { |
| 25 | |
| 26 | //===----------------------------------------------------------------------===// |
| 27 | // HSA metadata. |
| 28 | //===----------------------------------------------------------------------===// |
| 29 | namespace HSAMD { |
| 30 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 31 | /// HSA metadata major version. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 32 | constexpr uint32_t VersionMajor = 1; |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 33 | /// HSA metadata minor version. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 34 | constexpr uint32_t VersionMinor = 0; |
| 35 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 36 | /// HSA metadata beginning assembler directive. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 37 | constexpr char AssemblerDirectiveBegin[] = ".amd_amdgpu_hsa_metadata"; |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 38 | /// HSA metadata ending assembler directive. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 39 | constexpr char AssemblerDirectiveEnd[] = ".end_amd_amdgpu_hsa_metadata"; |
| 40 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 41 | /// Access qualifiers. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 42 | enum class AccessQualifier : uint8_t { |
| 43 | Default = 0, |
| 44 | ReadOnly = 1, |
| 45 | WriteOnly = 2, |
| 46 | ReadWrite = 3, |
| 47 | Unknown = 0xff |
| 48 | }; |
| 49 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 50 | /// Address space qualifiers. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 51 | enum class AddressSpaceQualifier : uint8_t { |
| 52 | Private = 0, |
| 53 | Global = 1, |
| 54 | Constant = 2, |
| 55 | Local = 3, |
| 56 | Generic = 4, |
| 57 | Region = 5, |
| 58 | Unknown = 0xff |
| 59 | }; |
| 60 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 61 | /// Value kinds. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 62 | enum class ValueKind : uint8_t { |
| 63 | ByValue = 0, |
| 64 | GlobalBuffer = 1, |
| 65 | DynamicSharedPointer = 2, |
| 66 | Sampler = 3, |
| 67 | Image = 4, |
| 68 | Pipe = 5, |
| 69 | Queue = 6, |
| 70 | HiddenGlobalOffsetX = 7, |
| 71 | HiddenGlobalOffsetY = 8, |
| 72 | HiddenGlobalOffsetZ = 9, |
| 73 | HiddenNone = 10, |
| 74 | HiddenPrintfBuffer = 11, |
| 75 | HiddenDefaultQueue = 12, |
| 76 | HiddenCompletionAction = 13, |
Andrew Walbran | 3d2c197 | 2020-04-07 12:24:26 +0100 | [diff] [blame^] | 77 | HiddenMultiGridSyncArg = 14, |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 78 | Unknown = 0xff |
| 79 | }; |
| 80 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 81 | /// Value types. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 82 | enum class ValueType : uint8_t { |
| 83 | Struct = 0, |
| 84 | I8 = 1, |
| 85 | U8 = 2, |
| 86 | I16 = 3, |
| 87 | U16 = 4, |
| 88 | F16 = 5, |
| 89 | I32 = 6, |
| 90 | U32 = 7, |
| 91 | F32 = 8, |
| 92 | I64 = 9, |
| 93 | U64 = 10, |
| 94 | F64 = 11, |
| 95 | Unknown = 0xff |
| 96 | }; |
| 97 | |
| 98 | //===----------------------------------------------------------------------===// |
| 99 | // Kernel Metadata. |
| 100 | //===----------------------------------------------------------------------===// |
| 101 | namespace Kernel { |
| 102 | |
| 103 | //===----------------------------------------------------------------------===// |
| 104 | // Kernel Attributes Metadata. |
| 105 | //===----------------------------------------------------------------------===// |
| 106 | namespace Attrs { |
| 107 | |
| 108 | namespace Key { |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 109 | /// Key for Kernel::Attr::Metadata::mReqdWorkGroupSize. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 110 | constexpr char ReqdWorkGroupSize[] = "ReqdWorkGroupSize"; |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 111 | /// Key for Kernel::Attr::Metadata::mWorkGroupSizeHint. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 112 | constexpr char WorkGroupSizeHint[] = "WorkGroupSizeHint"; |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 113 | /// Key for Kernel::Attr::Metadata::mVecTypeHint. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 114 | constexpr char VecTypeHint[] = "VecTypeHint"; |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 115 | /// Key for Kernel::Attr::Metadata::mRuntimeHandle. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 116 | constexpr char RuntimeHandle[] = "RuntimeHandle"; |
| 117 | } // end namespace Key |
| 118 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 119 | /// In-memory representation of kernel attributes metadata. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 120 | struct Metadata final { |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 121 | /// 'reqd_work_group_size' attribute. Optional. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 122 | std::vector<uint32_t> mReqdWorkGroupSize = std::vector<uint32_t>(); |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 123 | /// 'work_group_size_hint' attribute. Optional. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 124 | std::vector<uint32_t> mWorkGroupSizeHint = std::vector<uint32_t>(); |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 125 | /// 'vec_type_hint' attribute. Optional. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 126 | std::string mVecTypeHint = std::string(); |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 127 | /// External symbol created by runtime to store the kernel address |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 128 | /// for enqueued blocks. |
| 129 | std::string mRuntimeHandle = std::string(); |
| 130 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 131 | /// Default constructor. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 132 | Metadata() = default; |
| 133 | |
| 134 | /// \returns True if kernel attributes metadata is empty, false otherwise. |
| 135 | bool empty() const { |
| 136 | return !notEmpty(); |
| 137 | } |
| 138 | |
| 139 | /// \returns True if kernel attributes metadata is not empty, false otherwise. |
| 140 | bool notEmpty() const { |
| 141 | return !mReqdWorkGroupSize.empty() || !mWorkGroupSizeHint.empty() || |
| 142 | !mVecTypeHint.empty() || !mRuntimeHandle.empty(); |
| 143 | } |
| 144 | }; |
| 145 | |
| 146 | } // end namespace Attrs |
| 147 | |
| 148 | //===----------------------------------------------------------------------===// |
| 149 | // Kernel Argument Metadata. |
| 150 | //===----------------------------------------------------------------------===// |
| 151 | namespace Arg { |
| 152 | |
| 153 | namespace Key { |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 154 | /// Key for Kernel::Arg::Metadata::mName. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 155 | constexpr char Name[] = "Name"; |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 156 | /// Key for Kernel::Arg::Metadata::mTypeName. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 157 | constexpr char TypeName[] = "TypeName"; |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 158 | /// Key for Kernel::Arg::Metadata::mSize. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 159 | constexpr char Size[] = "Size"; |
Andrew Walbran | 3d2c197 | 2020-04-07 12:24:26 +0100 | [diff] [blame^] | 160 | /// Key for Kernel::Arg::Metadata::mOffset. |
| 161 | constexpr char Offset[] = "Offset"; |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 162 | /// Key for Kernel::Arg::Metadata::mAlign. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 163 | constexpr char Align[] = "Align"; |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 164 | /// Key for Kernel::Arg::Metadata::mValueKind. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 165 | constexpr char ValueKind[] = "ValueKind"; |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 166 | /// Key for Kernel::Arg::Metadata::mValueType. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 167 | constexpr char ValueType[] = "ValueType"; |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 168 | /// Key for Kernel::Arg::Metadata::mPointeeAlign. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 169 | constexpr char PointeeAlign[] = "PointeeAlign"; |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 170 | /// Key for Kernel::Arg::Metadata::mAddrSpaceQual. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 171 | constexpr char AddrSpaceQual[] = "AddrSpaceQual"; |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 172 | /// Key for Kernel::Arg::Metadata::mAccQual. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 173 | constexpr char AccQual[] = "AccQual"; |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 174 | /// Key for Kernel::Arg::Metadata::mActualAccQual. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 175 | constexpr char ActualAccQual[] = "ActualAccQual"; |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 176 | /// Key for Kernel::Arg::Metadata::mIsConst. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 177 | constexpr char IsConst[] = "IsConst"; |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 178 | /// Key for Kernel::Arg::Metadata::mIsRestrict. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 179 | constexpr char IsRestrict[] = "IsRestrict"; |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 180 | /// Key for Kernel::Arg::Metadata::mIsVolatile. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 181 | constexpr char IsVolatile[] = "IsVolatile"; |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 182 | /// Key for Kernel::Arg::Metadata::mIsPipe. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 183 | constexpr char IsPipe[] = "IsPipe"; |
| 184 | } // end namespace Key |
| 185 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 186 | /// In-memory representation of kernel argument metadata. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 187 | struct Metadata final { |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 188 | /// Name. Optional. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 189 | std::string mName = std::string(); |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 190 | /// Type name. Optional. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 191 | std::string mTypeName = std::string(); |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 192 | /// Size in bytes. Required. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 193 | uint32_t mSize = 0; |
Andrew Walbran | 3d2c197 | 2020-04-07 12:24:26 +0100 | [diff] [blame^] | 194 | /// Offset in bytes. Required for code object v3, unused for code object v2. |
| 195 | uint32_t mOffset = 0; |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 196 | /// Alignment in bytes. Required. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 197 | uint32_t mAlign = 0; |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 198 | /// Value kind. Required. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 199 | ValueKind mValueKind = ValueKind::Unknown; |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 200 | /// Value type. Required. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 201 | ValueType mValueType = ValueType::Unknown; |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 202 | /// Pointee alignment in bytes. Optional. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 203 | uint32_t mPointeeAlign = 0; |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 204 | /// Address space qualifier. Optional. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 205 | AddressSpaceQualifier mAddrSpaceQual = AddressSpaceQualifier::Unknown; |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 206 | /// Access qualifier. Optional. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 207 | AccessQualifier mAccQual = AccessQualifier::Unknown; |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 208 | /// Actual access qualifier. Optional. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 209 | AccessQualifier mActualAccQual = AccessQualifier::Unknown; |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 210 | /// True if 'const' qualifier is specified. Optional. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 211 | bool mIsConst = false; |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 212 | /// True if 'restrict' qualifier is specified. Optional. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 213 | bool mIsRestrict = false; |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 214 | /// True if 'volatile' qualifier is specified. Optional. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 215 | bool mIsVolatile = false; |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 216 | /// True if 'pipe' qualifier is specified. Optional. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 217 | bool mIsPipe = false; |
| 218 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 219 | /// Default constructor. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 220 | Metadata() = default; |
| 221 | }; |
| 222 | |
| 223 | } // end namespace Arg |
| 224 | |
| 225 | //===----------------------------------------------------------------------===// |
| 226 | // Kernel Code Properties Metadata. |
| 227 | //===----------------------------------------------------------------------===// |
| 228 | namespace CodeProps { |
| 229 | |
| 230 | namespace Key { |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 231 | /// Key for Kernel::CodeProps::Metadata::mKernargSegmentSize. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 232 | constexpr char KernargSegmentSize[] = "KernargSegmentSize"; |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 233 | /// Key for Kernel::CodeProps::Metadata::mGroupSegmentFixedSize. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 234 | constexpr char GroupSegmentFixedSize[] = "GroupSegmentFixedSize"; |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 235 | /// Key for Kernel::CodeProps::Metadata::mPrivateSegmentFixedSize. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 236 | constexpr char PrivateSegmentFixedSize[] = "PrivateSegmentFixedSize"; |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 237 | /// Key for Kernel::CodeProps::Metadata::mKernargSegmentAlign. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 238 | constexpr char KernargSegmentAlign[] = "KernargSegmentAlign"; |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 239 | /// Key for Kernel::CodeProps::Metadata::mWavefrontSize. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 240 | constexpr char WavefrontSize[] = "WavefrontSize"; |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 241 | /// Key for Kernel::CodeProps::Metadata::mNumSGPRs. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 242 | constexpr char NumSGPRs[] = "NumSGPRs"; |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 243 | /// Key for Kernel::CodeProps::Metadata::mNumVGPRs. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 244 | constexpr char NumVGPRs[] = "NumVGPRs"; |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 245 | /// Key for Kernel::CodeProps::Metadata::mMaxFlatWorkGroupSize. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 246 | constexpr char MaxFlatWorkGroupSize[] = "MaxFlatWorkGroupSize"; |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 247 | /// Key for Kernel::CodeProps::Metadata::mIsDynamicCallStack. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 248 | constexpr char IsDynamicCallStack[] = "IsDynamicCallStack"; |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 249 | /// Key for Kernel::CodeProps::Metadata::mIsXNACKEnabled. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 250 | constexpr char IsXNACKEnabled[] = "IsXNACKEnabled"; |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 251 | /// Key for Kernel::CodeProps::Metadata::mNumSpilledSGPRs. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 252 | constexpr char NumSpilledSGPRs[] = "NumSpilledSGPRs"; |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 253 | /// Key for Kernel::CodeProps::Metadata::mNumSpilledVGPRs. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 254 | constexpr char NumSpilledVGPRs[] = "NumSpilledVGPRs"; |
| 255 | } // end namespace Key |
| 256 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 257 | /// In-memory representation of kernel code properties metadata. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 258 | struct Metadata final { |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 259 | /// Size in bytes of the kernarg segment memory. Kernarg segment memory |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 260 | /// holds the values of the arguments to the kernel. Required. |
| 261 | uint64_t mKernargSegmentSize = 0; |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 262 | /// Size in bytes of the group segment memory required by a workgroup. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 263 | /// This value does not include any dynamically allocated group segment memory |
| 264 | /// that may be added when the kernel is dispatched. Required. |
| 265 | uint32_t mGroupSegmentFixedSize = 0; |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 266 | /// Size in bytes of the private segment memory required by a workitem. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 267 | /// Private segment memory includes arg, spill and private segments. Required. |
| 268 | uint32_t mPrivateSegmentFixedSize = 0; |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 269 | /// Maximum byte alignment of variables used by the kernel in the |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 270 | /// kernarg memory segment. Required. |
| 271 | uint32_t mKernargSegmentAlign = 0; |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 272 | /// Wavefront size. Required. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 273 | uint32_t mWavefrontSize = 0; |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 274 | /// Total number of SGPRs used by a wavefront. Optional. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 275 | uint16_t mNumSGPRs = 0; |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 276 | /// Total number of VGPRs used by a workitem. Optional. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 277 | uint16_t mNumVGPRs = 0; |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 278 | /// Maximum flat work-group size supported by the kernel. Optional. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 279 | uint32_t mMaxFlatWorkGroupSize = 0; |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 280 | /// True if the generated machine code is using a dynamically sized |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 281 | /// call stack. Optional. |
| 282 | bool mIsDynamicCallStack = false; |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 283 | /// True if the generated machine code is capable of supporting XNACK. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 284 | /// Optional. |
| 285 | bool mIsXNACKEnabled = false; |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 286 | /// Number of SGPRs spilled by a wavefront. Optional. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 287 | uint16_t mNumSpilledSGPRs = 0; |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 288 | /// Number of VGPRs spilled by a workitem. Optional. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 289 | uint16_t mNumSpilledVGPRs = 0; |
| 290 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 291 | /// Default constructor. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 292 | Metadata() = default; |
| 293 | |
| 294 | /// \returns True if kernel code properties metadata is empty, false |
| 295 | /// otherwise. |
| 296 | bool empty() const { |
| 297 | return !notEmpty(); |
| 298 | } |
| 299 | |
| 300 | /// \returns True if kernel code properties metadata is not empty, false |
| 301 | /// otherwise. |
| 302 | bool notEmpty() const { |
| 303 | return true; |
| 304 | } |
| 305 | }; |
| 306 | |
| 307 | } // end namespace CodeProps |
| 308 | |
| 309 | //===----------------------------------------------------------------------===// |
| 310 | // Kernel Debug Properties Metadata. |
| 311 | //===----------------------------------------------------------------------===// |
| 312 | namespace DebugProps { |
| 313 | |
| 314 | namespace Key { |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 315 | /// Key for Kernel::DebugProps::Metadata::mDebuggerABIVersion. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 316 | constexpr char DebuggerABIVersion[] = "DebuggerABIVersion"; |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 317 | /// Key for Kernel::DebugProps::Metadata::mReservedNumVGPRs. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 318 | constexpr char ReservedNumVGPRs[] = "ReservedNumVGPRs"; |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 319 | /// Key for Kernel::DebugProps::Metadata::mReservedFirstVGPR. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 320 | constexpr char ReservedFirstVGPR[] = "ReservedFirstVGPR"; |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 321 | /// Key for Kernel::DebugProps::Metadata::mPrivateSegmentBufferSGPR. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 322 | constexpr char PrivateSegmentBufferSGPR[] = "PrivateSegmentBufferSGPR"; |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 323 | /// Key for |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 324 | /// Kernel::DebugProps::Metadata::mWavefrontPrivateSegmentOffsetSGPR. |
| 325 | constexpr char WavefrontPrivateSegmentOffsetSGPR[] = |
| 326 | "WavefrontPrivateSegmentOffsetSGPR"; |
| 327 | } // end namespace Key |
| 328 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 329 | /// In-memory representation of kernel debug properties metadata. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 330 | struct Metadata final { |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 331 | /// Debugger ABI version. Optional. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 332 | std::vector<uint32_t> mDebuggerABIVersion = std::vector<uint32_t>(); |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 333 | /// Consecutive number of VGPRs reserved for debugger use. Must be 0 if |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 334 | /// mDebuggerABIVersion is not set. Optional. |
| 335 | uint16_t mReservedNumVGPRs = 0; |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 336 | /// First fixed VGPR reserved. Must be uint16_t(-1) if |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 337 | /// mDebuggerABIVersion is not set or mReservedFirstVGPR is 0. Optional. |
| 338 | uint16_t mReservedFirstVGPR = uint16_t(-1); |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 339 | /// Fixed SGPR of the first of 4 SGPRs used to hold the scratch V# used |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 340 | /// for the entire kernel execution. Must be uint16_t(-1) if |
| 341 | /// mDebuggerABIVersion is not set or SGPR not used or not known. Optional. |
| 342 | uint16_t mPrivateSegmentBufferSGPR = uint16_t(-1); |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 343 | /// Fixed SGPR used to hold the wave scratch offset for the entire |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 344 | /// kernel execution. Must be uint16_t(-1) if mDebuggerABIVersion is not set |
| 345 | /// or SGPR is not used or not known. Optional. |
| 346 | uint16_t mWavefrontPrivateSegmentOffsetSGPR = uint16_t(-1); |
| 347 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 348 | /// Default constructor. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 349 | Metadata() = default; |
| 350 | |
| 351 | /// \returns True if kernel debug properties metadata is empty, false |
| 352 | /// otherwise. |
| 353 | bool empty() const { |
| 354 | return !notEmpty(); |
| 355 | } |
| 356 | |
| 357 | /// \returns True if kernel debug properties metadata is not empty, false |
| 358 | /// otherwise. |
| 359 | bool notEmpty() const { |
| 360 | return !mDebuggerABIVersion.empty(); |
| 361 | } |
| 362 | }; |
| 363 | |
| 364 | } // end namespace DebugProps |
| 365 | |
| 366 | namespace Key { |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 367 | /// Key for Kernel::Metadata::mName. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 368 | constexpr char Name[] = "Name"; |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 369 | /// Key for Kernel::Metadata::mSymbolName. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 370 | constexpr char SymbolName[] = "SymbolName"; |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 371 | /// Key for Kernel::Metadata::mLanguage. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 372 | constexpr char Language[] = "Language"; |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 373 | /// Key for Kernel::Metadata::mLanguageVersion. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 374 | constexpr char LanguageVersion[] = "LanguageVersion"; |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 375 | /// Key for Kernel::Metadata::mAttrs. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 376 | constexpr char Attrs[] = "Attrs"; |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 377 | /// Key for Kernel::Metadata::mArgs. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 378 | constexpr char Args[] = "Args"; |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 379 | /// Key for Kernel::Metadata::mCodeProps. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 380 | constexpr char CodeProps[] = "CodeProps"; |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 381 | /// Key for Kernel::Metadata::mDebugProps. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 382 | constexpr char DebugProps[] = "DebugProps"; |
| 383 | } // end namespace Key |
| 384 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 385 | /// In-memory representation of kernel metadata. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 386 | struct Metadata final { |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 387 | /// Kernel source name. Required. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 388 | std::string mName = std::string(); |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 389 | /// Kernel descriptor name. Required. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 390 | std::string mSymbolName = std::string(); |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 391 | /// Language. Optional. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 392 | std::string mLanguage = std::string(); |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 393 | /// Language version. Optional. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 394 | std::vector<uint32_t> mLanguageVersion = std::vector<uint32_t>(); |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 395 | /// Attributes metadata. Optional. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 396 | Attrs::Metadata mAttrs = Attrs::Metadata(); |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 397 | /// Arguments metadata. Optional. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 398 | std::vector<Arg::Metadata> mArgs = std::vector<Arg::Metadata>(); |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 399 | /// Code properties metadata. Optional. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 400 | CodeProps::Metadata mCodeProps = CodeProps::Metadata(); |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 401 | /// Debug properties metadata. Optional. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 402 | DebugProps::Metadata mDebugProps = DebugProps::Metadata(); |
| 403 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 404 | /// Default constructor. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 405 | Metadata() = default; |
| 406 | }; |
| 407 | |
| 408 | } // end namespace Kernel |
| 409 | |
| 410 | namespace Key { |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 411 | /// Key for HSA::Metadata::mVersion. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 412 | constexpr char Version[] = "Version"; |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 413 | /// Key for HSA::Metadata::mPrintf. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 414 | constexpr char Printf[] = "Printf"; |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 415 | /// Key for HSA::Metadata::mKernels. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 416 | constexpr char Kernels[] = "Kernels"; |
| 417 | } // end namespace Key |
| 418 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 419 | /// In-memory representation of HSA metadata. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 420 | struct Metadata final { |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 421 | /// HSA metadata version. Required. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 422 | std::vector<uint32_t> mVersion = std::vector<uint32_t>(); |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 423 | /// Printf metadata. Optional. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 424 | std::vector<std::string> mPrintf = std::vector<std::string>(); |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 425 | /// Kernels metadata. Required. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 426 | std::vector<Kernel::Metadata> mKernels = std::vector<Kernel::Metadata>(); |
| 427 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 428 | /// Default constructor. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 429 | Metadata() = default; |
| 430 | }; |
| 431 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 432 | /// Converts \p String to \p HSAMetadata. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 433 | std::error_code fromString(std::string String, Metadata &HSAMetadata); |
| 434 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 435 | /// Converts \p HSAMetadata to \p String. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 436 | std::error_code toString(Metadata HSAMetadata, std::string &String); |
| 437 | |
Andrew Walbran | 16937d0 | 2019-10-22 13:54:20 +0100 | [diff] [blame] | 438 | //===----------------------------------------------------------------------===// |
| 439 | // HSA metadata for v3 code object. |
| 440 | //===----------------------------------------------------------------------===// |
| 441 | namespace V3 { |
| 442 | /// HSA metadata major version. |
| 443 | constexpr uint32_t VersionMajor = 1; |
| 444 | /// HSA metadata minor version. |
| 445 | constexpr uint32_t VersionMinor = 0; |
| 446 | |
| 447 | /// HSA metadata beginning assembler directive. |
| 448 | constexpr char AssemblerDirectiveBegin[] = ".amdgpu_metadata"; |
| 449 | /// HSA metadata ending assembler directive. |
| 450 | constexpr char AssemblerDirectiveEnd[] = ".end_amdgpu_metadata"; |
| 451 | } // end namespace V3 |
| 452 | |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 453 | } // end namespace HSAMD |
| 454 | |
| 455 | //===----------------------------------------------------------------------===// |
| 456 | // PAL metadata. |
| 457 | //===----------------------------------------------------------------------===// |
| 458 | namespace PALMD { |
| 459 | |
Andrew Walbran | 3d2c197 | 2020-04-07 12:24:26 +0100 | [diff] [blame^] | 460 | /// PAL metadata (old linear format) assembler directive. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 461 | constexpr char AssemblerDirective[] = ".amd_amdgpu_pal_metadata"; |
| 462 | |
Andrew Walbran | 3d2c197 | 2020-04-07 12:24:26 +0100 | [diff] [blame^] | 463 | /// PAL metadata (new MsgPack format) beginning assembler directive. |
| 464 | constexpr char AssemblerDirectiveBegin[] = ".amdgpu_pal_metadata"; |
| 465 | |
| 466 | /// PAL metadata (new MsgPack format) ending assembler directive. |
| 467 | constexpr char AssemblerDirectiveEnd[] = ".end_amdgpu_pal_metadata"; |
| 468 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 469 | /// PAL metadata keys. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 470 | enum Key : uint32_t { |
Andrew Walbran | 3d2c197 | 2020-04-07 12:24:26 +0100 | [diff] [blame^] | 471 | R_2E12_COMPUTE_PGM_RSRC1 = 0x2e12, |
| 472 | R_2D4A_SPI_SHADER_PGM_RSRC1_LS = 0x2d4a, |
| 473 | R_2D0A_SPI_SHADER_PGM_RSRC1_HS = 0x2d0a, |
| 474 | R_2CCA_SPI_SHADER_PGM_RSRC1_ES = 0x2cca, |
| 475 | R_2C8A_SPI_SHADER_PGM_RSRC1_GS = 0x2c8a, |
| 476 | R_2C4A_SPI_SHADER_PGM_RSRC1_VS = 0x2c4a, |
| 477 | R_2C0A_SPI_SHADER_PGM_RSRC1_PS = 0x2c0a, |
| 478 | R_2E00_COMPUTE_DISPATCH_INITIATOR = 0x2e00, |
| 479 | R_A1B3_SPI_PS_INPUT_ENA = 0xa1b3, |
| 480 | R_A1B4_SPI_PS_INPUT_ADDR = 0xa1b4, |
| 481 | R_A1B6_SPI_PS_IN_CONTROL = 0xa1b6, |
| 482 | R_A2D5_VGT_SHADER_STAGES_EN = 0xa2d5, |
| 483 | |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 484 | LS_NUM_USED_VGPRS = 0x10000021, |
| 485 | HS_NUM_USED_VGPRS = 0x10000022, |
| 486 | ES_NUM_USED_VGPRS = 0x10000023, |
| 487 | GS_NUM_USED_VGPRS = 0x10000024, |
| 488 | VS_NUM_USED_VGPRS = 0x10000025, |
| 489 | PS_NUM_USED_VGPRS = 0x10000026, |
| 490 | CS_NUM_USED_VGPRS = 0x10000027, |
| 491 | |
| 492 | LS_NUM_USED_SGPRS = 0x10000028, |
| 493 | HS_NUM_USED_SGPRS = 0x10000029, |
| 494 | ES_NUM_USED_SGPRS = 0x1000002a, |
| 495 | GS_NUM_USED_SGPRS = 0x1000002b, |
| 496 | VS_NUM_USED_SGPRS = 0x1000002c, |
| 497 | PS_NUM_USED_SGPRS = 0x1000002d, |
| 498 | CS_NUM_USED_SGPRS = 0x1000002e, |
| 499 | |
| 500 | LS_SCRATCH_SIZE = 0x10000044, |
| 501 | HS_SCRATCH_SIZE = 0x10000045, |
| 502 | ES_SCRATCH_SIZE = 0x10000046, |
| 503 | GS_SCRATCH_SIZE = 0x10000047, |
| 504 | VS_SCRATCH_SIZE = 0x10000048, |
| 505 | PS_SCRATCH_SIZE = 0x10000049, |
| 506 | CS_SCRATCH_SIZE = 0x1000004a |
| 507 | }; |
| 508 | |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 509 | } // end namespace PALMD |
| 510 | } // end namespace AMDGPU |
| 511 | } // end namespace llvm |
| 512 | |
| 513 | #endif // LLVM_SUPPORT_AMDGPUMETADATA_H |