[PATCH] D92091: [OpenCL] Allow pointer-to-pointer kernel args beyond CL 1.2
Anastasia Stulova via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Nov 26 08:43:31 PST 2020
Anastasia added inline comments.
================
Comment at: clang/lib/Sema/SemaDecl.cpp:8638
// array, this recursive call only happens once.
return getOpenCLKernelParameterType(S, QualType(UnderlyingTy, 0));
}
----------------
Btw I am surprised that we recurse to check the underlying type of an array but not the pointer. I guess this spec wording implies that pointed types should be checked too?
> The size in bytes of these types areimplementation-defined and in addition can also be different for the OpenCL device and the host processor making it difficult to allocate buffer objects to be passed as arguments to a kernel declared as pointer to these types.
Also I can't find anything specific to the arrays...
Do you think we need to chase this with the spec?
================
Comment at: clang/lib/Sema/SemaDecl.cpp:8669
+ // Loop through inner pointer types to ensure address spaces are valid.
+ QualType NestedPT = PT->getPointeeType();
+ do {
----------------
I feel this breaks the original flow a little bit. It would have been nicer if this could be part of `getOpenCLKernelParameterType`, but it might become more complex then... We would probably need to introduce something like `ValidPtrPtrKernelParam` and `InvalidAddrSpacePtrPtrKernelParam`.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D92091/new/
https://reviews.llvm.org/D92091
More information about the cfe-commits
mailing list