Skip to content

Conversation

@aelovikov-intel
Copy link
Contributor

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.

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.
Copy link
Contributor

@sergey-semenov sergey-semenov left a 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
Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Contributor

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.

Copy link
Contributor Author

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.

@github-actions
Copy link
Contributor

github-actions bot commented Sep 8, 2025

@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
Copy link
Contributor

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
Copy link
Contributor

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.

@aelovikov-intel aelovikov-intel marked this pull request as draft September 8, 2025 16:38
@aelovikov-intel aelovikov-intel merged commit b6af1f5 into intel:sycl Sep 8, 2025
27 checks passed
@aelovikov-intel aelovikov-intel deleted the kernel-has-name branch September 8, 2025 17:38
aelovikov-intel added a commit to aelovikov-intel/llvm that referenced this pull request Sep 11, 2025
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.
aelovikov-intel added a commit to aelovikov-intel/llvm that referenced this pull request Sep 11, 2025
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.
aelovikov-intel added a commit to aelovikov-intel/llvm that referenced this pull request Sep 11, 2025
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.
aelovikov-intel added a commit to aelovikov-intel/llvm that referenced this pull request Sep 11, 2025
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.
aelovikov-intel added a commit to aelovikov-intel/llvm that referenced this pull request Sep 11, 2025
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.
aelovikov-intel added a commit to aelovikov-intel/llvm that referenced this pull request Sep 11, 2025
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.
aelovikov-intel added a commit that referenced this pull request Sep 12, 2025
…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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants