[SYCL] Add macro to disable SYCL's device copyability checks - #23102
Open
uditagarwal97 wants to merge 3 commits into
Open
[SYCL] Add macro to disable SYCL's device copyability checks#23102uditagarwal97 wants to merge 3 commits into
uditagarwal97 wants to merge 3 commits into
Conversation
Large CUDA code bases being ported to SYCL hit the device-copyability requirements on types that are already known to be safe to copy to a device but that cannot practically be declared device copyable (no default constructors, too many classes to enumerate). The blanket opt-out requested in CMPLRLLVM-77388 gives those users a migration path and puts the responsibility for the copyability of their types on them. When SYCL_DISABLE_DEVICE_COPYABLE_CHECKS is defined, the primary is_device_copyable template derives from std::true_type, so the trait reports true for every type. Every device-copyability diagnostic in the headers already goes through that trait, which covers the checks on the captures and base classes of a kernel functor, on the element type of a buffer, and on the pattern type of handler::fill and handler::ext_oneapi_fill2d. No command line option is added: the CFE does not diagnose device-copyability today, so there is nothing there to turn off. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The public trait behavior needs direct coverage, and the undefined-behavior documentation overstates the macro’s scope.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Adds an opt-out macro for SYCL device-copyability validation.
Changes:
- Makes
is_device_copyableuniversally true when enabled. - Documents the macro and associated risks.
- Tests compilation with checks enabled and disabled.
File summaries
| File | Description |
|---|---|
sycl/include/sycl/detail/is_device_copyable.hpp |
Implements the opt-out macro. |
sycl/doc/PreprocessorMacros.md |
Documents macro behavior. |
sycl/test/basic_tests/device_copyable_checks_disabled.cpp |
Tests diagnostic suppression. |
Review details
- Files reviewed: 3/3 changed files
- Comments generated: 2
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Contributor
|
Could you please add some info on the motivation for this change? Was this a feature request? Thanks. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds a new macro, SYCL_DISABLE_DEVICE_COPYABLE_CHECKS, that makes
sycl::is_device_copyable_v<T>reporttruefor every type, and disables all diagnostics that the SYCL headers issue when a type does not satisfy the device copyability requirements of the SYCL specification.