Skip to content

[SYCL][COMPAT] Add dummy template params to memory APIs to delay kernel instantiation #17743

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

Merged
merged 2 commits into from
Apr 2, 2025

Conversation

joeatodd
Copy link
Contributor

The functions syclcompat::detail::fill and syclcompat::detail::memcpy define SYCL kernels. Any translation unit including the memory.hpp or util.hpp headers will contain these kernels, as DPC++'s 2-pass compiler is not currently able to reason about which kernels are actually used.

Adding a dummy template parameter (typename T = void) ensures that these functions (and thus their kernels) are only instantiated if used.

`syclcompat::detail::fill` and `syclcompat::detail::memcpy` define SYCL
kernels. Any translation unit including the syclcompat/memory.hpp or
util.hpp will contain these kernels, as DPC++'s 2-pass compiler is not
currently able to reason about which kernels are actually used.

Adding a dummy template parameter (typename T = void) ensures that
these functions (and thus their kernels) are only instantiated if used.
@joeatodd joeatodd requested a review from a team as a code owner March 31, 2025 14:27
Copy link
Contributor

@GeorgeWeb GeorgeWeb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

As discussed internally, this is the chosen mean of mitigating the issue for now that should guarantee the API stays backwards-compatible in its standard use (excluding cases where, for example, the user may have taken the address of these functions).

@joeatodd
Copy link
Contributor Author

joeatodd commented Apr 2, 2025

@intel/llvm-gatekeepers I believe this is ready to merge 🙏

@kbenzie kbenzie merged commit 180f73e into intel:sycl Apr 2, 2025
44 of 47 checks passed
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