Skip to content

[SYCL] Add macro to disable SYCL's device copyability checks - #23102

Open
uditagarwal97 wants to merge 3 commits into
intel:syclfrom
uditagarwal97:udit/cmplr-77388
Open

[SYCL] Add macro to disable SYCL's device copyability checks#23102
uditagarwal97 wants to merge 3 commits into
intel:syclfrom
uditagarwal97:udit/cmplr-77388

Conversation

@uditagarwal97

@uditagarwal97 uditagarwal97 commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

This PR adds a new macro, SYCL_DISABLE_DEVICE_COPYABLE_CHECKS, that makes sycl::is_device_copyable_v<T> report true for 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.

uditagarwal97 and others added 2 commits September 4, 2026 17:13
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>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 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_copyable universally 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.

Comment thread sycl/test/basic_tests/device_copyable_checks_disabled.cpp
Comment thread sycl/doc/PreprocessorMacros.md Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@uditagarwal97
uditagarwal97 marked this pull request as ready for review September 4, 2026 15:29
@uditagarwal97
uditagarwal97 requested review from a team as code owners September 4, 2026 15:29
@slawekptak

Copy link
Copy Markdown
Contributor

Could you please add some info on the motivation for this change? Was this a feature request? Thanks.

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