Skip to content

[SYCL] reapproaching guard duty#22655

Open
cperkinsintel wants to merge 2 commits into
intel:syclfrom
cperkinsintel:revisit-vs2026-guard
Open

[SYCL] reapproaching guard duty#22655
cperkinsintel wants to merge 2 commits into
intel:syclfrom
cperkinsintel:revisit-vs2026-guard

Conversation

@cperkinsintel

Copy link
Copy Markdown
Contributor

Our fix for VS2026 was being guarded by sycl_global_var so as to not trigger "non const global in device code" warnings. But that doesn't work when preprocessing ( -E flag), so now we are adjusting the guard to be closer to where the diagnostic is actually generated. This is is more straightforward, less magical, and exactly the same mechanism that is already used (isMsvcMathFn).

@cperkinsintel
cperkinsintel requested review from a team as code owners July 16, 2026 20:38
@cperkinsintel
cperkinsintel requested review from KseniyaTikhomirova and Copilot and removed request for KseniyaTikhomirova July 16, 2026 20:38

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.

Pull request overview

Note

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-setup-steps.yml file specifying one with the runs-on attribute. See the docs for more details.

Adjusts the MSVC STL global-variable handling for SYCL device code so diagnostics are suppressed at the point they’re emitted (Sema use-sites), and removes the fragile system_header/sycl_global_var workaround that breaks under -E preprocess round-trips.

Changes:

  • Removes #pragma clang system_header and sycl_global_var usage from the MSVC bit utils wrapper.
  • Adds a Sema allowlist to permit reads of specific MSVC STL runtime globals (e.g. std::__isa_available) from device code.
  • Adds a regression test covering -E preprocess → .ii → recompile round-trip.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
sycl/test/regression/msvc_bit_utils_wrapper_preprocess_roundtrip.cpp Adds a preprocess round-trip regression test for the wrapper/header scenario.
sycl/include/sycl/stl_wrappers/__msvc_bit_utils.hpp Removes the system-header + attribute workaround and relies on Sema allowlisting.
clang/lib/Sema/SemaExpr.cpp Introduces std::__isa_available read allowlisting for Windows MSVC environments.

Comment thread clang/lib/Sema/SemaExpr.cpp
Comment thread sycl/include/sycl/stl_wrappers/__msvc_bit_utils.hpp
Comment thread clang/lib/Sema/SemaExpr.cpp
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.

2 participants