Skip to content

Commit 3fb5c39

Browse files
shiltianarsenm
andcommitted
[Clang][OpenCL][AMDGPU] Use byref for OpenCL kernel arguments
Due to a previous workaround allowing kernels to be called from other functions, Clang currently doesn't use the `byref` attribute for aggregate kernel arguments. The issue was recently resolved in #115821. With that fix, we can now enable the use of `byref` consistently across all languages. Co-authored-by: Matt Arsenault <[email protected]>
1 parent edcbd4a commit 3fb5c39

File tree

5 files changed

+116
-196
lines changed

5 files changed

+116
-196
lines changed

clang/lib/CodeGen/Targets/AMDGPU.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -198,14 +198,10 @@ ABIArgInfo AMDGPUABIInfo::classifyKernelArgumentType(QualType Ty) const {
198198
/*ToAS=*/getContext().getTargetAddressSpace(LangAS::cuda_device));
199199
}
200200

201-
// FIXME: Should also use this for OpenCL, but it requires addressing the
202-
// problem of kernels being called.
203-
//
204201
// FIXME: This doesn't apply the optimization of coercing pointers in structs
205202
// to global address space when using byref. This would require implementing a
206203
// new kind of coercion of the in-memory type when for indirect arguments.
207-
if (!getContext().getLangOpts().OpenCL && LTy == OrigLTy &&
208-
isAggregateTypeForABI(Ty)) {
204+
if (LTy == OrigLTy && isAggregateTypeForABI(Ty)) {
209205
return ABIArgInfo::getIndirectAliased(
210206
getContext().getTypeAlignInChars(Ty),
211207
getContext().getTargetAddressSpace(LangAS::opencl_constant),

0 commit comments

Comments
 (0)