Skip to content

[Driver][SYCL] Use getUseNewOffloadingDriver() for --offload-arch check - #23167

Open
wenju-he wants to merge 1 commit into
intel:syclfrom
wenju-he:inferOffloadToolchains-SYCL-getuseNewOffloadingDriver
Open

wenju-he wants to merge 1 commit into
intel:syclfrom
wenju-he:inferOffloadToolchains-SYCL-getuseNewOffloadingDriver

Conversation

@wenju-he

@wenju-he wenju-he commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

inferOffloadToolchains re-derived whether the new offloading driver was enabled by re-checking '--offload-new-driver' directly, instead of using getUseNewOffloadingDriver(), which is already the single source of truth (see BuildCompilation). This meant the diagnostic could incorrectly fire for '-fsycl --offload-arch=...' combined with another offload kind (e.g. OpenMP) that implicitly enables the new driver in the same invocation.

Move the OpenMP/explicit-flag default ahead of inferOffloadToolchains(),
since it also consults getUseNewOffloadingDriver(). Leave the CUDA/HIP
default gated on C.isOffloadingHostKind() after toolchains are built -
that flag only goes true once a valid device toolchain exists, unlike an
earlier input-kind check, which would stay true even with an invalid
--offload-arch/--cuda-gpu-arch and cause a later crash in
BuildOffloadingActions (see Driver/cuda-options.cu).

inferOffloadToolchains re-derived whether the new offloading driver
was enabled by re-checking '--offload-new-driver' directly, instead
of using getUseNewOffloadingDriver(), which is already the single
source of truth (see BuildCompilation). This meant the diagnostic
could incorrectly fire for '-fsycl --offload-arch=...' combined with
another offload kind (e.g. OpenMP) that implicitly enables the new
driver in the same invocation.

Move the OpenMP/explicit-flag part of the default before
inferOffloadToolchains(), which also consults
getUseNewOffloadingDriver(). Keep the CUDA/HIP part of the default
gated on C.isOffloadingHostKind() after toolchains are actually
built, so an invalid --offload-arch/--cuda-gpu-arch (which leaves no
device toolchain) doesn't spuriously enable the new driver and crash
later in BuildOffloadingActions (in test Driver/cuda-options.cu).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@wenju-he
wenju-he requested a review from a team as a code owner September 15, 2026 00:25

@mdtoguchi mdtoguchi 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 look OK - but curious about this comment in the description:

so an invalid --offload-arch/--cuda-gpu-arch (which leaves no device toolchain) doesn't spuriously enable the new driver and crash later in BuildOffloadingActions.

Why would passing --offload-arch spuriously enable the new driver?

@wenju-he

Copy link
Copy Markdown
Contributor Author

Changes look OK - but curious about this comment in the description:

so an invalid --offload-arch/--cuda-gpu-arch (which leaves no device toolchain) doesn't spuriously enable the new driver and crash later in BuildOffloadingActions.

Why would passing --offload-arch spuriously enable the new driver?

Thanks, updated the commit message.
This PR fixes a real spurious-diagnostic bug for OpenMP+SYCL by moving OpenMP/explicit-flag check earlier, and separately, it avoids introducing a spurious-enable/crash bug for CUDA/HIP by not moving CUDA/HIP check earlier.

@wenju-he
wenju-he requested a review from mdtoguchi September 16, 2026 03:14
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