Skip to content

Commit 3f56f92

Browse files
committed
[SYCL] Elizabeth's changes to emit OpenCL kernel metadata for SYCL kernels.
Elizabeth's changes to perform code generation for SYCL kernel device entry point functions caused the following kernel metadata annotations to be emitted for all device targets. - `kernel_arg_addr_space` - `kernel_arg_access_qual` - `kernel_arg_type` - `kernel_arg_base_type` - `kernel_arg_type_qual` It turns out that such metadata is not needed for SYCL; the above annotations are only needed for OpenCL. Investigation revealed that these annotations are emitted by the oneAPI compiler for ESIMD functions, but that was apparently due to an incorrect merge conflict resolution that is now being addressed by intel/llvm#17723. The above annotations are referenced by the SPIR-V Translator documentation. See https://github.com/KhronosGroup/SPIRV-LLVM-Translator/blob/main/docs/SPIRVRepresentationInLLVM.rst#function-metadata. The oneAPI compiler does emit a `kernel_arg_buffer_location` annotation that is presumed to be needed as part of the support for the dead kernel argument elimination pass. Support for that annotation does not yet exist upstream.
1 parent ffeadec commit 3f56f92

File tree

6 files changed

+104
-48
lines changed

6 files changed

+104
-48
lines changed

clang/lib/CodeGen/CodeGenFunction.cpp

Lines changed: 29 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -619,21 +619,17 @@ CodeGenFunction::getUBSanFunctionTypeHash(QualType Ty) const {
619619
CGM.Int32Ty, static_cast<uint32_t>(llvm::xxh3_64bits(Mangled)));
620620
}
621621

