New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[C++4OpenCL] Cannot use struct as kernel parameter when accessing through templated struct #57881
Comments
@llvm/issue-subscribers-opencl |
That's right, I can't see anything in the documentation stating that your example should be disallowed. The only relevant restrictions I can see from here https://www.khronos.org/opencl/assets/CXX_for_OpenCL.html#kernel_function are:
None of which corresponds to your case. This seems like a clang bug indeed. |
This patch seems to be fixing the reported test case but unfortunately it doesn't unlock general use of templates in kernel argument yet: https://reviews.llvm.org/D134445. FYI as a workaround there is the following extension: https://clang.llvm.org/docs/LanguageExtensions.html#cl-clang-non-portable-kernel-param-types that can be used to enable/disable such diagnostics While I don't advertise using this extension widely it might be useful as s temporary solution while the proper fix of the diagnostics is in progress. This example compiles with clang-15:
|
I just tried this out in my more complicated example code and it works! I check manually that the struct is standard_layout, so I think this will be safe for me to use for now. Thanks for investigating this for me. |
Opened related issue to fix general problem: #58590 |
Hi,
I'm having some issues when using certain types as kernel parameters. Whenever I try to use a struct defined in template type I get compile errors:
Is this some sort of OpenCL C++ limitation? It feels like it should be ok.
--
cmd: clang -target spirv64 -emit-llvm -cl-std=clc++2021 -O0 -c -o output.bc input.clcpp
using llvm 15
The text was updated successfully, but these errors were encountered: