[SYCL][NewOffloadModel] Enable -fno-sycl-rdc in Clang Driver for New Offload Model - #22832
Merged
Merged
Conversation
Fix --no-offload-old-driver typo to --no-offload-new-driver in the old offload model usage example. Add a note that compile-step support for -fno-sycl-rdc (matching the old model's -c usage pattern) will be implemented in a follow-up patch via clang-linker-wrapper --sycl-device-link --no-sycl-rdc per translation unit.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR enables -fno-sycl-rdc support for the new SYCL offload model by propagating the flag at link time to clang-linker-wrapper, updates the related design documentation, and adjusts/extends tests to validate the new behavior.
Changes:
- Propagate NoRDC to
clang-linker-wrapperfrom the Clang driver when linking SYCL with the new offload model. - Document NoRDC behavior and clarify old-vs-new offload model flag placement (compile step vs link step).
- Update/add tests to reflect the new model’s link-step
-fno-sycl-rdcusage and verify driver propagation.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| sycl/test-e2e/AOT/early_aot.cpp | Un-XFAIL for new offload model and adjust RUN lines to pass -fno-sycl-rdc at the correct step per model. |
| sycl/doc/design/OffloadDesign.md | Document NoRDC support and explicitly describe the old vs new model usage inversion. |
| sycl/doc/design/NonRelocatableDeviceCode.md | Clarify the document applies to the old offload model’s NoRDC design. |
| clang/test/Driver/sycl-no-rdc-new-driver.cpp | Add driver coverage ensuring --no-sycl-rdc is propagated to clang-linker-wrapper for --offload-new-driver. |
| clang/lib/Driver/ToolChains/Clang.cpp | Driver change to translate -fno-sycl-rdc into --no-sycl-rdc for clang-linker-wrapper in SYCL link jobs. |
srividya-sundaram
marked this pull request as draft
July 30, 2026 21:31
2 tasks
Contributor
Author
|
The |
srividya-sundaram
marked this pull request as ready for review
July 30, 2026 22:19
mdtoguchi
reviewed
Jul 31, 2026
mdtoguchi
reviewed
Jul 31, 2026
mdtoguchi
reviewed
Jul 31, 2026
mdtoguchi
approved these changes
Jul 31, 2026
sarnex
approved these changes
Jul 31, 2026
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Contributor
|
lgtm thx |
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.
Summary
This patch adds
-fno-sycl-rdcsupport to the new SYCL offload model in the Clang driver. It is based on the work by @maksimsab in #21973, with review fixes applied.What this patch does
By default (
-fsycl-rdc), all device code across translation units is linked together into one module at link time before post-link processing. With-fno-sycl-rdc, each object file's device code is processed independently — skipping thellvm-linkstep — which can significantly reduce peak memory and compile time.Changes:
clang/lib/Driver/ToolChains/Clang.cpp: InLinkerWrapper::ConstructJob, propagate--no-sycl-rdctoclang-linker-wrapperwhen-fno-sycl-rdcis passed at link time.sycl/doc/design/OffloadDesign.md: Document NoRDC mode for the new offload model.sycl/doc/design/NonRelocatableDeviceCode.md: Add a note clarifying that document covers the old offload model only.sycl/test-e2e/AOT/early_aot.cpp: Un-XFAIL the test for the new offload model; adjust RUN lines to pass-fno-sycl-rdcat the correct step per model.clang/test/Driver/sycl-no-rdc-new-driver.cpp: New driver test verifying--no-sycl-rdcis propagated toclang-linker-wrappercorrectly.Key behavioral difference from the old offload model
-fno-sycl-rdc--no-offload-new-driver)-c)--offload-new-driver)This inversion exists because in the new model all SYCL offload processing (post-link, AOT, wrapping) lives in
clang-linker-wrapperat link time.Follow-up work
Supporting
-fno-sycl-rdc -cin the new model (matching the old model's compile-step ergonomics) will be addressed in a follow-up patch. The plan is to invokeclang-linker-wrapper --sycl-device-link --no-sycl-rdcper translation unit at compile time, embedding the finalized device image directly into the host object.Supporting -fno-sycl-rdc -c in the new model (matching old model compile-step ergonomics) is addressed in #22833.
Fixes: CMPLRLLVM-51875
🤖 Generated with Claude Code