-
Notifications
You must be signed in to change notification settings - Fork 796
[SYCL][Clang] Add sentinel value to kernel_args_sizes #20540
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
base: sycl
Are you sure you want to change the base?
Conversation
Add sentinel value to compiler generated array kernel_args_sizes in integration header to avoid warnings about empty arrays. This array is used to hold the number of elements in each kernel. This PR changes the type to int to add a sentinel value of -1.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CI fails might be related.
| O << "};\n\n"; | ||
|
|
||
| O << "static constexpr unsigned kernel_args_sizes[] = {"; | ||
| O << "static constexpr int kernel_args_sizes[] = {"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is that array used at all? I can't grep it in sycl folder.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure actually. @aelovikov-intel would you know if this is just a relic of the past or whether we actually need this generated?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CI says
# | C:\Users\GH_RUN~1\AppData\Local\Temp\lit-tmp-qc0j5t24\L0_interop_test-header-a28efe.h:82:75: error: cannot initialize a parameter of type 'const unsigned int *' with an lvalue of type 'const int[2]'
# | 82 | sycl::detail::free_function_info_map::add(sycl::detail::kernel_names, sycl::detail::kernel_args_sizes, 1);
# | | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
so, this seems to be used within the integration header?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea it looks like this is used for the implementation of free functions/device globals.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@elizabethandrews @aelovikov-intel yes, it is used in free functions:
https://github.com/intel/llvm/blob/sycl/clang/lib/Sema/SemaSYCL.cpp#L7055
https://github.com/intel/llvm/blob/sycl/clang/lib/Sema/SemaSYCL.cpp#L7317
https://github.com/intel/llvm/blob/sycl/clang/lib/Sema/SemaSYCL.cpp#L7323
| namespace detail::free_function_info_map { |
If it is needed to change the type of kernel_args_sizes, then it is needed to change the whole chain..
Also, it is supposed that both arrays kernel arg sizes and kernel names have the same size. If -1 is added into kernel arg sizes, please, check which size is used during add and remove calls
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changing the type would be an ABI break. So I have change the PR to use a sentinel value of 0 so we can keep it unsigned. I don't see any harm with that but please let me know if you disagree.
Add sentinel value to compiler generated array kernel_args_sizes in integration header to avoid warnings about empty arrays. This array is used to hold the number of elements in each kernel. This PR changes the type to int to add a sentinel value of -1.