622-
void CodeGenFunction::EmitKernelMetadata(const FunctionDecl *FD,
623-
llvm::Function *Fn) {
624-
if (!FD->hasAttr<OpenCLKernelAttr>() && !FD->hasAttr<CUDAGlobalAttr>())
625-
return;
626-
622+
void CodeGenFunction::EmitKernelMetadata(const Decl *D, llvm::Function *Fn,
623+
const OutlinedFunctionDecl *OFD) {
627624
llvm::LLVMContext &Context = getLLVMContext();
628-
629-
CGM.GenKernelArgMetadata(Fn, FD, this);
625+
CGM.GenKernelArgMetadata(Fn, D, this, OFD);
630626

631627
if (!(getLangOpts().OpenCL ||
632628
(getLangOpts().CUDA &&
633629
getContext().getTargetInfo().getTriple().isSPIRV())))
634630
return;
635631

636-
if (const VecTypeHintAttr *A = FD->getAttr<VecTypeHintAttr>()) {
632+
if (const VecTypeHintAttr *A = D->getAttr<VecTypeHintAttr>()) {
637633
QualType HintQTy = A->getTypeHint();
638634
const ExtVectorType *HintEltQTy = HintQTy->getAs<ExtVectorType>();
639635
bool IsSignedInteger =
@@ -648,9 +644,9 @@ void CodeGenFunction::EmitKernelMetadata(const FunctionDecl *FD,
648644
Fn->setMetadata("vec_type_hint", llvm::MDNode::get(Context, AttrMDArgs));
649645
}
650646

651-
if (const WorkGroupSizeHintAttr *A = FD->getAttr<WorkGroupSizeHintAttr>()) {
647+
if (const WorkGroupSizeHintAttr *A = D->getAttr<WorkGroupSizeHintAttr>()) {
652648
auto Eval = [&](Expr *E) {
653-
return E->EvaluateKnownConstInt(FD->getASTContext()).getExtValue();
649+
return E->EvaluateKnownConstInt(D->getASTContext()).getExtValue();
654650
};
655651
llvm::Metadata *AttrMDArgs[] = {
656652
llvm::ConstantAsMetadata::get(Builder.getInt32(Eval(A->getXDim()))),
@@ -659,9 +655,9 @@ void CodeGenFunction::EmitKernelMetadata(const FunctionDecl *FD,
659655
Fn->setMetadata("work_group_size_hint", llvm::MDNode::get(Context, AttrMDArgs));
660656
}
661657

662-
if (const ReqdWorkGroupSizeAttr *A = FD->getAttr<ReqdWorkGroupSizeAttr>()) {
658+
if (const ReqdWorkGroupSizeAttr *A = D->getAttr<ReqdWorkGroupSizeAttr>()) {
663659
auto Eval = [&](Expr *E) {
664-
return E->EvaluateKnownConstInt(FD->getASTContext()).getExtValue();
660+
return E->EvaluateKnownConstInt(D->getASTContext()).getExtValue();
665661
};
666662
llvm::Metadata *AttrMDArgs[] = {
667663
llvm::ConstantAsMetadata::get(Builder.getInt32(Eval(A->getXDim()))),
@@ -671,7 +667,7 @@ void CodeGenFunction::EmitKernelMetadata(const FunctionDecl *FD,
671667
}
672668

673669
if (const OpenCLIntelReqdSubGroupSizeAttr *A =
674-
FD->getAttr<OpenCLIntelReqdSubGroupSizeAttr>()) {
670+
D->getAttr<OpenCLIntelReqdSubGroupSizeAttr>()) {
675671
llvm::Metadata *AttrMDArgs[] = {
676672
llvm::ConstantAsMetadata::get(Builder.getInt32(A->getSubGroupSize()))};
677673
Fn->setMetadata("intel_reqd_sub_group_size",
@@ -751,17 +747,24 @@ static llvm::Constant *getPrologueSignature(CodeGenModule &CGM,
751747
return CGM.getTargetCodeGenInfo().getUBSanFunctionSignature(CGM);
752748
}
753749

754-
void CodeGenFunction::StartFunction(GlobalDecl GD, QualType RetTy,
755-
llvm::Function *Fn,
756-
const CGFunctionInfo &FnInfo,
757-
const FunctionArgList &Args,
758-
SourceLocation Loc,
759-
SourceLocation StartLoc) {
750+
void CodeGenFunction::StartFunction(
751+
GlobalDecl GD, QualType RetTy, llvm::Function *Fn,
752+
const CGFunctionInfo &FnInfo, const FunctionArgList &Args,
753+
SourceLocation Loc, SourceLocation StartLoc,
754+
const OutlinedFunctionDecl *OutlinedFnDecl) {
760755
assert(!CurFn &&
761756
"Do not use a CodeGenFunction object for more than one function");
762757

763758
const Decl *D = GD.getDecl();
764759

760+
bool GeneratingSYCLOffloadKernel = false;
761+
// The presence of OutlinedFnDecl indicates that we are currently
762+
// generating the SYCL offload kernel.
763+
if (getLangOpts().SYCLIsDevice && OutlinedFnDecl) {
764+
D = OutlinedFnDecl;
765+
GeneratingSYCLOffloadKernel = true;
766+
}
767+
765768
DidCallStackSave = false;
766769
CurCodeDecl = D;
767770
const FunctionDecl *FD = dyn_cast_or_null<FunctionDecl>(D);
@@ -1026,13 +1029,14 @@ void CodeGenFunction::StartFunction(GlobalDecl GD, QualType RetTy,
10261029
Fn->addFnAttr(llvm::Attribute::FnRetThunkExtern);
10271030
}
10281031

1029-
if (FD && (getLangOpts().OpenCL ||
1030-
(getLangOpts().CUDA &&
1031-
getContext().getTargetInfo().getTriple().isSPIRV()) ||
1032-
((getLangOpts().HIP || getLangOpts().OffloadViaLLVM) &&
1033-
getLangOpts().CUDAIsDevice))) {
1032+
if (GeneratingSYCLOffloadKernel ||
1033+
(FD && ((getLangOpts().OpenCL && D->hasAttr<OpenCLKernelAttr>()) ||
1034+
(getLangOpts().CUDA &&
1035+
getContext().getTargetInfo().getTriple().isSPIRV()) ||
1036+
((getLangOpts().HIP || getLangOpts().OffloadViaLLVM) &&
1037+
getLangOpts().CUDAIsDevice)))) {
10341038
// Add metadata for a kernel function.
1035-
EmitKernelMetadata(FD, Fn);
1039+
EmitKernelMetadata(D, Fn, OutlinedFnDecl);
10361040
}
10371041

10381042
if (FD && FD->hasAttr<ClspvLibclcBuiltinAttr>()) {

clang/lib/CodeGen/CodeGenFunction.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2184,9 +2184,10 @@ class CodeGenFunction : public CodeGenTypeCache {
21842184
/// the constructor, but could be overwritten to true if this is a coroutine.
21852185
bool ShouldEmitLifetimeMarkers;
21862186

2187-
/// Add OpenCL kernel arg metadata and the kernel attribute metadata to
2187+
/// Add kernel arg metadata and the kernel attribute metadata to
21882188
/// the function metadata.
2189-
void EmitKernelMetadata(const FunctionDecl *FD, llvm::Function *Fn);
2189+
void EmitKernelMetadata(const Decl *D, llvm::Function *Fn,
2190+
const OutlinedFunctionDecl *OFD);
21902191

21912192
public:
21922193
CodeGenFunction(CodeGenModule &cgm, bool suppressNewContext = false);
@@ -2422,7 +2423,8 @@ class CodeGenFunction : public CodeGenTypeCache {
24222423
void StartFunction(GlobalDecl GD, QualType RetTy, llvm::Function *Fn,
24232424
const CGFunctionInfo &FnInfo, const FunctionArgList &Args,
24242425
SourceLocation Loc = SourceLocation(),
2425-
SourceLocation StartLoc = SourceLocation());
2426+
SourceLocation StartLoc = SourceLocation(),
2427+
const OutlinedFunctionDecl *OutlinedFnDecl = nullptr);
24262428

24272429
static bool IsConstructorDelegationValid(const CXXConstructorDecl *Ctor);
24282430

clang/lib/CodeGen/CodeGenModule.cpp

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2291,15 +2291,17 @@ static unsigned ArgInfoAddressSpace(LangAS AS) {
22912291
}
22922292
}
22932293

2294-
void CodeGenModule::GenKernelArgMetadata(llvm::Function *Fn,
2295-
const FunctionDecl *FD,
2296-
CodeGenFunction *CGF) {
2297-
assert(((FD && CGF) || (!FD && !CGF)) &&
2298-
"Incorrect use - FD and CGF should either be both null or not!");
2294+
void CodeGenModule::GenKernelArgMetadata(llvm::Function *Fn, const Decl *D,
2295+
CodeGenFunction *CGF,
2296+
const OutlinedFunctionDecl *OFD) {
2297+
assert(((D && CGF) || (!D && !CGF)) &&
2298+
"Incorrect use - D and CGF should either be both null or not!");
22992299
// Create MDNodes that represent the kernel arg metadata.
23002300
// Each MDNode is a list in the form of "key", N number of values which is
23012301
// the same number of values as their are kernel arguments.
23022302

2303+
const FunctionDecl *FD = dyn_cast_or_null<FunctionDecl>(D);
2304+
23032305
const PrintingPolicy &Policy = Context.getPrintingPolicy();
23042306

23052307
// MDNode for the kernel argument address space qualifiers.
@@ -2320,14 +2322,17 @@ void CodeGenModule::GenKernelArgMetadata(llvm::Function *Fn,
23202322
// MDNode for the kernel argument names.
23212323
SmallVector<llvm::Metadata *, 8> argNames;
23222324

2323-
if (FD && CGF)
2324-
for (unsigned i = 0, e = FD->getNumParams(); i != e; ++i) {
2325-
const ParmVarDecl *parm = FD->getParamDecl(i);
2325+
if (D && CGF) {
2326+
unsigned NumParam = OFD ? OFD->getNumParams() : FD->getNumParams();
2327+
for (unsigned i = 0, e = NumParam; i != e; ++i) {
2328+
const VarDecl *parm = OFD ? cast<VarDecl>(OFD->getParam(i))
2329+
: cast<VarDecl>(FD->getParamDecl(i));
23262330
// Get argument name.
23272331
argNames.push_back(llvm::MDString::get(VMContext, parm->getName()));
23282332

2329-
if (!getLangOpts().OpenCL)
2333+
if (!getLangOpts().OpenCL && !getLangOpts().SYCLIsDevice)
23302334
continue;
2335+
23312336
QualType ty = parm->getType();
23322337
std::string typeQuals;
23332338

@@ -2417,8 +2422,9 @@ void CodeGenModule::GenKernelArgMetadata(llvm::Function *Fn,
24172422
}
24182423
argTypeQuals.push_back(llvm::MDString::get(VMContext, typeQuals));
24192424
}
2425+
}
24202426

2421-
if (getLangOpts().OpenCL) {
2427+
if (getLangOpts().OpenCL || getLangOpts().SYCLIsDevice) {
24222428
Fn->setMetadata("kernel_arg_addr_space",
24232429
llvm::MDNode::get(VMContext, addressQuals));
24242430
Fn->setMetadata("kernel_arg_access_qual",

clang/lib/CodeGen/CodeGenModule.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1682,9 +1682,11 @@ class CodeGenModule : public CodeGenTypeCache {
16821682
/// \param FN is a pointer to IR function being generated.
16831683
/// \param FD is a pointer to function declaration if any.
16841684
/// \param CGF is a pointer to CodeGenFunction that generates this function.
1685-
void GenKernelArgMetadata(llvm::Function *FN,
1686-
const FunctionDecl *FD = nullptr,
1687-
CodeGenFunction *CGF = nullptr);
1685+
/// \param OFD is a pointer to the outlined function if we are generating a
1686+
/// SYCL offload kernel.
1687+
void GenKernelArgMetadata(llvm::Function *FN, const Decl *D = nullptr,
1688+
CodeGenFunction *CGF = nullptr,
1689+
const OutlinedFunctionDecl *OFD = nullptr);
16881690

16891691
/// Get target specific null pointer.
16901692
/// \param T is the LLVM type of the null pointer.

clang/lib/CodeGen/CodeGenSYCL.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ void CodeGenModule::EmitSYCLKernelCaller(const FunctionDecl *KernelEntryPointFn,
6565
SetLLVMFunctionAttributes(GlobalDecl(), FnInfo, Fn, false);
6666
SetSYCLKernelAttributes(Fn, CGF);
6767
CGF.StartFunction(GlobalDecl(), Ctx.VoidTy, Fn, FnInfo, Args,
68-
SourceLocation(), SourceLocation());
68+
SourceLocation(), SourceLocation(), OutlinedFnDecl);
6969
CGF.EmitFunctionBody(OutlinedFnDecl->getBody());
7070
setDSOLocal(Fn);
7171
SetLLVMFunctionAttributesForDefinition(cast<Decl>(OutlinedFnDecl), Fn);

clang/test/CodeGenSYCL/kernel-caller-entry-point.cpp

Lines changed: 48 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,13 @@ int main() {
106106
//
107107
// CHECK-AMDGCN: Function Attrs: convergent mustprogress noinline norecurse nounwind optnone
108108
// CHECK-AMDGCN-NEXT: define dso_local amdgpu_kernel void @_ZTS26single_purpose_kernel_name
109-
// CHECK-AMDGCN-SAME: (ptr addrspace(4) noundef byref(%struct.single_purpose_kernel) align 1 %0) #[[AMDGCN_ATTR0:[0-9]+]] {
109+
// CHECK-AMDGCN-SAME: (ptr addrspace(4) noundef byref(%struct.single_purpose_kernel) align 1 %0) #[[AMDGCN_ATTR0:[0-9]+]]
110+
// CHECK-AMDGCN-SAME: !kernel_arg_addr_space ![[KERNEL_ARG_ADDRSP:[0-9]+]]
111+
// CHECK-AMDGCN-SAME: !kernel_arg_access_qual ![[KERNEL_ARG_ACCQUAL:[0-9]+]]
112+
// CHECK-AMDGCN-SAME: !kernel_arg_type ![[KERNEL_ARG_TYPE1:[0-9]+]]
113+
// CHECK-AMDGCN-SAME: !kernel_arg_base_type ![[KERNEL_ARG_TYPE1]]
114+
// CHECK-AMDGCN-SAME: !kernel_arg_type_qual ![[KERNEL_ARG_TYPEQ:[0-9]+]]
115+
// CHECK-AMDGCN-SAME: {
110116
// CHECK-AMDGCN-NEXT: entry:
111117
// CHECK-AMDGCN-NEXT: %coerce = alloca %struct.single_purpose_kernel, align 1, addrspace(5)
112118
// CHECK-AMDGCN-NEXT: %kernelFunc = addrspacecast ptr addrspace(5) %coerce to ptr
@@ -119,7 +125,13 @@ int main() {
119125
//
120126
// CHECK-NVPTX: Function Attrs: convergent mustprogress noinline norecurse nounwind optnone
121127
// CHECK-NVPTX-NEXT: define dso_local ptx_kernel void @_ZTS26single_purpose_kernel_name
122-
// CHECK-NVPTX-SAME: (ptr noundef byval(%struct.single_purpose_kernel) align 1 %kernelFunc) #[[NVPTX_ATTR0:[0-9]+]] {
128+
// CHECK-NVPTX-SAME: (ptr noundef byval(%struct.single_purpose_kernel) align 1 %kernelFunc) #[[NVPTX_ATTR0:[0-9]+]]
129+
// CHECK-NVPTX-SAME: !kernel_arg_addr_space ![[KERNEL_ARG_ADDRSP:[0-9]+]]
130+
// CHECK-NVPTX-SAME: !kernel_arg_access_qual ![[KERNEL_ARG_ACCQUAL:[0-9]+]]
131+
// CHECK-NVPTX-SAME: !kernel_arg_type ![[KERNEL_ARG_TYPE1:[0-9]+]]
132+
// CHECK-NVPTX-SAME: !kernel_arg_base_type ![[KERNEL_ARG_TYPE1]]
133+
// CHECK-NVPTX-SAME: !kernel_arg_type_qual ![[KERNEL_ARG_TYPEQ:[0-9]+]]
134+
// CHECK-NVPTX-SAME: {
123135
// CHECK-NVPTX-NEXT: entry:
124136
// CHECK-NVPTX-NEXT: call void @_ZNK21single_purpose_kernelclEv
125137
// CHECK-NVPTX-SAME: (ptr noundef nonnull align 1 dereferenceable(1) %kernelFunc) #[[NVPTX_ATTR1:[0-9]+]]
@@ -129,7 +141,13 @@ int main() {
129141
//
130142
// CHECK-SPIR: Function Attrs: convergent mustprogress noinline norecurse nounwind optnone
131143
// CHECK-SPIR-NEXT: define {{[a-z_ ]*}}spir_kernel void @_ZTS26single_purpose_kernel_name
132-
// CHECK-SPIR-SAME: (ptr noundef byval(%struct.single_purpose_kernel) align 1 %kernelFunc) #[[SPIR_ATTR0:[0-9]+]] {
144+
// CHECK-SPIR-SAME: (ptr noundef byval(%struct.single_purpose_kernel) align 1 %kernelFunc) #[[SPIR_ATTR0:[0-9]+]]
145+
// CHECK-SPIR-SAME: !kernel_arg_addr_space ![[KERNEL_ARG_ADDRSP:[0-9]+]]
146+
// CHECK-SPIR-SAME: !kernel_arg_access_qual ![[KERNEL_ARG_ACCQUAL:[0-9]+]]
147+
// CHECK-SPIR-SAME: !kernel_arg_type ![[KERNEL_ARG_TYPE1:[0-9]+]]
148+
// CHECK-SPIR-SAME: !kernel_arg_base_type ![[KERNEL_ARG_TYPE1]]
149+
// CHECK-SPIR-SAME: !kernel_arg_type_qual ![[KERNEL_ARG_TYPEQ:[0-9]+]]
150+
// CHECK-SPIR-SAME: {
133151
// CHECK-SPIR-NEXT: entry:
134152
// CHECK-SPIR-NEXT: %kernelFunc.ascast = addrspacecast ptr %kernelFunc to ptr addrspace(4)
135153
// CHECK-SPIR-NEXT: call spir_func void @_ZNK21single_purpose_kernelclEv
@@ -143,7 +161,13 @@ int main() {
143161
//
144162
// CHECK-AMDGCN: Function Attrs: convergent mustprogress noinline norecurse nounwind optnone
145163
// CHECK-AMDGCN-NEXT: define dso_local amdgpu_kernel void @_ZTSZ4mainE18lambda_kernel_name
146-
// CHECK-AMDGCN-SAME: (i32 %kernelFunc.coerce) #[[AMDGCN_ATTR0]] {
164+
// CHECK-AMDGCN-SAME: (i32 %kernelFunc.coerce) #[[AMDGCN_ATTR0]]
165+
// CHECK-AMDGCN-SAME: !kernel_arg_addr_space ![[KERNEL_ARG_ADDRSP]]
166+
// CHECK-AMDGCN-SAME: !kernel_arg_access_qual ![[KERNEL_ARG_ACCQUAL]]
167+
// CHECK-AMDGCN-SAME: !kernel_arg_type ![[KERNEL_ARG_TYPE2:[0-9]+]]
168+
// CHECK-AMDGCN-SAME: !kernel_arg_base_type ![[KERNEL_ARG_TYPE2]]
169+
// CHECK-AMDGCN-SAME: !kernel_arg_type_qual ![[KERNEL_ARG_TYPEQ]]
170+
// CHECK-AMDGCN-SAME: {
147171
// CHECK-AMDGCN-NEXT: entry:
148172
// CHECK-AMDGCN-NEXT: %kernelFunc = alloca %class.anon, align 4, addrspace(5)
149173
// CHECK-AMDGCN-NEXT: %kernelFunc1 = addrspacecast ptr addrspace(5) %kernelFunc to ptr
@@ -157,7 +181,13 @@ int main() {
157181
//
158182
// CHECK-NVPTX: Function Attrs: convergent mustprogress noinline norecurse nounwind optnone
159183
// CHECK-NVPTX-NEXT: define dso_local ptx_kernel void @_ZTSZ4mainE18lambda_kernel_name
160-
// CHECK-NVPTX-SAME: (ptr noundef byval(%class.anon) align 4 %kernelFunc) #[[NVPTX_ATTR0]] {
184+
// CHECK-NVPTX-SAME: (ptr noundef byval(%class.anon) align 4 %kernelFunc) #[[NVPTX_ATTR0]]
185+
// CHECK-NVPTX-SAME: !kernel_arg_addr_space ![[KERNEL_ARG_ADDRSP]]
186+
// CHECK-NVPTX-SAME: !kernel_arg_access_qual ![[KERNEL_ARG_ACCQUAL]]
187+
// CHECK-NVPTX-SAME: !kernel_arg_type ![[KERNEL_ARG_TYPE2:[0-9]+]]
188+
// CHECK-NVPTX-SAME: !kernel_arg_base_type ![[KERNEL_ARG_TYPE2]]
189+
// CHECK-NVPTX-SAME: !kernel_arg_type_qual ![[KERNEL_ARG_TYPEQ]]
190+
// CHECK-NVPTX-SAME: {
161191
// CHECK-NVPTX-NEXT: entry:
162192
// CHECK-NVPTX-NEXT: call void @_ZZ4mainENKUlvE_clEv
163193
// CHECK-NVPTX-SAME: (ptr noundef nonnull align 4 dereferenceable(4) %kernelFunc) #[[NVPTX_ATTR1]]
@@ -167,7 +197,13 @@ int main() {
167197
//
168198
// CHECK-SPIR: Function Attrs: convergent mustprogress noinline norecurse nounwind optnone
169199
// CHECK-SPIR-NEXT: define {{[a-z_ ]*}}spir_kernel void @_ZTSZ4mainE18lambda_kernel_name
170-
// CHECK-SPIR-SAME: (ptr noundef byval(%class.anon) align 4 %kernelFunc) #[[SPIR_ATTR0]] {
200+
// CHECK-SPIR-SAME: (ptr noundef byval(%class.anon) align 4 %kernelFunc) #[[SPIR_ATTR0]]
201+
// CHECK-SPIR-SAME: !kernel_arg_addr_space ![[KERNEL_ARG_ADDRSP]]
202+
// CHECK-SPIR-SAME: !kernel_arg_access_qual ![[KERNEL_ARG_ACCQUAL]]
203+
// CHECK-SPIR-SAME: !kernel_arg_type ![[KERNEL_ARG_TYPE2:[0-9]+]]
204+
// CHECK-SPIR-SAME: !kernel_arg_base_type ![[KERNEL_ARG_TYPE2]]
205+
// CHECK-SPIR-SAME: !kernel_arg_type_qual ![[KERNEL_ARG_TYPEQ]]
206+
// CHECK-SPIR-SAME: {
171207
// CHECK-SPIR-NEXT: entry:
172208
// CHECK-SPIR-NEXT: %kernelFunc.ascast = addrspacecast ptr %kernelFunc to ptr addrspace(4)
173209
// CHECK-SPIR-NEXT: call spir_func void @_ZZ4mainENKUlvE_clEv
@@ -184,3 +220,9 @@ int main() {
184220
//
185221
// CHECK-SPIR: #[[SPIR_ATTR0]] = { convergent mustprogress noinline norecurse nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" }
186222
// CHECK-SPIR: #[[SPIR_ATTR1]] = { convergent nounwind }
223+
224+
// CHECK-DEVICE: ![[KERNEL_ARG_ADDRSP]] = !{i32 0}
225+
// CHECK-DEVICE: ![[KERNEL_ARG_ACCQUAL]] = !{!"none"}
226+
// CHECK-DEVICE: ![[KERNEL_ARG_TYPE1]] = !{!"single_purpose_kernel"}
227+
// CHECK-DEVICE: ![[KERNEL_ARG_TYPEQ]] = !{!""}
228+
// CHECK-DEVICE: ![[KERNEL_ARG_TYPE2]] = !{!"(lambda

0 commit comments

Comments
 (0)