-
Notifications
You must be signed in to change notification settings - Fork 794
[NFCI][SYCL] Assert KernelHasName in StoreLambda
#19990
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
Conversation
I don't understand what not having a name was supposed to mean and it doesn't make any sense to me. The only failures I've seen after implementing this change is when we compile SYCL code with non-SYCL compiler without any SYCL knowledge (as in `clang++ -fsycl -fsycl-host-compiler=<...>` does have SYCL knowledge provided via integration headers). If anyone knows why this change would be incorrect, please let me know.
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've been wondering the same thing, but may be someone else chimes in with a good explanation for why we still had that.
| @@ -1,4 +1,4 @@ | |||
| // RUN: %clangxx %fsycl-host-only -fsyntax-only -Xclang -verify -Xclang -verify-ignore-unexpected=note,warning %s | |||
| // RUN: %clangxx -D__SYCL_UNITTESTS %fsycl-host-only -fsyntax-only -Xclang -verify -Xclang -verify-ignore-unexpected=note,warning %s | |||
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.
It's unexpected to see __SYCL_UNITTESTS here. Might be worth a comment, if not renaming of the macro.
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 open to other name suggestions.
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.
What about moving -D__SYCL_UNITTESTS into %fsycl-host-only substitution? That way it would be automatically applied to all tests and the name wouldn't matter much. And if we don't need to type it for every test, then __SYCL_UNITTESTS_BYPASS_KERNEL_NAME_CHECK would be pretty self-explanatory.
Because regardless of the name, any new test which aims to check something on host-only is doomed to fail because the macro isn't defined and it won't be obvious to a test author what is wrong.
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.
That's brilliant, let me do that.
|
@intel/llvm-gatekeepers please consider merging |
| @@ -1,4 +1,4 @@ | |||
| // RUN: %clangxx -%fsycl-host-only -c -ffp-accuracy=high -faltmathlib=SVMLAltMathLibrary -fno-math-errno %s | |||
| // RUN: %clangxx -fsycl -c -ffp-accuracy=high -faltmathlib=SVMLAltMathLibrary -fno-math-errno %s | |||
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.
This test is now slower, because it performs compilation twice, we should probably rewrite it to use SYCL_EXTERNAL functions to keep doing host-only compilation without the need for -D__SYCL_UNITTESTS.
Unrelated: not having -o %t.out is also an unsafe, because it could lead to race conditions with other tests written without -o %t.out as they could both attempt to write into a.o file at the same time
| @@ -1,4 +1,4 @@ | |||
| // RUN: %clangxx %fsycl-host-only -fsyntax-only -Xclang -verify -Xclang -verify-ignore-unexpected=note,warning %s | |||
| // RUN: %clangxx -D__SYCL_UNITTESTS %fsycl-host-only -fsyntax-only -Xclang -verify -Xclang -verify-ignore-unexpected=note,warning %s | |||
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.
What about moving -D__SYCL_UNITTESTS into %fsycl-host-only substitution? That way it would be automatically applied to all tests and the name wouldn't matter much. And if we don't need to type it for every test, then __SYCL_UNITTESTS_BYPASS_KERNEL_NAME_CHECK would be pretty self-explanatory.
Because regardless of the name, any new test which aims to check something on host-only is doomed to fail because the macro isn't defined and it won't be obvious to a test author what is wrong.
Downstream CI uncovered another scenario where `detail::CompileTimeKernelInfo<KernelName>.Name` might be empty (other than non-SYCL compilation in some of the [unit]tests). That happens when compiling the same TU using multiple offload models (e.g., both SYCL and OMP) and the device compilation for non-SYCL model doesn't use SYCL integration header to provide kernel information. Ideally, we should be just guarding `static_assert`s with some `#if __SYCL_WHATEVER` but we don't set any SYCL-related macro when using 3rd party host compilers. Deal with that by turning compile-time `static_assert` into a run-time `assert` unless we can guarantee that SYCL kernel information is available.
Downstream CI uncovered another scenario where `detail::CompileTimeKernelInfo<KernelName>.Name` might be empty (other than non-SYCL compilation in some of the [unit]tests). That happens when compiling the same TU using multiple offload models (e.g., both SYCL and OMP) and the device compilation for non-SYCL model doesn't use SYCL integration header to provide kernel information. Ideally, we should be just guarding `static_assert`s with some `#if __SYCL_WHATEVER` but we don't set any SYCL-related macro when using 3rd party host compilers. Deal with that by turning compile-time `static_assert` into a run-time `assert` unless we can guarantee that SYCL kernel information is available.
Downstream CI uncovered another scenario where `detail::CompileTimeKernelInfo<KernelName>.Name` might be empty (other than non-SYCL compilation in some of the [unit]tests). That happens when compiling the same TU using multiple offload models (e.g., both SYCL and OMP) and the device compilation for non-SYCL model doesn't use SYCL integration header to provide kernel information. Ideally, we should be just guarding `static_assert`s with some `#if __SYCL_WHATEVER` but we don't set any SYCL-related macro when using 3rd party host compilers. Deal with that by turning compile-time `static_assert` into a run-time `assert` unless we can guarantee that SYCL kernel information is available.
Downstream CI uncovered another scenario where `detail::CompileTimeKernelInfo<KernelName>.Name` might be empty (other than non-SYCL compilation in some of the [unit]tests). That happens when compiling the same TU using multiple offload models (e.g., both SYCL and OMP) and the device compilation for non-SYCL model doesn't use SYCL integration header to provide kernel information. Ideally, we should be just guarding `static_assert`s with some `#if __SYCL_WHATEVER` but we don't set any SYCL-related macro when using 3rd party host compilers. Deal with that by turning compile-time `static_assert` into a run-time `assert` unless we can guarantee that SYCL kernel information is available.
Downstream CI uncovered another scenario where `detail::CompileTimeKernelInfo<KernelName>.Name` might be empty (other than non-SYCL compilation in some of the [unit]tests). That happens when compiling the same TU using multiple offload models (e.g., both SYCL and OMP) and the device compilation for non-SYCL model doesn't use SYCL integration header to provide kernel information. Ideally, we should be just guarding `static_assert`s with some `#if __SYCL_WHATEVER` but we don't set any SYCL-related macro when using 3rd party host compilers. Deal with that by turning compile-time `static_assert` into a run-time `assert` unless we can guarantee that SYCL kernel information is available.
Downstream CI uncovered another scenario where `detail::CompileTimeKernelInfo<KernelName>.Name` might be empty (other than non-SYCL compilation in some of the [unit]tests). That happens when compiling the same TU using multiple offload models (e.g., both SYCL and OMP) and the device compilation for non-SYCL model doesn't use SYCL integration header to provide kernel information. Also, my previous comments about `__usmfill` turned out to be incorrect. We do NOT unconditionally instantiate any of those in the `sycl/handler.hpp`, it was individual unittests that did that.
…0060) Follow-up for #19990 Downstream CI uncovered another scenario where `detail::CompileTimeKernelInfo<KernelName>.Name` might be empty (other than non-SYCL compilation in some of the [unit]tests). That happens when compiling the same TU using multiple offload models (e.g., both SYCL and OMP) and the device compilation for non-SYCL model doesn't use SYCL integration header to provide kernel information. Ideally, we should be just guarding `static_assert`s with some `#if __SYCL_WHATEVER` but we don't set any SYCL-related macro when using 3rd party host compilers. Deal with that by turning compile-time `static_assert` into a run-time `assert` unless we can guarantee that SYCL kernel information is available. --------- Co-authored-by: Sergey Semenov <sergey.semenov@intel.com>
I don't understand what not having a name was supposed to mean and it doesn't make any sense to me. The only failures I've seen after implementing this change is when we compile SYCL code with non-SYCL compiler without any SYCL knowledge (as in
clang++ -fsycl -fsycl-host-compiler=<...>does have SYCL knowledge provided via integration headers).If anyone knows why this change would be incorrect, please let me know.