llvm.org GIT mirror llvm / 5556d84
AMDGPU: Bring HSA metadata on par with the specification Differential Revision: https://reviews.llvm.org/D38753 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@315821 91177308-0d34-0410-b5e6-96231b3b80d8 Konstantin Zhuravlyov 1 year, 10 months ago
19 changed file(s) with 540 addition(s) and 449 deletion(s). Raw diff Collapse all Expand all
888888 See
889889 :ref:`amdgpu-amdhsa-code-object-kernel-attribute-metadata-mapping-table`
890890 for the mapping definition.
891 "Arguments" sequence of Sequence of mappings of the
891 "Args" sequence of Sequence of mappings of the
892892 mapping kernel arguments. See
893893 :ref:`amdgpu-amdhsa-code-object-kernel-argument-metadata-mapping-table`
894894 for the definition of the mapping.
10981098 .. TODO
10991099 Does this apply to
11001100 GlobalBuffer?
1101 "ActualAcc" string The actual memory accesses
1101 "ActualAccQual" string The actual memory accesses
11021102 performed by the kernel on the
11031103 kernel argument. Only present if
11041104 "ValueKind" is "GlobalBuffer",
12231223 =================================== ============== ========= ==============
12241224 String Key Value Type Required? Description
12251225 =================================== ============== ========= ==============
1226 "DebuggerABIVersion" string
1226 "DebuggerABIVersion" sequence of
1227 2 integers
12271228 "ReservedNumVGPRs" integer
12281229 "ReservedFirstVGPR" integer
12291230 "PrivateSegmentBufferSGPR" integer
132132
133133 /// \returns True if kernel attributes metadata is empty, false otherwise.
134134 bool empty() const {
135 return mReqdWorkGroupSize.empty() && mWorkGroupSizeHint.empty() &&
136 mVecTypeHint.empty() && mRuntimeHandle.empty();
135 return !notEmpty();
137136 }
138137
139138 /// \returns True if kernel attributes metadata is not empty, false otherwise.
140139 bool notEmpty() const {
141 return !empty();
140 return !mReqdWorkGroupSize.empty() || !mWorkGroupSizeHint.empty() ||
141 !mVecTypeHint.empty() || !mRuntimeHandle.empty();
142142 }
143143 };
144144
150150 namespace Arg {
151151
152152 namespace Key {
153 /// \brief Key for Kernel::Arg::Metadata::mName.
154 constexpr char Name[] = "Name";
155 /// \brief Key for Kernel::Arg::Metadata::mTypeName.
156 constexpr char TypeName[] = "TypeName";
153157 /// \brief Key for Kernel::Arg::Metadata::mSize.
154158 constexpr char Size[] = "Size";
155159 /// \brief Key for Kernel::Arg::Metadata::mAlign.
160164 constexpr char ValueType[] = "ValueType";
161165 /// \brief Key for Kernel::Arg::Metadata::mPointeeAlign.
162166 constexpr char PointeeAlign[] = "PointeeAlign";
167 /// \brief Key for Kernel::Arg::Metadata::mAddrSpaceQual.
168 constexpr char AddrSpaceQual[] = "AddrSpaceQual";
163169 /// \brief Key for Kernel::Arg::Metadata::mAccQual.
164170 constexpr char AccQual[] = "AccQual";
165 /// \brief Key for Kernel::Arg::Metadata::mAddrSpaceQual.
166 constexpr char AddrSpaceQual[] = "AddrSpaceQual";
171 /// \brief Key for Kernel::Arg::Metadata::mActualAccQual.
172 constexpr char ActualAccQual[] = "ActualAccQual";
167173 /// \brief Key for Kernel::Arg::Metadata::mIsConst.
168174 constexpr char IsConst[] = "IsConst";
169 /// \brief Key for Kernel::Arg::Metadata::mIsPipe.
170 constexpr char IsPipe[] = "IsPipe";
171175 /// \brief Key for Kernel::Arg::Metadata::mIsRestrict.
172176 constexpr char IsRestrict[] = "IsRestrict";
173177 /// \brief Key for Kernel::Arg::Metadata::mIsVolatile.
174178 constexpr char IsVolatile[] = "IsVolatile";
175 /// \brief Key for Kernel::Arg::Metadata::mName.
176 constexpr char Name[] = "Name";
177 /// \brief Key for Kernel::Arg::Metadata::mTypeName.
178 constexpr char TypeName[] = "TypeName";
179 /// \brief Key for Kernel::Arg::Metadata::mIsPipe.
180 constexpr char IsPipe[] = "IsPipe";
179181 } // end namespace Key
180182
181183 /// \brief In-memory representation of kernel argument metadata.
182184 struct Metadata final {
185 /// \brief Name. Optional.
186 std::string mName = std::string();
187 /// \brief Type name. Optional.
188 std::string mTypeName = std::string();
183189 /// \brief Size in bytes. Required.
184190 uint32_t mSize = 0;
185191 /// \brief Alignment in bytes. Required.
190196 ValueType mValueType = ValueType::Unknown;
191197 /// \brief Pointee alignment in bytes. Optional.
192198 uint32_t mPointeeAlign = 0;
199 /// \brief Address space qualifier. Optional.
200 AddressSpaceQualifier mAddrSpaceQual = AddressSpaceQualifier::Unknown;
193201 /// \brief Access qualifier. Optional.
194202 AccessQualifier mAccQual = AccessQualifier::Unknown;
195 /// \brief Address space qualifier. Optional.
196 AddressSpaceQualifier mAddrSpaceQual = AddressSpaceQualifier::Unknown;
203 /// \brief Actual access qualifier. Optional.
204 AccessQualifier mActualAccQual = AccessQualifier::Unknown;
197205 /// \brief True if 'const' qualifier is specified. Optional.
198206 bool mIsConst = false;
199 /// \brief True if 'pipe' qualifier is specified. Optional.
200 bool mIsPipe = false;
201207 /// \brief True if 'restrict' qualifier is specified. Optional.
202208 bool mIsRestrict = false;
203209 /// \brief True if 'volatile' qualifier is specified. Optional.
204210 bool mIsVolatile = false;
205 /// \brief Name. Optional.
206 std::string mName = std::string();
207 /// \brief Type name. Optional.
208 std::string mTypeName = std::string();
211 /// \brief True if 'pipe' qualifier is specified. Optional.
212 bool mIsPipe = false;
209213
210214 /// \brief Default constructor.
211215 Metadata() = default;
221225 namespace Key {
222226 /// \brief Key for Kernel::CodeProps::Metadata::mKernargSegmentSize.
223227 constexpr char KernargSegmentSize[] = "KernargSegmentSize";
224 /// \brief Key for Kernel::CodeProps::Metadata::mWorkgroupGroupSegmentSize.
225 constexpr char WorkgroupGroupSegmentSize[] = "WorkgroupGroupSegmentSize";
226 /// \brief Key for Kernel::CodeProps::Metadata::mWorkitemPrivateSegmentSize.
227 constexpr char WorkitemPrivateSegmentSize[] = "WorkitemPrivateSegmentSize";
228 /// \brief Key for Kernel::CodeProps::Metadata::mWavefrontNumSGPRs.
229 constexpr char WavefrontNumSGPRs[] = "WavefrontNumSGPRs";
230 /// \brief Key for Kernel::CodeProps::Metadata::mWorkitemNumVGPRs.
231 constexpr char WorkitemNumVGPRs[] = "WorkitemNumVGPRs";
228 /// \brief Key for Kernel::CodeProps::Metadata::mGroupSegmentFixedSize.
229 constexpr char GroupSegmentFixedSize[] = "GroupSegmentFixedSize";
230 /// \brief Key for Kernel::CodeProps::Metadata::mPrivateSegmentFixedSize.
231 constexpr char PrivateSegmentFixedSize[] = "PrivateSegmentFixedSize";
232232 /// \brief Key for Kernel::CodeProps::Metadata::mKernargSegmentAlign.
233233 constexpr char KernargSegmentAlign[] = "KernargSegmentAlign";
234 /// \brief Key for Kernel::CodeProps::Metadata::mGroupSegmentAlign.
235 constexpr char GroupSegmentAlign[] = "GroupSegmentAlign";
236 /// \brief Key for Kernel::CodeProps::Metadata::mPrivateSegmentAlign.
237 constexpr char PrivateSegmentAlign[] = "PrivateSegmentAlign";
238234 /// \brief Key for Kernel::CodeProps::Metadata::mWavefrontSize.
239235 constexpr char WavefrontSize[] = "WavefrontSize";
236 /// \brief Key for Kernel::CodeProps::Metadata::mNumSGPRs.
237 constexpr char NumSGPRs[] = "NumSGPRs";
238 /// \brief Key for Kernel::CodeProps::Metadata::mNumVGPRs.
239 constexpr char NumVGPRs[] = "NumVGPRs";
240 /// \brief Key for Kernel::CodeProps::Metadata::mMaxFlatWorkgroupSize.
241 constexpr char MaxFlatWorkgroupSize[] = "MaxFlatWorkgroupSize";
242 /// \brief Key for Kernel::CodeProps::Metadata::mIsDynamicCallStack.
243 constexpr char IsDynamicCallStack[] = "IsDynamicCallStack";
244 /// \brief Key for Kernel::CodeProps::Metadata::mIsXNACKEnabled.
245 constexpr char IsXNACKEnabled[] = "IsXNACKEnabled";
240246 } // end namespace Key
241247
242248 /// \brief In-memory representation of kernel code properties metadata.
243249 struct Metadata final {
244250 /// \brief Size in bytes of the kernarg segment memory. Kernarg segment memory
245 /// holds the values of the arguments to the kernel. Optional.
251 /// holds the values of the arguments to the kernel. Required.
246252 uint64_t mKernargSegmentSize = 0;
247253 /// \brief Size in bytes of the group segment memory required by a workgroup.
248254 /// This value does not include any dynamically allocated group segment memory
249 /// that may be added when the kernel is dispatched. Optional.
250 uint32_t mWorkgroupGroupSegmentSize = 0;
255 /// that may be added when the kernel is dispatched. Required.
256 uint32_t mGroupSegmentFixedSize = 0;
251257 /// \brief Size in bytes of the private segment memory required by a workitem.
252 /// Private segment memory includes arg, spill and private segments. Optional.
253 uint32_t mWorkitemPrivateSegmentSize = 0;
258 /// Private segment memory includes arg, spill and private segments. Required.
259 uint32_t mPrivateSegmentFixedSize = 0;
260 /// \brief Maximum byte alignment of variables used by the kernel in the
261 /// kernarg memory segment. Required.
262 uint32_t mKernargSegmentAlign = 0;
263 /// \brief Wavefront size. Required.
264 uint32_t mWavefrontSize = 0;
254265 /// \brief Total number of SGPRs used by a wavefront. Optional.
255 uint16_t mWavefrontNumSGPRs = 0;
266 uint16_t mNumSGPRs = 0;
256267 /// \brief Total number of VGPRs used by a workitem. Optional.
257 uint16_t mWorkitemNumVGPRs = 0;
258 /// \brief Maximum byte alignment of variables used by the kernel in the
259 /// kernarg memory segment. Expressed as a power of two. Optional.
260 uint8_t mKernargSegmentAlign = 0;
261 /// \brief Maximum byte alignment of variables used by the kernel in the
262 /// group memory segment. Expressed as a power of two. Optional.
263 uint8_t mGroupSegmentAlign = 0;
264 /// \brief Maximum byte alignment of variables used by the kernel in the
265 /// private memory segment. Expressed as a power of two. Optional.
266 uint8_t mPrivateSegmentAlign = 0;
267 /// \brief Wavefront size. Expressed as a power of two. Optional.
268 uint8_t mWavefrontSize = 0;
268 uint16_t mNumVGPRs = 0;
269 /// \brief Maximum flat work-group size supported by the kernel. Optional.
270 uint32_t mMaxFlatWorkgroupSize = 0;
271 /// \brief True if the generated machine code is using a dynamically sized
272 /// call stack. Optional.
273 bool mIsDynamicCallStack = false;
274 /// \brief True if the generated machine code is capable of supporting XNACK.
275 /// Optional.
276 bool mIsXNACKEnabled = false;
269277
270278 /// \brief Default constructor.
271279 Metadata() = default;
279287 /// \returns True if kernel code properties metadata is not empty, false
280288 /// otherwise.
281289 bool notEmpty() const {
282 return mKernargSegmentSize || mWorkgroupGroupSegmentSize ||
283 mWorkitemPrivateSegmentSize || mWavefrontNumSGPRs ||
284 mWorkitemNumVGPRs || mKernargSegmentAlign || mGroupSegmentAlign ||
285 mPrivateSegmentAlign || mWavefrontSize;
290 return true;
286291 }
287292 };
288293
348353 namespace Key {
349354 /// \brief Key for Kernel::Metadata::mName.
350355 constexpr char Name[] = "Name";
356 /// \brief Key for Kernel::Metadata::mSymbolName.
357 constexpr char SymbolName[] = "SymbolName";
351358 /// \brief Key for Kernel::Metadata::mLanguage.
352359 constexpr char Language[] = "Language";
353360 /// \brief Key for Kernel::Metadata::mLanguageVersion.
364371
365372 /// \brief In-memory representation of kernel metadata.
366373 struct Metadata final {
367 /// \brief Name. Required.
374 /// \brief Kernel source name. Required.
368375 std::string mName = std::string();
376 /// \brief Kernel descriptor name. Required.
377 std::string mSymbolName = std::string();
369378 /// \brief Language. Optional.
370379 std::string mLanguage = std::string();
371380 /// \brief Language version. Optional.
400409 std::vector mVersion = std::vector();
401410 /// \brief Printf metadata. Optional.
402411 std::vector mPrintf = std::vector();
403 /// \brief Kernels metadata. Optional.
412 /// \brief Kernels metadata. Required.
404413 std::vector mKernels = std::vector();
405414
406415 /// \brief Default constructor.
103103 template <>
104104 struct MappingTraits {
105105 static void mapping(IO &YIO, Kernel::Arg::Metadata &MD) {
106 YIO.mapOptional(Kernel::Arg::Key::Name, MD.mName, std::string());
107 YIO.mapOptional(Kernel::Arg::Key::TypeName, MD.mTypeName, std::string());
106108 YIO.mapRequired(Kernel::Arg::Key::Size, MD.mSize);
107109 YIO.mapRequired(Kernel::Arg::Key::Align, MD.mAlign);
108110 YIO.mapRequired(Kernel::Arg::Key::ValueKind, MD.mValueKind);
109111 YIO.mapRequired(Kernel::Arg::Key::ValueType, MD.mValueType);
110112 YIO.mapOptional(Kernel::Arg::Key::PointeeAlign, MD.mPointeeAlign,
111113 uint32_t(0));
114 YIO.mapOptional(Kernel::Arg::Key::AddrSpaceQual, MD.mAddrSpaceQual,
115 AddressSpaceQualifier::Unknown);
112116 YIO.mapOptional(Kernel::Arg::Key::AccQual, MD.mAccQual,
113117 AccessQualifier::Unknown);
114 YIO.mapOptional(Kernel::Arg::Key::AddrSpaceQual, MD.mAddrSpaceQual,
115 AddressSpaceQualifier::Unknown);
118 YIO.mapOptional(Kernel::Arg::Key::ActualAccQual, MD.mActualAccQual,
119 AccessQualifier::Unknown);
116120 YIO.mapOptional(Kernel::Arg::Key::IsConst, MD.mIsConst, false);
117 YIO.mapOptional(Kernel::Arg::Key::IsPipe, MD.mIsPipe, false);
118121 YIO.mapOptional(Kernel::Arg::Key::IsRestrict, MD.mIsRestrict, false);
119122 YIO.mapOptional(Kernel::Arg::Key::IsVolatile, MD.mIsVolatile, false);
120 YIO.mapOptional(Kernel::Arg::Key::Name, MD.mName, std::string());
121 YIO.mapOptional(Kernel::Arg::Key::TypeName, MD.mTypeName, std::string());
123 YIO.mapOptional(Kernel::Arg::Key::IsPipe, MD.mIsPipe, false);
122124 }
123125 };
124126
125127 template <>
126128 struct MappingTraits {
127129 static void mapping(IO &YIO, Kernel::CodeProps::Metadata &MD) {
128 YIO.mapOptional(Kernel::CodeProps::Key::KernargSegmentSize,
129 MD.mKernargSegmentSize, uint64_t(0));
130 YIO.mapOptional(Kernel::CodeProps::Key::WorkgroupGroupSegmentSize,
131 MD.mWorkgroupGroupSegmentSize, uint32_t(0));
132 YIO.mapOptional(Kernel::CodeProps::Key::WorkitemPrivateSegmentSize,
133 MD.mWorkitemPrivateSegmentSize, uint32_t(0));
134 YIO.mapOptional(Kernel::CodeProps::Key::WavefrontNumSGPRs,
135 MD.mWavefrontNumSGPRs, uint16_t(0));
136 YIO.mapOptional(Kernel::CodeProps::Key::WorkitemNumVGPRs,
137 MD.mWorkitemNumVGPRs, uint16_t(0));
138 YIO.mapOptional(Kernel::CodeProps::Key::KernargSegmentAlign,
139 MD.mKernargSegmentAlign, uint8_t(0));
140 YIO.mapOptional(Kernel::CodeProps::Key::GroupSegmentAlign,
141 MD.mGroupSegmentAlign, uint8_t(0));
142 YIO.mapOptional(Kernel::CodeProps::Key::PrivateSegmentAlign,
143 MD.mPrivateSegmentAlign, uint8_t(0));
144 YIO.mapOptional(Kernel::CodeProps::Key::WavefrontSize,
145 MD.mWavefrontSize, uint8_t(0));
130 YIO.mapRequired(Kernel::CodeProps::Key::KernargSegmentSize,
131 MD.mKernargSegmentSize);
132 YIO.mapRequired(Kernel::CodeProps::Key::GroupSegmentFixedSize,
133 MD.mGroupSegmentFixedSize);
134 YIO.mapRequired(Kernel::CodeProps::Key::PrivateSegmentFixedSize,
135 MD.mPrivateSegmentFixedSize);
136 YIO.mapRequired(Kernel::CodeProps::Key::KernargSegmentAlign,
137 MD.mKernargSegmentAlign);
138 YIO.mapRequired(Kernel::CodeProps::Key::WavefrontSize,
139 MD.mWavefrontSize);
140 YIO.mapOptional(Kernel::CodeProps::Key::NumSGPRs,
141 MD.mNumSGPRs, uint16_t(0));
142 YIO.mapOptional(Kernel::CodeProps::Key::NumVGPRs,
143 MD.mNumVGPRs, uint16_t(0));
144 YIO.mapOptional(Kernel::CodeProps::Key::MaxFlatWorkgroupSize,
145 MD.mMaxFlatWorkgroupSize, uint32_t(0));
146 YIO.mapOptional(Kernel::CodeProps::Key::IsDynamicCallStack,
147 MD.mIsDynamicCallStack, false);
148 YIO.mapOptional(Kernel::CodeProps::Key::IsXNACKEnabled,
149 MD.mIsXNACKEnabled, false);
146150 }
147151 };
148152
166170 struct MappingTraits {
167171 static void mapping(IO &YIO, Kernel::Metadata &MD) {
168172 YIO.mapRequired(Kernel::Key::Name, MD.mName);
173 YIO.mapRequired(Kernel::Key::SymbolName, MD.mSymbolName);
169174 YIO.mapOptional(Kernel::Key::Language, MD.mLanguage, std::string());
170175 YIO.mapOptional(Kernel::Key::LanguageVersion, MD.mLanguageVersion,
171176 std::vector());
198198 if (TM.getTargetTriple().getOS() != Triple::AMDHSA)
199199 return;
200200
201 HSAMetadataStream.emitKernel(*MF->getFunction(), KernelCode);
201 HSAMetadataStream.emitKernel(*MF->getFunction(),
202 getHSACodeProps(*MF, CurrentProgramInfo),
203 getHSADebugProps(*MF, CurrentProgramInfo));
202204 }
203205
204206 void AMDGPUAsmPrinter::EmitFunctionEntryLabel() {
11541156 }
11551157 }
11561158
1159 AMDGPU::HSAMD::Kernel::CodeProps::Metadata AMDGPUAsmPrinter::getHSACodeProps(
1160 const MachineFunction &MF,
1161 const SIProgramInfo &ProgramInfo) const {
1162 const SISubtarget &STM = MF.getSubtarget();
1163 const SIMachineFunctionInfo &MFI = *MF.getInfo();
1164 HSAMD::Kernel::CodeProps::Metadata HSACodeProps;
1165
1166 HSACodeProps.mKernargSegmentSize =
1167 STM.getKernArgSegmentSize(MF, MFI.getABIArgOffset());
1168 HSACodeProps.mGroupSegmentFixedSize = ProgramInfo.LDSSize;
1169 HSACodeProps.mPrivateSegmentFixedSize = ProgramInfo.ScratchSize;
1170 HSACodeProps.mKernargSegmentAlign =
1171 std::max(uint32_t(4), MFI.getMaxKernArgAlign());
1172 HSACodeProps.mWavefrontSize = STM.getWavefrontSize();
1173 HSACodeProps.mNumSGPRs = CurrentProgramInfo.NumSGPR;
1174 HSACodeProps.mNumVGPRs = CurrentProgramInfo.NumVGPR;
1175 // TODO: Emit HSACodeProps.mMaxFlatWorkgroupSize.
1176 HSACodeProps.mIsDynamicCallStack = ProgramInfo.DynamicCallStack;
1177 HSACodeProps.mIsXNACKEnabled = STM.isXNACKEnabled();
1178
1179 return HSACodeProps;
1180 }
1181
1182 AMDGPU::HSAMD::Kernel::DebugProps::Metadata AMDGPUAsmPrinter::getHSADebugProps(
1183 const MachineFunction &MF,
1184 const SIProgramInfo &ProgramInfo) const {
1185 const SISubtarget &STM = MF.getSubtarget();
1186 HSAMD::Kernel::DebugProps::Metadata HSADebugProps;
1187
1188 if (!STM.debuggerSupported())
1189 return HSADebugProps;
1190
1191 HSADebugProps.mDebuggerABIVersion.push_back(1);
1192 HSADebugProps.mDebuggerABIVersion.push_back(0);
1193 HSADebugProps.mReservedNumVGPRs = ProgramInfo.ReservedVGPRCount;
1194 HSADebugProps.mReservedFirstVGPR = ProgramInfo.ReservedVGPRFirst;
1195
1196 if (STM.debuggerEmitPrologue()) {
1197 HSADebugProps.mPrivateSegmentBufferSGPR =
1198 ProgramInfo.DebuggerPrivateSegmentBufferSGPR;
1199 HSADebugProps.mWavefrontPrivateSegmentOffsetSGPR =
1200 ProgramInfo.DebuggerWavefrontPrivateSegmentOffsetSGPR;
1201 }
1202
1203 return HSADebugProps;
1204 }
1205
11571206 bool AMDGPUAsmPrinter::PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
11581207 unsigned AsmVariant,
11591208 const char *ExtraCode, raw_ostream &O) {
127127 unsigned &NumSGPR,
128128 unsigned &NumVGPR) const;
129129
130 AMDGPU::HSAMD::Kernel::CodeProps::Metadata getHSACodeProps(
131 const MachineFunction &MF,
132 const SIProgramInfo &ProgramInfo) const;
133 AMDGPU::HSAMD::Kernel::DebugProps::Metadata getHSADebugProps(
134 const MachineFunction &MF,
135 const SIProgramInfo &ProgramInfo) const;
136
130137 /// \brief Emit register usage information so that the GPU driver
131138 /// can correctly setup the GPU state.
132139 void EmitProgramInfoR600(const MachineFunction &MF);
278278 auto ArgNo = Arg.getArgNo();
279279 const MDNode *Node;
280280
281 StringRef TypeQual;
282 Node = Func->getMetadata("kernel_arg_type_qual");
281 StringRef Name;
282 Node = Func->getMetadata("kernel_arg_name");
283283 if (Node && ArgNo < Node->getNumOperands())
284 TypeQual = cast(Node->getOperand(ArgNo))->getString();
284 Name = cast(Node->getOperand(ArgNo))->getString();
285
286 StringRef TypeName;
287 Node = Func->getMetadata("kernel_arg_type");
288 if (Node && ArgNo < Node->getNumOperands())
289 TypeName = cast(Node->getOperand(ArgNo))->getString();
285290
286291 StringRef BaseTypeName;
287292 Node = Func->getMetadata("kernel_arg_base_type");
298303 AccQual = cast(Node->getOperand(ArgNo))->getString();
299304 }
300305
301 StringRef Name;
302 Node = Func->getMetadata("kernel_arg_name");
306 StringRef TypeQual;
307 Node = Func->getMetadata("kernel_arg_type_qual");
303308 if (Node && ArgNo < Node->getNumOperands())
304 Name = cast(Node->getOperand(ArgNo))->getString();
305
306 StringRef TypeName;
307 Node = Func->getMetadata("kernel_arg_type");
308 if (Node && ArgNo < Node->getNumOperands())
309 TypeName = cast(Node->getOperand(ArgNo))->getString();
309 TypeQual = cast(Node->getOperand(ArgNo))->getString();
310310
311311 emitKernelArg(Func->getParent()->getDataLayout(), Arg.getType(),
312 getValueKind(Arg.getType(), TypeQual, BaseTypeName), TypeQual,
313 BaseTypeName, AccQual, Name, TypeName);
312 getValueKind(Arg.getType(), TypeQual, BaseTypeName), Name,
313 TypeName, BaseTypeName, AccQual, TypeQual);
314314 }
315315
316316 void MetadataStreamer::emitKernelArg(const DataLayout &DL, Type *Ty,
317 ValueKind ValueKind, StringRef TypeQual,
318 StringRef BaseTypeName, StringRef AccQual,
319 StringRef Name, StringRef TypeName) {
317 ValueKind ValueKind, StringRef Name,
318 StringRef TypeName, StringRef BaseTypeName,
319 StringRef AccQual, StringRef TypeQual) {
320320 HSAMetadata.mKernels.back().mArgs.push_back(Kernel::Arg::Metadata());
321321 auto &Arg = HSAMetadata.mKernels.back().mArgs.back();
322322
323 Arg.mName = Name;
324 Arg.mTypeName = TypeName;
323325 Arg.mSize = DL.getTypeAllocSize(Ty);
324326 Arg.mAlign = DL.getABITypeAlignment(Ty);
325327 Arg.mValueKind = ValueKind;
331333 Arg.mPointeeAlign = DL.getABITypeAlignment(ElTy);
332334 }
333335
334 Arg.mAccQual = getAccessQualifier(AccQual);
335
336336 if (auto PtrTy = dyn_cast(Ty))
337337 Arg.mAddrSpaceQual = getAddressSpaceQualifer(PtrTy->getAddressSpace());
338
339 Arg.mAccQual = getAccessQualifier(AccQual);
340
341 // TODO: Emit Arg.mActualAccQual.
338342
339343 SmallVector SplitTypeQuals;
340344 TypeQual.split(SplitTypeQuals, " ", -1, false);
341345 for (StringRef Key : SplitTypeQuals) {
342346 auto P = StringSwitch(Key)
343347 .Case("const", &Arg.mIsConst)
344 .Case("pipe", &Arg.mIsPipe)
345348 .Case("restrict", &Arg.mIsRestrict)
346349 .Case("volatile", &Arg.mIsVolatile)
350 .Case("pipe", &Arg.mIsPipe)
347351 .Default(nullptr);
348352 if (P)
349353 *P = true;
350354 }
351
352 Arg.mName = Name;
353 Arg.mTypeName = TypeName;
354 }
355
356 void MetadataStreamer::emitKernelCodeProps(
357 const amd_kernel_code_t &KernelCode) {
358 auto &CodeProps = HSAMetadata.mKernels.back().mCodeProps;
359
360 CodeProps.mKernargSegmentSize = KernelCode.kernarg_segment_byte_size;
361 CodeProps.mWorkgroupGroupSegmentSize =
362 KernelCode.workgroup_group_segment_byte_size;
363 CodeProps.mWorkitemPrivateSegmentSize =
364 KernelCode.workitem_private_segment_byte_size;
365 CodeProps.mWavefrontNumSGPRs = KernelCode.wavefront_sgpr_count;
366 CodeProps.mWorkitemNumVGPRs = KernelCode.workitem_vgpr_count;
367 CodeProps.mKernargSegmentAlign = KernelCode.kernarg_segment_alignment;
368 CodeProps.mGroupSegmentAlign = KernelCode.group_segment_alignment;
369 CodeProps.mPrivateSegmentAlign = KernelCode.private_segment_alignment;
370 CodeProps.mWavefrontSize = KernelCode.wavefront_size;
371 }
372
373 void MetadataStreamer::emitKernelDebugProps(
374 const amd_kernel_code_t &KernelCode) {
375 if (!(KernelCode.code_properties & AMD_CODE_PROPERTY_IS_DEBUG_SUPPORTED))
376 return;
377
378 auto &DebugProps = HSAMetadata.mKernels.back().mDebugProps;
379
380 // FIXME: Need to pass down debugger ABI version through features. This is ok
381 // for now because we only have one version.
382 DebugProps.mDebuggerABIVersion.push_back(1);
383 DebugProps.mDebuggerABIVersion.push_back(0);
384 DebugProps.mReservedNumVGPRs = KernelCode.reserved_vgpr_count;
385 DebugProps.mReservedFirstVGPR = KernelCode.reserved_vgpr_first;
386 DebugProps.mPrivateSegmentBufferSGPR =
387 KernelCode.debug_private_segment_buffer_sgpr;
388 DebugProps.mWavefrontPrivateSegmentOffsetSGPR =
389 KernelCode.debug_wavefront_private_segment_offset_sgpr;
390355 }
391356
392357 void MetadataStreamer::begin(const Module &Mod) {
406371 verify(HSAMetadataString);
407372 }
408373
409 void MetadataStreamer::emitKernel(const Function &Func,
410 const amd_kernel_code_t &KernelCode) {
374 void MetadataStreamer::emitKernel(
375 const Function &Func,
376 const Kernel::CodeProps::Metadata &CodeProps,
377 const Kernel::DebugProps::Metadata &DebugProps) {
411378 if (Func.getCallingConv() != CallingConv::AMDGPU_KERNEL)
412379 return;
413380
415382 auto &Kernel = HSAMetadata.mKernels.back();
416383
417384 Kernel.mName = Func.getName();
385 Kernel.mSymbolName = (Twine(Func.getName()) + Twine("@kd")).str();
418386 emitKernelLanguage(Func);
419387 emitKernelAttrs(Func);
420388 emitKernelArgs(Func);
421 emitKernelCodeProps(KernelCode);
422 emitKernelDebugProps(KernelCode);
389 HSAMetadata.mKernels.back().mCodeProps = CodeProps;
390 HSAMetadata.mKernels.back().mDebugProps = DebugProps;
423391 }
424392
425393 } // end namespace HSAMD
6767 void emitKernelArg(const Argument &Arg);
6868
6969 void emitKernelArg(const DataLayout &DL, Type *Ty, ValueKind ValueKind,
70 StringRef TypeQual = "", StringRef BaseTypeName = "",
71 StringRef AccQual = "", StringRef Name = "",
72 StringRef TypeName = "");
73
74 void emitKernelCodeProps(const amd_kernel_code_t &KernelCode);
75
76 void emitKernelDebugProps(const amd_kernel_code_t &KernelCode);
70 StringRef Name = "", StringRef TypeName = "",
71 StringRef BaseTypeName = "", StringRef AccQual = "",
72 StringRef TypeQual = "");
7773
7874 public:
7975 MetadataStreamer() = default;
8783
8884 void end();
8985
90 void emitKernel(const Function &Func, const amd_kernel_code_t &KernelCode);
86 void emitKernel(const Function &Func,
87 const Kernel::CodeProps::Metadata &CodeProps,
88 const Kernel::DebugProps::Metadata &DebugProps);
9189 };
9290
9391 } // end namespace HSAMD
4040 ; OSABI-HSA-ELF: ---
4141 ; OSABI-HSA-ELF: Version: [ 1, 0 ]
4242 ; OSABI-HSA-ELF: Kernels:
43 ; OSABI-HSA-ELF: - Name: elf_notes
43 ; OSABI-HSA-ELF: - Name: elf_notes
44 ; OSABI-HSA-ELF: SymbolName: 'elf_notes@kd'
4445 ; OSABI-HSA-ELF: CodeProps:
45 ; OSABI-HSA-ELF: WavefrontNumSGPRs: 96
46 ; OSABI-HSA-ELF: KernargSegmentAlign: 32
47 ; OSABI-HSA-ELF: GroupSegmentAlign: 4
48 ; OSABI-HSA-ELF: PrivateSegmentAlign: 4
49 ; OSABI-HSA-ELF: WavefrontSize: 6
46 ; OSABI-HSA-ELF: KernargSegmentSize: 0
47 ; OSABI-HSA-ELF: GroupSegmentFixedSize: 0
48 ; OSABI-HSA-ELF: PrivateSegmentFixedSize: 0
49 ; OSABI-HSA-ELF: KernargSegmentAlign: 4
50 ; OSABI-HSA-ELF: WavefrontSize: 64
51 ; OSABI-HSA-ELF: NumSGPRs: 96
5052 ; OSABI-HSA-ELF: ...
5153 ; OSABI-HSA-ELF-NOT: Unknown note type
5254 ; OSABI-HSA-ELF-NOT: NT_AMD_AMDGPU_PAL_METADATA (PAL Metadata)
0 ; RUN: llc -mtriple=amdgcn-amd-amdhsa -filetype=obj -o - < %s | llvm-readobj -elf-output-style=GNU -notes | FileCheck %s
11
22 ; CHECK: - Name: test_ro_arg
3 ; CHECK: Args:
4 ; CHECK-NEXT: - Size: 8
3 ; CHECK-NEXT: SymbolName: 'test_ro_arg@kd'
4 ; CHECK-NEXT: Args:
5 ; CHECK-NEXT: - TypeName: 'float*'
6 ; CHECK-NEXT: Size: 8
57 ; CHECK-NEXT: Align: 8
68 ; CHECK-NEXT: ValueKind: GlobalBuffer
79 ; CHECK-NEXT: ValueType: F32
10 ; CHECK-NEXT: AddrSpaceQual: Global
811 ; CHECK-NEXT: AccQual: ReadOnly
9 ; CHECK-NEXT: AddrSpaceQual: Global
1012 ; CHECK-NEXT: IsConst: true
1113 ; CHECK-NEXT: IsRestrict: true
12 ; CHECK-NEXT: TypeName: 'float*'
13
14 ; CHECK-NEXT: - Size: 8
14 ; CHECK-NEXT: - TypeName: 'float*'
15 ; CHECK-NEXT: Size: 8
1516 ; CHECK-NEXT: Align: 8
1617 ; CHECK-NEXT: ValueKind: GlobalBuffer
1718 ; CHECK-NEXT: ValueType: F32
19 ; CHECK-NEXT: AddrSpaceQual: Global
1820 ; CHECK-NEXT: AccQual: Default
19 ; CHECK-NEXT: AddrSpaceQual: Global
20 ; CHECK-NEXT: TypeName: 'float*'
2121
2222 define amdgpu_kernel void @test_ro_arg(float addrspace(1)* noalias readonly %in, float addrspace(1)* %out)
2323 !kernel_arg_addr_space !0 !kernel_arg_access_qual !1 !kernel_arg_type !2
2929 !1 = !{!"none", !"none"}
3030 !2 = !{!"float*", !"float*"}
3131 !3 = !{!"const restrict", !""}
32
0 ; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx700 -filetype=obj -o - < %s | llvm-readobj -elf-output-style=GNU -notes | FileCheck --check-prefix=CHECK --check-prefix=GFX700 --check-prefix=NOTES %s
1 ; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx800 -filetype=obj -o - < %s | llvm-readobj -elf-output-style=GNU -notes | FileCheck --check-prefix=CHECK --check-prefix=GFX800 --check-prefix=NOTES %s
2 ; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 -filetype=obj -o - < %s | llvm-readobj -elf-output-style=GNU -notes | FileCheck --check-prefix=CHECK --check-prefix=GFX900 --check-prefix=NOTES %s
3 ; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx700 -amdgpu-dump-hsa-metadata -amdgpu-verify-hsa-metadata -filetype=obj -o - < %s 2>&1 | FileCheck --check-prefix=PARSER %s
14 ; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx800 -amdgpu-dump-hsa-metadata -amdgpu-verify-hsa-metadata -filetype=obj -o - < %s 2>&1 | FileCheck --check-prefix=PARSER %s
25 ; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 -amdgpu-dump-hsa-metadata -amdgpu-verify-hsa-metadata -filetype=obj -o - < %s 2>&1 | FileCheck --check-prefix=PARSER %s
2023 ; CHECK: Kernels:
2124
2225 ; CHECK: - Name: test_char
23 ; CHECK-NEXT: Language: OpenCL C
24 ; CHECK-NEXT: LanguageVersion: [ 2, 0 ]
25 ; CHECK-NEXT: Args:
26 ; CHECK-NEXT: - Size: 1
26 ; CHECK-NEXT: SymbolName: 'test_char@kd'
27 ; CHECK-NEXT: Language: OpenCL C
28 ; CHECK-NEXT: LanguageVersion: [ 2, 0 ]
29 ; CHECK-NEXT: Args:
30 ; CHECK-NEXT: - TypeName: char
31 ; CHECK-NEXT: Size: 1
2732 ; CHECK-NEXT: Align: 1
2833 ; CHECK-NEXT: ValueKind: ByValue
2934 ; CHECK-NEXT: ValueType: I8
3035 ; CHECK-NEXT: AccQual: Default
31 ; CHECK-NEXT: TypeName: char
3236 ; CHECK-NEXT: - Size: 8
3337 ; CHECK-NEXT: Align: 8
3438 ; CHECK-NEXT: ValueKind: HiddenGlobalOffsetX
5357 }
5458
5559 ; CHECK: - Name: test_ushort2
56 ; CHECK-NEXT: Language: OpenCL C
57 ; CHECK-NEXT: LanguageVersion: [ 2, 0 ]
58 ; CHECK-NEXT: Args:
59 ; CHECK-NEXT: - Size: 4
60 ; CHECK-NEXT: SymbolName: 'test_ushort2@kd'
61 ; CHECK-NEXT: Language: OpenCL C
62 ; CHECK-NEXT: LanguageVersion: [ 2, 0 ]
63 ; CHECK-NEXT: Args:
64 ; CHECK-NEXT: - TypeName: ushort2
65 ; CHECK-NEXT: Size: 4
6066 ; CHECK-NEXT: Align: 4
6167 ; CHECK-NEXT: ValueKind: ByValue
6268 ; CHECK-NEXT: ValueType: U16
6369 ; CHECK-NEXT: AccQual: Default
64 ; CHECK-NEXT: TypeName: ushort2
6570 ; CHECK-NEXT: - Size: 8
6671 ; CHECK-NEXT: Align: 8
6772 ; CHECK-NEXT: ValueKind: HiddenGlobalOffsetX
8691 }
8792
8893 ; CHECK: - Name: test_int3
89 ; CHECK-NEXT: Language: OpenCL C
90 ; CHECK-NEXT: LanguageVersion: [ 2, 0 ]
91 ; CHECK-NEXT: Args:
92 ; CHECK-NEXT: - Size: 16
94 ; CHECK-NEXT: SymbolName: 'test_int3@kd'
95 ; CHECK-NEXT: Language: OpenCL C
96 ; CHECK-NEXT: LanguageVersion: [ 2, 0 ]
97 ; CHECK-NEXT: Args:
98 ; CHECK-NEXT: - TypeName: int3
99 ; CHECK-NEXT: Size: 16
93100 ; CHECK-NEXT: Align: 16
94101 ; CHECK-NEXT: ValueKind: ByValue
95102 ; CHECK-NEXT: ValueType: I32
96103 ; CHECK-NEXT: AccQual: Default
97 ; CHECK-NEXT: TypeName: int3
98104 ; CHECK-NEXT: - Size: 8
99105 ; CHECK-NEXT: Align: 8
100106 ; CHECK-NEXT: ValueKind: HiddenGlobalOffsetX
119125 }
120126
121127 ; CHECK: - Name: test_ulong4
122 ; CHECK-NEXT: Language: OpenCL C
123 ; CHECK-NEXT: LanguageVersion: [ 2, 0 ]
124 ; CHECK-NEXT: Args:
125 ; CHECK-NEXT: - Size: 32
128 ; CHECK-NEXT: SymbolName: 'test_ulong4@kd'
129 ; CHECK-NEXT: Language: OpenCL C
130 ; CHECK-NEXT: LanguageVersion: [ 2, 0 ]
131 ; CHECK-NEXT: Args:
132 ; CHECK-NEXT: - TypeName: ulong4
133 ; CHECK-NEXT: Size: 32
126134 ; CHECK-NEXT: Align: 32
127135 ; CHECK-NEXT: ValueKind: ByValue
128136 ; CHECK-NEXT: ValueType: U64
129137 ; CHECK-NEXT: AccQual: Default
130 ; CHECK-NEXT: TypeName: ulong4
131138 ; CHECK-NEXT: - Size: 8
132139 ; CHECK-NEXT: Align: 8
133140 ; CHECK-NEXT: ValueKind: HiddenGlobalOffsetX
152159 }
153160
154161 ; CHECK: - Name: test_half8
155 ; CHECK-NEXT: Language: OpenCL C
156 ; CHECK-NEXT: LanguageVersion: [ 2, 0 ]
157 ; CHECK-NEXT: Args:
158 ; CHECK-NEXT: - Size: 16
162 ; CHECK-NEXT: SymbolName: 'test_half8@kd'
163 ; CHECK-NEXT: Language: OpenCL C
164 ; CHECK-NEXT: LanguageVersion: [ 2, 0 ]
165 ; CHECK-NEXT: Args:
166 ; CHECK-NEXT: - TypeName: half8
167 ; CHECK-NEXT: Size: 16
159168 ; CHECK-NEXT: Align: 16
160169 ; CHECK-NEXT: ValueKind: ByValue
161170 ; CHECK-NEXT: ValueType: F16
162171 ; CHECK-NEXT: AccQual: Default
163 ; CHECK-NEXT: TypeName: half8
164172 ; CHECK-NEXT: - Size: 8
165173 ; CHECK-NEXT: Align: 8
166174 ; CHECK-NEXT: ValueKind: HiddenGlobalOffsetX
185193 }
186194
187195 ; CHECK: - Name: test_float16
188 ; CHECK-NEXT: Language: OpenCL C
189 ; CHECK-NEXT: LanguageVersion: [ 2, 0 ]
190 ; CHECK-NEXT: Args:
191 ; CHECK-NEXT: - Size: 64
196 ; CHECK-NEXT: SymbolName: 'test_float16@kd'
197 ; CHECK-NEXT: Language: OpenCL C
198 ; CHECK-NEXT: LanguageVersion: [ 2, 0 ]
199 ; CHECK-NEXT: Args:
200 ; CHECK-NEXT: - TypeName: float16
201 ; CHECK-NEXT: Size: 64
192202 ; CHECK-NEXT: Align: 64
193203 ; CHECK-NEXT: ValueKind: ByValue
194204 ; CHECK-NEXT: ValueType: F32
195205 ; CHECK-NEXT: AccQual: Default
196 ; CHECK-NEXT: TypeName: float16
197206 ; CHECK-NEXT: - Size: 8
198207 ; CHECK-NEXT: Align: 8
199208 ; CHECK-NEXT: ValueKind: HiddenGlobalOffsetX
218227 }
219228
220229 ; CHECK: - Name: test_double16
221 ; CHECK-NEXT: Language: OpenCL C
222 ; CHECK-NEXT: LanguageVersion: [ 2, 0 ]
223 ; CHECK-NEXT: Args:
224 ; CHECK-NEXT: - Size: 128
230 ; CHECK-NEXT: SymbolName: 'test_double16@kd'
231 ; CHECK-NEXT: Language: OpenCL C
232 ; CHECK-NEXT: LanguageVersion: [ 2, 0 ]
233 ; CHECK-NEXT: Args:
234 ; CHECK-NEXT: - TypeName: double16
235 ; CHECK-NEXT: Size: 128
225236 ; CHECK-NEXT: Align: 128
226237 ; CHECK-NEXT: ValueKind: ByValue
227238 ; CHECK-NEXT: ValueType: F64
228239 ; CHECK-NEXT: AccQual: Default
229 ; CHECK-NEXT: TypeName: double16
230240 ; CHECK-NEXT: - Size: 8
231241 ; CHECK-NEXT: Align: 8
232242 ; CHECK-NEXT: ValueKind: HiddenGlobalOffsetX
251261 }
252262
253263 ; CHECK: - Name: test_pointer
254 ; CHECK-NEXT: Language: OpenCL C
255 ; CHECK-NEXT: LanguageVersion: [ 2, 0 ]
256 ; CHECK-NEXT: Args:
257 ; CHECK-NEXT: - Size: 8
264 ; CHECK-NEXT: SymbolName: 'test_pointer@kd'
265 ; CHECK-NEXT: Language: OpenCL C
266 ; CHECK-NEXT: LanguageVersion: [ 2, 0 ]
267 ; CHECK-NEXT: Args:
268 ; CHECK-NEXT: - TypeName: 'int *'
269 ; CHECK-NEXT: Size: 8
258270 ; CHECK-NEXT: Align: 8
259271 ; CHECK-NEXT: ValueKind: GlobalBuffer
260272 ; CHECK-NEXT: ValueType: I32
261 ; CHECK-NEXT: AccQual: Default
262 ; CHECK-NEXT: AddrSpaceQual: Global
263 ; CHECK-NEXT: TypeName: 'int *'
273 ; CHECK-NEXT: AddrSpaceQual: Global
274 ; CHECK-NEXT: AccQual: Default
264275 ; CHECK-NEXT: - Size: 8
265276 ; CHECK-NEXT: Align: 8
266277 ; CHECK-NEXT: ValueKind: HiddenGlobalOffsetX
285296 }
286297
287298 ; CHECK: - Name: test_image
288 ; CHECK-NEXT: Language: OpenCL C
289 ; CHECK-NEXT: LanguageVersion: [ 2, 0 ]
290 ; CHECK-NEXT: Args:
291 ; CHECK-NEXT: - Size: 8
299 ; CHECK-NEXT: SymbolName: 'test_image@kd'
300 ; CHECK-NEXT: Language: OpenCL C
301 ; CHECK-NEXT: LanguageVersion: [ 2, 0 ]
302 ; CHECK-NEXT: Args:
303 ; CHECK-NEXT: - TypeName: image2d_t
304 ; CHECK-NEXT: Size: 8
292305 ; CHECK-NEXT: Align: 8
293306 ; CHECK-NEXT: ValueKind: Image
294307 ; CHECK-NEXT: ValueType: Struct
295 ; CHECK-NEXT: AccQual: Default
296 ; CHECK-NEXT: AddrSpaceQual: Global
297 ; CHECK-NEXT: TypeName: image2d_t
308 ; CHECK-NEXT: AddrSpaceQual: Global
309 ; CHECK-NEXT: AccQual: Default
298310 ; CHECK-NEXT: - Size: 8
299311 ; CHECK-NEXT: Align: 8
300312 ; CHECK-NEXT: ValueKind: HiddenGlobalOffsetX
319331 }
320332
321333 ; CHECK: - Name: test_sampler
322 ; CHECK-NEXT: Language: OpenCL C
323 ; CHECK-NEXT: LanguageVersion: [ 2, 0 ]
324 ; CHECK-NEXT: Args:
325 ; CHECK-NEXT: - Size: 4
334 ; CHECK-NEXT: SymbolName: 'test_sampler@kd'
335 ; CHECK-NEXT: Language: OpenCL C
336 ; CHECK-NEXT: LanguageVersion: [ 2, 0 ]
337 ; CHECK-NEXT: Args:
338 ; CHECK-NEXT: - TypeName: sampler_t
339 ; CHECK-NEXT: Size: 4
326340 ; CHECK-NEXT: Align: 4
327341 ; CHECK-NEXT: ValueKind: Sampler
328342 ; CHECK-NEXT: ValueType: I32
329343 ; CHECK-NEXT: AccQual: Default
330 ; CHECK-NEXT: TypeName: sampler_t
331344 ; CHECK-NEXT: - Size: 8
332345 ; CHECK-NEXT: Align: 8
333346 ; CHECK-NEXT: ValueKind: HiddenGlobalOffsetX
352365 }
353366
354367 ; CHECK: - Name: test_queue
355 ; CHECK-NEXT: Language: OpenCL C
356 ; CHECK-NEXT: LanguageVersion: [ 2, 0 ]
357 ; CHECK-NEXT: Args:
358 ; CHECK-NEXT: - Size: 8
368 ; CHECK-NEXT: SymbolName: 'test_queue@kd'
369 ; CHECK-NEXT: Language: OpenCL C
370 ; CHECK-NEXT: LanguageVersion: [ 2, 0 ]
371 ; CHECK-NEXT: Args:
372 ; CHECK-NEXT: - TypeName: queue_t
373 ; CHECK-NEXT: Size: 8
359374 ; CHECK-NEXT: Align: 8
360375 ; CHECK-NEXT: ValueKind: Queue
361376 ; CHECK-NEXT: ValueType: Struct
362 ; CHECK-NEXT: AccQual: Default
363 ; CHECK-NEXT: AddrSpaceQual: Global
364 ; CHECK-NEXT: TypeName: queue_t
377 ; CHECK-NEXT: AddrSpaceQual: Global
378 ; CHECK-NEXT: AccQual: Default
365379 ; CHECK-NEXT: - Size: 8
366380 ; CHECK-NEXT: Align: 8
367381 ; CHECK-NEXT: ValueKind: HiddenGlobalOffsetX
386400 }
387401
388402 ; CHECK: - Name: test_struct
389 ; CHECK-NEXT: Language: OpenCL C
390 ; CHECK-NEXT: LanguageVersion: [ 2, 0 ]
391 ; CHECK-NEXT: Args:
392 ; CHECK-NEXT: - Size: 4
403 ; CHECK-NEXT: SymbolName: 'test_struct@kd'
404 ; CHECK-NEXT: Language: OpenCL C
405 ; CHECK-NEXT: LanguageVersion: [ 2, 0 ]
406 ; CHECK-NEXT: Args:
407 ; CHECK-NEXT: - TypeName: struct A
408 ; CHECK-NEXT: Size: 4
393409 ; CHECK-NEXT: Align: 4
394410 ; CHECK-NEXT: ValueKind: GlobalBuffer
395411 ; CHECK-NEXT: ValueType: Struct
396 ; CHECK-NEXT: AccQual: Default
397412 ; CHECK-NEXT: AddrSpaceQual: Private
398 ; CHECK-NEXT: TypeName: struct A
413 ; CHECK-NEXT: AccQual: Default
399414 ; CHECK-NEXT: - Size: 8
400415 ; CHECK-NEXT: Align: 8
401416 ; CHECK-NEXT: ValueKind: HiddenGlobalOffsetX
420435 }
421436
422437 ; CHECK: - Name: test_i128
423 ; CHECK-NEXT: Language: OpenCL C
424 ; CHECK-NEXT: LanguageVersion: [ 2, 0 ]
425 ; CHECK-NEXT: Args:
426 ; CHECK-NEXT: - Size: 16
438 ; CHECK-NEXT: SymbolName: 'test_i128@kd'
439 ; CHECK-NEXT: Language: OpenCL C
440 ; CHECK-NEXT: LanguageVersion: [ 2, 0 ]
441 ; CHECK-NEXT: Args:
442 ; CHECK-NEXT: - TypeName: i128
443 ; CHECK-NEXT: Size: 16
427444 ; CHECK-NEXT: Align: 8
428445 ; CHECK-NEXT: ValueKind: ByValue
429446 ; CHECK-NEXT: ValueType: Struct
430447 ; CHECK-NEXT: AccQual: Default
431 ; CHECK-NEXT: TypeName: i128
432448 ; CHECK-NEXT: - Size: 8
433449 ; CHECK-NEXT: Align: 8
434450 ; CHECK-NEXT: ValueKind: HiddenGlobalOffsetX
453469 }
454470
455471 ; CHECK: - Name: test_multi_arg
456 ; CHECK-NEXT: Language: OpenCL C
457 ; CHECK-NEXT: LanguageVersion: [ 2, 0 ]
458 ; CHECK-NEXT: Args:
459 ; CHECK-NEXT: - Size: 4
460 ; CHECK-NEXT: Align: 4
461 ; CHECK-NEXT: ValueKind: ByValue
462 ; CHECK-NEXT: ValueType: I32
463 ; CHECK-NEXT: AccQual: Default
464 ; CHECK-NEXT: TypeName: int
465 ; CHECK-NEXT: - Size: 4
472 ; CHECK-NEXT: SymbolName: 'test_multi_arg@kd'
473 ; CHECK-NEXT: Language: OpenCL C
474 ; CHECK-NEXT: LanguageVersion: [ 2, 0 ]
475 ; CHECK-NEXT: Args:
476 ; CHECK-NEXT: - TypeName: int
477 ; CHECK-NEXT: Size: 4
478 ; CHECK-NEXT: Align: 4
479 ; CHECK-NEXT: ValueKind: ByValue
480 ; CHECK-NEXT: ValueType: I32
481 ; CHECK-NEXT: AccQual: Default
482 ; CHECK-NEXT: - TypeName: short2
483 ; CHECK-NEXT: Size: 4
466484 ; CHECK-NEXT: Align: 4
467485 ; CHECK-NEXT: ValueKind: ByValue
468486 ; CHECK-NEXT: ValueType: I16
469487 ; CHECK-NEXT: AccQual: Default
470 ; CHECK-NEXT: TypeName: short2
471 ; CHECK-NEXT: - Size: 4
472 ; CHECK-NEXT: Align: 4
473 ; CHECK-NEXT: ValueKind: ByValue
474 ; CHECK-NEXT: ValueType: I8
475 ; CHECK-NEXT: AccQual: Default
476 ; CHECK-NEXT: TypeName: char3
488 ; CHECK-NEXT: - TypeName: char3
489 ; CHECK-NEXT: Size: 4
490 ; CHECK-NEXT: Align: 4
491 ; CHECK-NEXT: ValueKind: ByValue
492 ; CHECK-NEXT: ValueType: I8
493 ; CHECK-NEXT: AccQual: Default
477494 ; CHECK-NEXT: - Size: 8
478495 ; CHECK-NEXT: Align: 8
479496 ; CHECK-NEXT: ValueKind: HiddenGlobalOffsetX
498515 }
499516
500517 ; CHECK: - Name: test_addr_space
501 ; CHECK-NEXT: Language: OpenCL C
502 ; CHECK-NEXT: LanguageVersion: [ 2, 0 ]
503 ; CHECK-NEXT: Args:
504 ; CHECK-NEXT: - Size: 8
518 ; CHECK-NEXT: SymbolName: 'test_addr_space@kd'
519 ; CHECK-NEXT: Language: OpenCL C
520 ; CHECK-NEXT: LanguageVersion: [ 2, 0 ]
521 ; CHECK-NEXT: Args:
522 ; CHECK-NEXT: - TypeName: 'int *'
523 ; CHECK-NEXT: Size: 8
505524 ; CHECK-NEXT: Align: 8
506525 ; CHECK-NEXT: ValueKind: GlobalBuffer
507526 ; CHECK-NEXT: ValueType: I32
508 ; CHECK-NEXT: AccQual: Default
509 ; CHECK-NEXT: AddrSpaceQual: Global
510 ; CHECK-NEXT: TypeName: 'int *'
511 ; CHECK-NEXT: - Size: 8
527 ; CHECK-NEXT: AddrSpaceQual: Global
528 ; CHECK-NEXT: AccQual: Default
529 ; CHECK-NEXT: - TypeName: 'int *'
530 ; CHECK-NEXT: Size: 8
512531 ; CHECK-NEXT: Align: 8
513532 ; CHECK-NEXT: ValueKind: GlobalBuffer
514533 ; CHECK-NEXT: ValueType: I32
515 ; CHECK-NEXT: AccQual: Default
516534 ; CHECK-NEXT: AddrSpaceQual: Constant
517 ; CHECK-NEXT: TypeName: 'int *'
518 ; CHECK-NEXT: - Size: 4
535 ; CHECK-NEXT: AccQual: Default
536 ; CHECK-NEXT: - TypeName: 'int *'
537 ; CHECK-NEXT: Size: 4
519538 ; CHECK-NEXT: Align: 4
520539 ; CHECK-NEXT: ValueKind: DynamicSharedPointer
521540 ; CHECK-NEXT: ValueType: I32
522541 ; CHECK-NEXT: PointeeAlign: 4
523 ; CHECK-NEXT: AccQual: Default
524542 ; CHECK-NEXT: AddrSpaceQual: Local
525 ; CHECK-NEXT: TypeName: 'int *'
543 ; CHECK-NEXT: AccQual: Default
526544 ; CHECK-NEXT: - Size: 8
527545 ; CHECK-NEXT: Align: 8
528546 ; CHECK-NEXT: ValueKind: HiddenGlobalOffsetX
549567 }
550568
551569 ; CHECK: - Name: test_type_qual
552 ; CHECK-NEXT: Language: OpenCL C
553 ; CHECK-NEXT: LanguageVersion: [ 2, 0 ]
554 ; CHECK-NEXT: Args:
555 ; CHECK-NEXT: - Size: 8
570 ; CHECK-NEXT: SymbolName: 'test_type_qual@kd'
571 ; CHECK-NEXT: Language: OpenCL C
572 ; CHECK-NEXT: LanguageVersion: [ 2, 0 ]
573 ; CHECK-NEXT: Args:
574 ; CHECK-NEXT: - TypeName: 'int *'
575 ; CHECK-NEXT: Size: 8
556576 ; CHECK-NEXT: Align: 8
557577 ; CHECK-NEXT: ValueKind: GlobalBuffer
558578 ; CHECK-NEXT: ValueType: I32
559 ; CHECK-NEXT: AccQual: Default
560 ; CHECK-NEXT: AddrSpaceQual: Global
579 ; CHECK-NEXT: AddrSpaceQual: Global
580 ; CHECK-NEXT: AccQual: Default
561581 ; CHECK-NEXT: IsVolatile: true
562 ; CHECK-NEXT: TypeName: 'int *'
563 ; CHECK-NEXT: - Size: 8
582 ; CHECK-NEXT: - TypeName: 'int *'
583 ; CHECK-NEXT: Size: 8
564584 ; CHECK-NEXT: Align: 8
565585 ; CHECK-NEXT: ValueKind: GlobalBuffer
566586 ; CHECK-NEXT: ValueType: I32
567 ; CHECK-NEXT: AccQual: Default
568 ; CHECK-NEXT: AddrSpaceQual: Global
587 ; CHECK-NEXT: AddrSpaceQual: Global
588 ; CHECK-NEXT: AccQual: Default
569589 ; CHECK-NEXT: IsConst: true
570590 ; CHECK-NEXT: IsRestrict: true
571 ; CHECK-NEXT: TypeName: 'int *'
572 ; CHECK-NEXT: - Size: 8
591 ; CHECK-NEXT: - TypeName: 'int *'
592 ; CHECK-NEXT: Size: 8
573593 ; CHECK-NEXT: Align: 8
574594 ; CHECK-NEXT: ValueKind: Pipe
575595 ; CHECK-NEXT: ValueType: Struct
576 ; CHECK-NEXT: AccQual: Default
577 ; CHECK-NEXT: AddrSpaceQual: Global
596 ; CHECK-NEXT: AddrSpaceQual: Global
597 ; CHECK-NEXT: AccQual: Default
578598 ; CHECK-NEXT: IsPipe: true
579 ; CHECK-NEXT: TypeName: 'int *'
580599 ; CHECK-NEXT: - Size: 8
581600 ; CHECK-NEXT: Align: 8
582601 ; CHECK-NEXT: ValueKind: HiddenGlobalOffsetX
603622 }
604623
605624 ; CHECK: - Name: test_access_qual
606 ; CHECK-NEXT: Language: OpenCL C
607 ; CHECK-NEXT: LanguageVersion: [ 2, 0 ]
608 ; CHECK-NEXT: Args:
609 ; CHECK-NEXT: - Size: 8
625 ; CHECK-NEXT: SymbolName: 'test_access_qual@kd'
626 ; CHECK-NEXT: Language: OpenCL C
627 ; CHECK-NEXT: LanguageVersion: [ 2, 0 ]
628 ; CHECK-NEXT: Args:
629 ; CHECK-NEXT: - TypeName: image1d_t
630 ; CHECK-NEXT: Size: 8
610631 ; CHECK-NEXT: Align: 8
611632 ; CHECK-NEXT: ValueKind: Image
612633 ; CHECK-NEXT: ValueType: Struct
634 ; CHECK-NEXT: AddrSpaceQual: Global
613635 ; CHECK-NEXT: AccQual: ReadOnly
614 ; CHECK-NEXT: AddrSpaceQual: Global
615 ; CHECK-NEXT: TypeName: image1d_t
616 ; CHECK-NEXT: - Size: 8
636 ; CHECK-NEXT: - TypeName: image2d_t
637 ; CHECK-NEXT: Size: 8
617638 ; CHECK-NEXT: Align: 8
618639 ; CHECK-NEXT: ValueKind: Image
619640 ; CHECK-NEXT: ValueType: Struct
641 ; CHECK-NEXT: AddrSpaceQual: Global
620642 ; CHECK-NEXT: AccQual: WriteOnly
621 ; CHECK-NEXT: AddrSpaceQual: Global
622 ; CHECK-NEXT: TypeName: image2d_t
623 ; CHECK-NEXT: - Size: 8
643 ; CHECK-NEXT: - TypeName: image3d_t
644 ; CHECK-NEXT: Size: 8
624645 ; CHECK-NEXT: Align: 8
625646 ; CHECK-NEXT: ValueKind: Image
626647 ; CHECK-NEXT: ValueType: Struct
648 ; CHECK-NEXT: AddrSpaceQual: Global
627649 ; CHECK-NEXT: AccQual: ReadWrite
628 ; CHECK-NEXT: AddrSpaceQual: Global
629 ; CHECK-NEXT: TypeName: image3d_t
630650 ; CHECK-NEXT: - Size: 8
631651 ; CHECK-NEXT: Align: 8
632652 ; CHECK-NEXT: ValueKind: HiddenGlobalOffsetX
653673 }
654674
655675 ; CHECK: - Name: test_vec_type_hint_half
676 ; CHECK-NEXT: SymbolName: 'test_vec_type_hint_half@kd'
656677 ; CHECK-NEXT: Language: OpenCL C
657678 ; CHECK-NEXT: LanguageVersion: [ 2, 0 ]
658679 ; CHECK-NEXT: Attrs:
659680 ; CHECK-NEXT: VecTypeHint: half
660681 ; CHECK-NEXT: Args:
661 ; CHECK-NEXT: - Size: 4
662 ; CHECK-NEXT: Align: 4
663 ; CHECK-NEXT: ValueKind: ByValue
664 ; CHECK-NEXT: ValueType: I32
665 ; CHECK-NEXT: AccQual: Default
666 ; CHECK-NEXT: TypeName: int
682 ; CHECK-NEXT: - TypeName: int
683 ; CHECK-NEXT: Size: 4
684 ; CHECK-NEXT: Align: 4
685 ; CHECK-NEXT: ValueKind: ByValue
686 ; CHECK-NEXT: ValueType: I32
687 ; CHECK-NEXT: AccQual: Default
667688 ; CHECK-NEXT: - Size: 8
668689 ; CHECK-NEXT: Align: 8
669690 ; CHECK-NEXT: ValueKind: HiddenGlobalOffsetX
688709 }
689710
690711 ; CHECK: - Name: test_vec_type_hint_float
712 ; CHECK-NEXT: SymbolName: 'test_vec_type_hint_float@kd'
691713 ; CHECK-NEXT: Language: OpenCL C
692714 ; CHECK-NEXT: LanguageVersion: [ 2, 0 ]
693715 ; CHECK-NEXT: Attrs:
694716 ; CHECK-NEXT: VecTypeHint: float
695717 ; CHECK-NEXT: Args:
696 ; CHECK-NEXT: - Size: 4
697 ; CHECK-NEXT: Align: 4
698 ; CHECK-NEXT: ValueKind: ByValue
699 ; CHECK-NEXT: ValueType: I32
700 ; CHECK-NEXT: AccQual: Default
701 ; CHECK-NEXT: TypeName: int
718 ; CHECK-NEXT: - TypeName: int
719 ; CHECK-NEXT: Size: 4
720 ; CHECK-NEXT: Align: 4
721 ; CHECK-NEXT: ValueKind: ByValue
722 ; CHECK-NEXT: ValueType: I32
723 ; CHECK-NEXT: AccQual: Default
702724 ; CHECK-NEXT: - Size: 8
703725 ; CHECK-NEXT: Align: 8
704726 ; CHECK-NEXT: ValueKind: HiddenGlobalOffsetX
723745 }
724746
725747 ; CHECK: - Name: test_vec_type_hint_double
748 ; CHECK-NEXT: SymbolName: 'test_vec_type_hint_double@kd'
726749 ; CHECK-NEXT: Language: OpenCL C
727750 ; CHECK-NEXT: LanguageVersion: [ 2, 0 ]
728751 ; CHECK-NEXT: Attrs:
729752 ; CHECK-NEXT: VecTypeHint: double
730753 ; CHECK-NEXT: Args:
731 ; CHECK-NEXT: - Size: 4
732 ; CHECK-NEXT: Align: 4
733 ; CHECK-NEXT: ValueKind: ByValue
734 ; CHECK-NEXT: ValueType: I32
735 ; CHECK-NEXT: AccQual: Default
736 ; CHECK-NEXT: TypeName: int
754 ; CHECK-NEXT: - TypeName: int
755 ; CHECK-NEXT: Size: 4
756 ; CHECK-NEXT: Align: 4
757 ; CHECK-NEXT: ValueKind: ByValue
758 ; CHECK-NEXT: ValueType: I32
759 ; CHECK-NEXT: AccQual: Default
737760 ; CHECK-NEXT: - Size: 8
738761 ; CHECK-NEXT: Align: 8
739762 ; CHECK-NEXT: ValueKind: HiddenGlobalOffsetX
758781 }
759782
760783 ; CHECK: - Name: test_vec_type_hint_char
784 ; CHECK-NEXT: SymbolName: 'test_vec_type_hint_char@kd'
761785 ; CHECK-NEXT: Language: OpenCL C
762786 ; CHECK-NEXT: LanguageVersion: [ 2, 0 ]
763787 ; CHECK-NEXT: Attrs:
764788 ; CHECK-NEXT: VecTypeHint: char
765789 ; CHECK-NEXT: Args:
766 ; CHECK-NEXT: - Size: 4
767 ; CHECK-NEXT: Align: 4
768 ; CHECK-NEXT: ValueKind: ByValue
769 ; CHECK-NEXT: ValueType: I32
770 ; CHECK-NEXT: AccQual: Default
771 ; CHECK-NEXT: TypeName: int
790 ; CHECK-NEXT: - TypeName: int
791 ; CHECK-NEXT: Size: 4
792 ; CHECK-NEXT: Align: 4
793 ; CHECK-NEXT: ValueKind: ByValue
794 ; CHECK-NEXT: ValueType: I32
795 ; CHECK-NEXT: AccQual: Default
772796 ; CHECK-NEXT: - Size: 8
773797 ; CHECK-NEXT: Align: 8
774798 ; CHECK-NEXT: ValueKind: HiddenGlobalOffsetX
793817 }
794818
795819 ; CHECK: - Name: test_vec_type_hint_short
820 ; CHECK-NEXT: SymbolName: 'test_vec_type_hint_short@kd'
796821 ; CHECK-NEXT: Language: OpenCL C
797822 ; CHECK-NEXT: LanguageVersion: [ 2, 0 ]
798823 ; CHECK-NEXT: Attrs:
799824 ; CHECK-NEXT: VecTypeHint: short
800825 ; CHECK-NEXT: Args:
801 ; CHECK-NEXT: - Size: 4
802 ; CHECK-NEXT: Align: 4
803 ; CHECK-NEXT: ValueKind: ByValue
804 ; CHECK-NEXT: ValueType: I32
805 ; CHECK-NEXT: AccQual: Default
806 ; CHECK-NEXT: TypeName: int
826 ; CHECK-NEXT: - TypeName: int
827 ; CHECK-NEXT: Size: 4
828 ; CHECK-NEXT: Align: 4
829 ; CHECK-NEXT: ValueKind: ByValue
830 ; CHECK-NEXT: ValueType: I32
831 ; CHECK-NEXT: AccQual: Default
807832 ; CHECK-NEXT: - Size: 8
808833 ; CHECK-NEXT: Align: 8
809834 ; CHECK-NEXT: ValueKind: HiddenGlobalOffsetX
828853 }
829854
830855 ; CHECK: - Name: test_vec_type_hint_long
856 ; CHECK-NEXT: SymbolName: 'test_vec_type_hint_long@kd'
831857 ; CHECK-NEXT: Language: OpenCL C
832858 ; CHECK-NEXT: LanguageVersion: [ 2, 0 ]
833859 ; CHECK-NEXT: Attrs:
834860 ; CHECK-NEXT: VecTypeHint: long
835861 ; CHECK-NEXT: Args:
836 ; CHECK-NEXT: - Size: 4
837 ; CHECK-NEXT: Align: 4
838 ; CHECK-NEXT: ValueKind: ByValue
839 ; CHECK-NEXT: ValueType: I32
840 ; CHECK-NEXT: AccQual: Default
841 ; CHECK-NEXT: TypeName: int
862 ; CHECK-NEXT: - TypeName: int
863 ; CHECK-NEXT: Size: 4
864 ; CHECK-NEXT: Align: 4
865 ; CHECK-NEXT: ValueKind: ByValue
866 ; CHECK-NEXT: ValueType: I32
867 ; CHECK-NEXT: AccQual: Default
842868 ; CHECK-NEXT: - Size: 8
843869 ; CHECK-NEXT: Align: 8
844870 ; CHECK-NEXT: ValueKind: HiddenGlobalOffsetX
863889 }
864890
865891 ; CHECK: - Name: test_vec_type_hint_unknown
892 ; CHECK-NEXT: SymbolName: 'test_vec_type_hint_unknown@kd'
866893 ; CHECK-NEXT: Language: OpenCL C
867894 ; CHECK-NEXT: LanguageVersion: [ 2, 0 ]
868895 ; CHECK-NEXT: Attrs:
869896 ; CHECK-NEXT: VecTypeHint: unknown
870897 ; CHECK-NEXT: Args:
871 ; CHECK-NEXT: - Size: 4
872 ; CHECK-NEXT: Align: 4
873 ; CHECK-NEXT: ValueKind: ByValue
874 ; CHECK-NEXT: ValueType: I32
875 ; CHECK-NEXT: AccQual: Default
876 ; CHECK-NEXT: TypeName: int
898 ; CHECK-NEXT: - TypeName: int
899 ; CHECK-NEXT: Size: 4
900 ; CHECK-NEXT: Align: 4
901 ; CHECK-NEXT: ValueKind: ByValue
902 ; CHECK-NEXT: ValueType: I32
903 ; CHECK-NEXT: AccQual: Default
877904 ; CHECK-NEXT: - Size: 8
878905 ; CHECK-NEXT: Align: 8
879906 ; CHECK-NEXT: ValueKind: HiddenGlobalOffsetX
898925 }
899926
900927 ; CHECK: - Name: test_reqd_wgs_vec_type_hint
928 ; CHECK-NEXT: SymbolName: 'test_reqd_wgs_vec_type_hint@kd'
901929 ; CHECK-NEXT: Language: OpenCL C
902930 ; CHECK-NEXT: LanguageVersion: [ 2, 0 ]
903931 ; CHECK-NEXT: Attrs:
904932 ; CHECK-NEXT: ReqdWorkGroupSize: [ 1, 2, 4 ]
905933 ; CHECK-NEXT: VecTypeHint: int
906934 ; CHECK-NEXT: Args:
907 ; CHECK-NEXT: - Size: 4
935 ; CHECK-NEXT: - TypeName: int
936 ; CHECK-NEXT: Size: 4
908937 ; CHECK-NEXT: Align: 4
909938 ; CHECK-NEXT: ValueKind: ByValue
910939 ; CHECK-NEXT: ValueType: I32
911940 ; CHECK-NEXT: AccQual: Default
912 ; CHECK-NEXT: TypeName: int
913941 ; CHECK-NEXT: - Size: 8
914942 ; CHECK-NEXT: Align: 8
915943 ; CHECK-NEXT: ValueKind: HiddenGlobalOffsetX
935963 }
936964
937965 ; CHECK: - Name: test_wgs_hint_vec_type_hint
966 ; CHECK-NEXT: SymbolName: 'test_wgs_hint_vec_type_hint@kd'
938967 ; CHECK-NEXT: Language: OpenCL C
939968 ; CHECK-NEXT: LanguageVersion: [ 2, 0 ]
940969 ; CHECK-NEXT: Attrs:
941970 ; CHECK-NEXT: WorkGroupSizeHint: [ 8, 16, 32 ]
942971 ; CHECK-NEXT: VecTypeHint: uint4
943972 ; CHECK-NEXT: Args:
944 ; CHECK-NEXT: - Size: 4
973 ; CHECK-NEXT: - TypeName: int
974 ; CHECK-NEXT: Size: 4
945975 ; CHECK-NEXT: Align: 4
946976 ; CHECK-NEXT: ValueKind: ByValue
947977 ; CHECK-NEXT: ValueType: I32
948978 ; CHECK-NEXT: AccQual: Default
949 ; CHECK-NEXT: TypeName: int
950979 ; CHECK-NEXT: - Size: 8
951980 ; CHECK-NEXT: Align: 8
952981 ; CHECK-NEXT: ValueKind: HiddenGlobalOffsetX
9721001 }
9731002
9741003 ; CHECK: - Name: test_arg_ptr_to_ptr
975 ; CHECK-NEXT: Language: OpenCL C
976 ; CHECK-NEXT: LanguageVersion: [ 2, 0 ]
977 ; CHECK-NEXT: Args:
978 ; CHECK-NEXT: - Size: 8
1004 ; CHECK-NEXT: SymbolName: 'test_arg_ptr_to_ptr@kd'
1005 ; CHECK-NEXT: Language: OpenCL C
1006 ; CHECK-NEXT: LanguageVersion: [ 2, 0 ]
1007 ; CHECK-NEXT: Args:
1008 ; CHECK-NEXT: - TypeName: 'int **'
1009 ; CHECK-NEXT: Size: 8
9791010 ; CHECK-NEXT: Align: 8
9801011 ; CHECK-NEXT: ValueKind: GlobalBuffer
9811012 ; CHECK-NEXT: ValueType: I32
982 ; CHECK-NEXT: AccQual: Default
983 ; CHECK-NEXT: AddrSpaceQual: Global
984 ; CHECK-NEXT: TypeName: 'int **'
1013 ; CHECK-NEXT: AddrSpaceQual: Global
1014 ; CHECK-NEXT: AccQual: Default
9851015 ; CHECK-NEXT: - Size: 8
9861016 ; CHECK-NEXT: Align: 8
9871017 ; CHECK-NEXT: ValueKind: HiddenGlobalOffsetX
10061036 }
10071037
10081038 ; CHECK: - Name: test_arg_struct_contains_ptr
1009 ; CHECK-NEXT: Language: OpenCL C
1010 ; CHECK-NEXT: LanguageVersion: [ 2, 0 ]
1011 ; CHECK-NEXT: Args:
1012 ; CHECK-NEXT: - Size: 4
1039 ; CHECK-NEXT: SymbolName: 'test_arg_struct_contains_ptr@kd'
1040 ; CHECK-NEXT: Language: OpenCL C
1041 ; CHECK-NEXT: LanguageVersion: [ 2, 0 ]
1042 ; CHECK-NEXT: Args:
1043 ; CHECK-NEXT: - TypeName: struct B
1044 ; CHECK-NEXT: Size: 4
10131045 ; CHECK-NEXT: Align: 4
10141046 ; CHECK-NEXT: ValueKind: GlobalBuffer
10151047 ; CHECK-NEXT: ValueType: Struct
1016 ; CHECK-NEXT: AccQual: Default
10171048 ; CHECK-NEXT: AddrSpaceQual: Private
1018 ; CHECK-NEXT: TypeName: struct B
1049 ; CHECK-NEXT: AccQual: Default
10191050 ; CHECK-NEXT: - Size: 8
10201051 ; CHECK-NEXT: Align: 8
10211052 ; CHECK-NEXT: ValueKind: HiddenGlobalOffsetX
10401071 }
10411072
10421073 ; CHECK: - Name: test_arg_vector_of_ptr
1043 ; CHECK-NEXT: Language: OpenCL C
1044 ; CHECK-NEXT: LanguageVersion: [ 2, 0 ]
1045 ; CHECK-NEXT: Args:
1046 ; CHECK-NEXT: - Size: 16
1074 ; CHECK-NEXT: SymbolName: 'test_arg_vector_of_ptr@kd'
1075 ; CHECK-NEXT: Language: OpenCL C
1076 ; CHECK-NEXT: LanguageVersion: [ 2, 0 ]
1077 ; CHECK-NEXT: Args:
1078 ; CHECK-NEXT: - TypeName: 'global int* __attribute__((ext_vector_type(2)))'
1079 ; CHECK-NEXT: Size: 16
10471080 ; CHECK-NEXT: Align: 16
10481081 ; CHECK-NEXT: ValueKind: ByValue
10491082 ; CHECK-NEXT: ValueType: I32
10501083 ; CHECK-NEXT: AccQual: Default
1051 ; CHECK-NEXT: TypeName: 'global int* __attribute__((ext_vector_type(2)))'
10521084 ; CHECK-NEXT: - Size: 8
10531085 ; CHECK-NEXT: Align: 8
10541086 ; CHECK-NEXT: ValueKind: HiddenGlobalOffsetX
10731105 }
10741106
10751107 ; CHECK: - Name: test_arg_unknown_builtin_type
1076 ; CHECK-NEXT: Language: OpenCL C
1077 ; CHECK-NEXT: LanguageVersion: [ 2, 0 ]
1078 ; CHECK-NEXT: Args:
1079 ; CHECK-NEXT: - Size: 8
1108 ; CHECK-NEXT: SymbolName: 'test_arg_unknown_builtin_type@kd'
1109 ; CHECK-NEXT: Language: OpenCL C
1110 ; CHECK-NEXT: LanguageVersion: [ 2, 0 ]
1111 ; CHECK-NEXT: Args:
1112 ; CHECK-NEXT: - TypeName: clk_event_t
1113 ; CHECK-NEXT: Size: 8
10801114 ; CHECK-NEXT: Align: 8
10811115 ; CHECK-NEXT: ValueKind: GlobalBuffer
10821116 ; CHECK-NEXT: ValueType: Struct
1083 ; CHECK-NEXT: AccQual: Default
1084 ; CHECK-NEXT: AddrSpaceQual: Global
1085 ; CHECK-NEXT: TypeName: clk_event_t
1117 ; CHECK-NEXT: AddrSpaceQual: Global
1118 ; CHECK-NEXT: AccQual: Default
10861119 ; CHECK-NEXT: - Size: 8
10871120 ; CHECK-NEXT: Align: 8
10881121 ; CHECK-NEXT: ValueKind: HiddenGlobalOffsetX
11081141 }
11091142
11101143 ; CHECK: - Name: test_pointee_align
1111 ; CHECK-NEXT: Language: OpenCL C
1112 ; CHECK-NEXT: LanguageVersion: [ 2, 0 ]
1113 ; CHECK-NEXT: Args:
1114 ; CHECK-NEXT: - Size: 8
1144 ; CHECK-NEXT: SymbolName: 'test_pointee_align@kd'
1145 ; CHECK-NEXT: Language: OpenCL C
1146 ; CHECK-NEXT: LanguageVersion: [ 2, 0 ]
1147 ; CHECK-NEXT: Args:
1148 ; CHECK-NEXT: - TypeName: 'long *'
1149 ; CHECK-NEXT: Size: 8
11151150 ; CHECK-NEXT: Align: 8
11161151 ; CHECK-NEXT: ValueKind: GlobalBuffer
11171152 ; CHECK-NEXT: ValueType: I64
1118 ; CHECK-NEXT: AccQual: Default
1119 ; CHECK-NEXT: AddrSpaceQual: Global
1120 ; CHECK-NEXT: TypeName: 'long *'
1121 ; CHECK-NEXT: - Size: 4
1153 ; CHECK-NEXT: AddrSpaceQual: Global
1154 ; CHECK-NEXT: AccQual: Default
1155 ; CHECK-NEXT: - TypeName: 'char *'
1156 ; CHECK-NEXT: Size: 4
11221157 ; CHECK-NEXT: Align: 4
11231158 ; CHECK-NEXT: ValueKind: DynamicSharedPointer
11241159 ; CHECK-NEXT: ValueType: I8
11251160 ; CHECK-NEXT: PointeeAlign: 1
1126 ; CHECK-NEXT: AccQual: Default
11271161 ; CHECK-NEXT: AddrSpaceQual: Local
1128 ; CHECK-NEXT: TypeName: 'char *'
1129 ; CHECK-NEXT: - Size: 4
1162 ; CHECK-NEXT: AccQual: Default
1163 ; CHECK-NEXT: - TypeName: 'char2 *'
1164 ; CHECK-NEXT: Size: 4
11301165 ; CHECK-NEXT: Align: 4
11311166 ; CHECK-NEXT: ValueKind: DynamicSharedPointer
11321167 ; CHECK-NEXT: ValueType: I8
11331168 ; CHECK-NEXT: PointeeAlign: 2
1134 ; CHECK-NEXT: AccQual: Default
11351169 ; CHECK-NEXT: AddrSpaceQual: Local
1136 ; CHECK-NEXT: TypeName: 'char2 *'
1137 ; CHECK-NEXT: - Size: 4
1170 ; CHECK-NEXT: AccQual: Default
1171 ; CHECK-NEXT: - TypeName: 'char3 *'
1172 ; CHECK-NEXT: Size: 4
11381173 ; CHECK-NEXT: Align: 4
11391174 ; CHECK-NEXT: ValueKind: DynamicSharedPointer
11401175 ; CHECK-NEXT: ValueType: I8
11411176 ; CHECK-NEXT: PointeeAlign: 4
1142 ; CHECK-NEXT: AccQual: Default
11431177 ; CHECK-NEXT: AddrSpaceQual: Local
1144 ; CHECK-NEXT: TypeName: 'char3 *'
1145 ; CHECK-NEXT: - Size: 4
1178 ; CHECK-NEXT: AccQual: Default
1179 ; CHECK-NEXT: - TypeName: 'char4 *'
1180 ; CHECK-NEXT: Size: 4
11461181 ; CHECK-NEXT: Align: 4
11471182 ; CHECK-NEXT: ValueKind: DynamicSharedPointer
11481183 ; CHECK-NEXT: ValueType: I8
11491184 ; CHECK-NEXT: PointeeAlign: 4
1150 ; CHECK-NEXT: AccQual: Default
11511185 ; CHECK-NEXT: AddrSpaceQual: Local
1152 ; CHECK-NEXT: TypeName: 'char4 *'
1153 ; CHECK-NEXT: - Size: 4
1186 ; CHECK-NEXT: AccQual: Default
1187 ; CHECK-NEXT: - TypeName: 'char8 *'
1188 ; CHECK-NEXT: Size: 4
11541189 ; CHECK-NEXT: Align: 4
11551190 ; CHECK-NEXT: ValueKind: DynamicSharedPointer
11561191 ; CHECK-NEXT: ValueType: I8
11571192 ; CHECK-NEXT: PointeeAlign: 8
1158 ; CHECK-NEXT: AccQual: Default
11591193 ; CHECK-NEXT: AddrSpaceQual: Local
1160 ; CHECK-NEXT: TypeName: 'char8 *'
1161 ; CHECK-NEXT: - Size: 4
1194 ; CHECK-NEXT: AccQual: Default
1195 ; CHECK-NEXT: - TypeName: 'char16 *'
1196 ; CHECK-NEXT: Size: 4
11621197 ; CHECK-NEXT: Align: 4
11631198 ; CHECK-NEXT: ValueKind: DynamicSharedPointer
11641199 ; CHECK-NEXT: ValueType: I8
11651200 ; CHECK-NEXT: PointeeAlign: 16
1166 ; CHECK-NEXT: AccQual: Default
11671201 ; CHECK-NEXT: AddrSpaceQual: Local
1168 ; CHECK-NEXT: TypeName: 'char16 *'
1202 ; CHECK-NEXT: AccQual: Default
11691203 ; CHECK-NEXT: - Size: 8
11701204 ; CHECK-NEXT: Align: 8
11711205 ; CHECK-NEXT: ValueKind: HiddenGlobalOffsetX
11961230 }
11971231
11981232 ; CHECK: - Name: __test_block_invoke_kernel
1233 ; CHECK-NEXT: SymbolName: '__test_block_invoke_kernel@kd'
11991234 ; CHECK-NEXT: Language: OpenCL C
12001235 ; CHECK-NEXT: LanguageVersion: [ 2, 0 ]
12011236 ; CHECK-NEXT: Attrs:
12021237 ; CHECK-NEXT: RuntimeHandle: __test_block_invoke_kernel_runtime_handle
12031238 ; CHECK-NEXT: Args:
1204 ; CHECK-NEXT: - Size: 25
1239 ; CHECK-NEXT: - TypeName: __block_literal
1240 ; CHECK-NEXT: Size: 25
12051241 ; CHECK-NEXT: Align: 1
12061242 ; CHECK-NEXT: ValueKind: ByValue
12071243 ; CHECK-NEXT: ValueType: Struct
12081244 ; CHECK-NEXT: AccQual: Default
1209 ; CHECK-NEXT: TypeName: __block_literal
12101245 ; CHECK-NEXT: - Size: 8
12111246 ; CHECK-NEXT: Align: 8
12121247 ; CHECK-NEXT: ValueKind: HiddenGlobalOffsetX
1818 ; CHECK: Version: [ 1, 0 ]
1919
2020 ; CHECK: Kernels:
21 ; CHECK: - Name: test
21 ; CHECK: - Name: test
22 ; CHECK: SymbolName: 'test@kd'
2223 ; CHECK: Args:
23 ; CHECK: - Size: 8
24 ; CHECK: - TypeName: image1d_t
25 ; CHECK: Size: 8
2426 ; CHECK: ValueKind: Image
25 ; CHECK: TypeName: image1d_t
26 ; CHECK: - Size: 8
27 ; CHECK: - TypeName: image1d_array_t
28 ; CHECK: Size: 8
2729 ; CHECK: ValueKind: Image
28 ; CHECK: TypeName: image1d_array_t
29 ; CHECK: - Size: 8
30 ; CHECK: - TypeName: image1d_buffer_t
31 ; CHECK: Size: 8
3032 ; CHECK: ValueKind: Image
31 ; CHECK: TypeName: image1d_buffer_t
32 ; CHECK: - Size: 8
33 ; CHECK: - TypeName: image2d_t
34 ; CHECK: Size: 8
3335 ; CHECK: ValueKind: Image
34 ; CHECK: TypeName: image2d_t
35 ; CHECK: - Size: 8
36 ; CHECK: - TypeName: image2d_array_t
37 ; CHECK: Size: 8
3638 ; CHECK: ValueKind: Image
37 ; CHECK: TypeName: image2d_array_t
38 ; CHECK: - Size: 8
39 ; CHECK: - TypeName: image2d_array_depth_t
40 ; CHECK: Size: 8
3941 ; CHECK: ValueKind: Image
40 ; CHECK: TypeName: image2d_array_depth_t
41 ; CHECK: - Size: 8
42 ; CHECK: - TypeName: image2d_array_msaa_t
43 ; CHECK: Size: 8
4244 ; CHECK: ValueKind: Image
43 ; CHECK: TypeName: image2d_array_msaa_t
44 ; CHECK: - Size: 8
45 ; CHECK: - TypeName: image2d_array_msaa_depth_t
46 ; CHECK: Size: 8
4547 ; CHECK: ValueKind: Image
46 ; CHECK: TypeName: image2d_array_msaa_depth_t
47 ; CHECK: - Size: 8
48 ; CHECK: - TypeName: image2d_depth_t
49 ; CHECK: Size: 8
4850 ; CHECK: ValueKind: Image
49 ; CHECK: TypeName: image2d_depth_t
50 ; CHECK: - Size: 8
51 ; CHECK: - TypeName: image2d_msaa_t
52 ; CHECK: Size: 8
5153 ; CHECK: ValueKind: Image
52 ; CHECK: TypeName: image2d_msaa_t
53 ; CHECK: - Size: 8
54 ; CHECK: - TypeName: image2d_msaa_depth_t
55 ; CHECK: Size: 8
5456 ; CHECK: ValueKind: Image
55 ; CHECK: TypeName: image2d_msaa_depth_t
56 ; CHECK: - Size: 8
57 ; CHECK: - TypeName: image3d_t
58 ; CHECK: Size: 8
5759 ; CHECK: ValueKind: Image
58 ; CHECK: TypeName: image3d_t
5960 define amdgpu_kernel void @test(%opencl.image1d_t addrspace(1)* %a,
6061 %opencl.image1d_array_t addrspace(1)* %b,
6162 %opencl.image1d_buffer_t addrspace(1)* %c,
55 ; CHECK: Version: [ 1, 0 ]
66
77 ; CHECK: Kernels:
8 ; CHECK: - Name: test
8 ; CHECK: - Name: test
9 ; CHECK: SymbolName: 'test@kd'
910 ; CHECK: CodeProps:
1011 ; CHECK: KernargSegmentSize: 24
11 ; GFX700: WavefrontNumSGPRs: 6
12 ; GFX800: WavefrontNumSGPRs: 96
13 ; GFX900: WavefrontNumSGPRs: 6
14 ; GFX700: WorkitemNumVGPRs: 4
15 ; GFX800: WorkitemNumVGPRs: 6
16 ; GFX900: WorkitemNumVGPRs: 6
17 ; CHECK: KernargSegmentAlign: 4
18 ; CHECK: GroupSegmentAlign: 4
19 ; CHECK: PrivateSegmentAlign: 4
20 ; CHECK: WavefrontSize: 6
12 ; CHECK: GroupSegmentFixedSize: 0
13 ; CHECK: PrivateSegmentFixedSize: 0
14 ; CHECK: KernargSegmentAlign: 8
15 ; CHECK: WavefrontSize: 64
16 ; GFX700: NumSGPRs: 6
17 ; GFX800: NumSGPRs: 96
18 ; GFX900: NumSGPRs: 6
19 ; GFX700: NumVGPRs: 4
20 ; GFX800: NumVGPRs: 6
21 ; GFX900: NumVGPRs: 6
2122 define amdgpu_kernel void @test(
2223 half addrspace(1)* %r,
2324 half addrspace(1)* %a,
77 ; CHECK: Version: [ 1, 0 ]
88
99 ; CHECK: Kernels:
10 ; CHECK: - Name: test
10 ; CHECK: - Name: test
11 ; CHECK: SymbolName: 'test@kd'
1112 ; CHECK: DebugProps:
1213 ; CHECK: DebuggerABIVersion: [ 1, 0 ]
1314 ; CHECK: ReservedNumVGPRs: 4
88 // CHECK: - '2:1:8:%g\n'
99 // CHECK: Kernels:
1010 // CHECK: - Name: test_kernel
11 // CHECK: SymbolName: 'test_kernel@kd'
1112 // CHECK: Language: OpenCL C
1213 // CHECK: LanguageVersion: [ 2, 0 ]
1314 // CHECK: Args:
14 // CHECK: - Size: 1
15 // CHECK: - TypeName: char
16 // CHECK: Size: 1
1517 // CHECK: Align: 1
1618 // CHECK: ValueKind: ByValue
1719 // CHECK: ValueType: I8
1820 // CHECK: AccQual: Default
19 // CHECK: TypeName: char
2021 // CHECK: - Size: 8
2122 // CHECK: Align: 8
2223 // CHECK: ValueKind: HiddenGlobalOffsetX
4041 Printf: [ '1:1:4:%d\n', '2:1:8:%g\n' ]
4142 Kernels:
4243 - Name: test_kernel
44 SymbolName: test_kernel@kd
4345 Language: OpenCL C
4446 LanguageVersion: [ 2, 0 ]
4547 Args:
46 - Size: 1
48 - TypeName: char
49 Size: 1
4750 Align: 1
4851 ValueKind: ByValue
4952 ValueType: I8
5053 AccQual: Default
51 TypeName: char
5254 - Size: 8
5355 Align: 8
5456 ValueKind: HiddenGlobalOffsetX
88 // CHECK: - '2:1:8:%g\n'
99 // CHECK: Kernels:
1010 // CHECK: - Name: test_kernel
11 // CHECK: SymbolName: 'test_kernel@kd'
1112 // CHECK: Language: OpenCL C
1213 // CHECK: LanguageVersion: [ 2, 0 ]
1314 // CHECK: Attrs:
2021 Printf: [ '1:1:4:%d\n', '2:1:8:%g\n' ]
2122 Kernels:
2223 - Name: test_kernel
24 SymbolName: test_kernel@kd
2325 Language: OpenCL C
2426 LanguageVersion: [ 2, 0 ]
2527 Attrs:
44 // CHECK: .amd_amdgpu_hsa_metadata
55 // CHECK: Version: [ 1, 0 ]
66 // CHECK: Kernels:
7 // CHECK: - Name: test_kernel
7 // CHECK: - Name: test_kernel
8 // CHECK: SymbolName: 'test_kernel@kd'
89 // CHECK: CodeProps:
9 // CHECK: KernargSegmentSize: 24
10 // CHECK: WorkitemPrivateSegmentSize: 16
11 // CHECK: WavefrontNumSGPRs: 6
12 // CHECK: WorkitemNumVGPRs: 12
10 // CHECK: KernargSegmentSize: 24
11 // CHECK: GroupSegmentFixedSize: 24
12 // CHECK: PrivateSegmentFixedSize: 16
13 // CHECK: KernargSegmentAlign: 16
14 // CHECK: WavefrontSize: 64
1315 .amd_amdgpu_hsa_metadata
1416 Version: [ 1, 0 ]
1517 Printf: [ '1:1:4:%d\n', '2:1:8:%g\n' ]
1618 Kernels:
1719 - Name: test_kernel
20 SymbolName: test_kernel@kd
1821 CodeProps:
19 KernargSegmentSize: 24
20 WorkitemPrivateSegmentSize: 16
21 WavefrontNumSGPRs: 6
22 WorkitemNumVGPRs: 12
22 KernargSegmentSize: 24
23 GroupSegmentFixedSize: 24
24 PrivateSegmentFixedSize: 16
25 KernargSegmentAlign: 16
26 WavefrontSize: 64
2327 .end_amd_amdgpu_hsa_metadata
44 // CHECK: .amd_amdgpu_hsa_metadata
55 // CHECK: Version: [ 1, 0 ]
66 // CHECK: Kernels:
7 // CHECK: - Name: test_kernel
7 // CHECK: - Name: test_kernel
8 // CHECK: SymbolName: 'test_kernel@kd'
89 // CHECK: DebugProps:
910 // CHECK: DebuggerABIVersion: [ 1, 0 ]
1011 // CHECK: ReservedNumVGPRs: 4
1617 Printf: [ '1:1:4:%d\n', '2:1:8:%g\n' ]
1718 Kernels:
1819 - Name: test_kernel
20 SymbolName: test_kernel@kd
1921 DebugProps:
2022 DebuggerABIVersion: [ 1, 0 ]
2123 ReservedNumVGPRs: 4
1111 Printf: [ '1:1:4:%d\n', '2:1:8:%g\n' ]
1212 Kernels:
1313 - Name: test_kernel
14 SymbolName: test_kernel@kd
1415 Language: OpenCL C
1516 LanguageVersion: [ 2, 0 ]
1617 Args:
3939 .amd_amdgpu_hsa_metadata
4040 Version: [ 3, 0 ]
4141 Kernels:
42 - Name: amd_kernel_code_t_test_all
43 - Name: amd_kernel_code_t_minimal
42 - Name: amd_kernel_code_t_test_all
43 SymbolName: amd_kernel_code_t_test_all@kd
44 - Name: amd_kernel_code_t_minimal
45 SymbolName: amd_kernel_code_t_minimal@kd
4446 .end_amd_amdgpu_hsa_metadata
4547
4648 // ASM: .amd_amdgpu_hsa_metadata
4749 // ASM: Version: [ 3, 0 ]
4850 // ASM: Kernels:
49 // ASM: - Name: amd_kernel_code_t_test_all
50 // ASM: - Name: amd_kernel_code_t_minimal
51 // ASM: - Name: amd_kernel_code_t_test_all
52 // ASM: SymbolName: 'amd_kernel_code_t_test_all@kd'
53 // ASM: - Name: amd_kernel_code_t_minimal
54 // ASM: SymbolName: 'amd_kernel_code_t_minimal@kd'
5155 // ASM: .end_amd_amdgpu_hsa_metadata
5256
5357 .amdgpu_hsa_kernel amd_kernel_code_t_test_all