The restriction on pointer-to-pointer kernel arguments has been
relaxed in OpenCL 2.0. Apply the same address space restrictions for
pointer argument types to the inner pointer types.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
clang/lib/Sema/SemaDecl.cpp | ||
---|---|---|
8638 | 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?
Also I can't find anything specific to the arrays... Do you think we need to chase this with the spec? | |
8669 | 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. |
clang/lib/Sema/SemaDecl.cpp | ||
---|---|---|
8638 | I have raised https://github.com/KhronosGroup/OpenCL-Docs/issues/504 | |
8669 | Agreed. I have simplified the patch a bit, by not distinguishing between the outer pointer-to-pointer type and any inner pointer-to-pointer types for the diagnostic. |
LGTM! Thanks!
The testing can be improved before committing!
clang/lib/Sema/SemaDecl.cpp | ||
---|---|---|
8638 | Great! Thanks! | |
clang/test/SemaOpenCL/invalid-kernel-parameters.cl | ||
13 | Btw this was missing in the original testing, could we add a line with __constant and __local? Or perhaps just replace the first two global in this line. |
clang/test/SemaOpenCL/invalid-kernel-parameters.cl | ||
---|---|---|
13 | Sure, will do! |
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?
Also I can't find anything specific to the arrays...
Do you think we need to chase this with the spec?