[SYCL] Add macro to disable SYCL's device copyability checks - #23102
[SYCL] Add macro to disable SYCL's device copyability checks#23102uditagarwal97 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>
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>
|
Could you please add some info on the motivation for this change? Was this a feature request? Thanks. |
@slawekptak Please refer to CMPLRLLVM-77388 for more context. In short, a customer requested this feature to aid code migration from CUDA. |
|
@intel/dpcpp-doc-reviewers ping. |
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.