Skip to content

[Driver][SYCL] Fix -check-section triple matching after f8cb6be61b99#22544

Merged
wenju-he merged 1 commit into
intel:sycl-webfrom
wenju-he:fix-clang-offload-bundler-bc-archive-support-win-old-model.cpp
Jul 7, 2026
Merged

[Driver][SYCL] Fix -check-section triple matching after f8cb6be61b99#22544
wenju-he merged 1 commit into
intel:sycl-webfrom
wenju-he:fix-clang-offload-bundler-bc-archive-support-win-old-model.cpp

Conversation

@wenju-he

@wenju-he wenju-he commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

f8cb6be switched OffloadBundler::ConstructJob's host-triple from CurTC->getTriple() to CurTC->ComputeEffectiveClangTriple(), which for MSVCToolChain injects the detected MSVC toolset version into the environment field (e.g. host-x86_64-pc-windows-msvc19.29.30159).

That broke clang-offload-bundler -check-section, which compared the bundle's stored triple against the -targets= string via raw string equality, causing
clang-offload-bundler -check-section -targets=host-x86_64-pc-windows-msvc to fail to find the host bundle.

This PR aligns CheckBundledSection with the existing -unbundle path: both now go through OffloadTargetInfo/isCodeObjectCompatible(), which already relies on Triple::isCompatibleWith() and ignores the environment- version component. This fixes the root inconsistency between -check-section and -unbundle target matching.

Test's 6-component change is due to a pre-existing upstream behavior: OffloadTargetInfo's constructor silently drops an unrecognized trailing target-id component (i.e. "-b") as TargetID = "". -c/-d/-e suffixed spir64/spir64_gen/spir64_x86_64 targets in the test still match their un-suffixed counterparts because those go through a different code path (target strings with fewer than 5 dash-separated components) where the bogus suffix lands in llvm::Triple's vendor/ environment field instead; Triple::isCompatibleWith compares those fields as enums, and any unrecognized string collapses to the same Unknown enum value, so it still matches.
These are pre-existing behaviors, out of scope for this change.

CMPLRLLVM-76621

f8cb6be switched OffloadBundler::ConstructJob's host-triple from
CurTC->getTriple() to CurTC->ComputeEffectiveClangTriple(), which for
MSVCToolChain injects the detected MSVC toolset version into the
environment field (e.g. host-x86_64-pc-windows-msvc19.29.30159).

That broke clang-offload-bundler -check-section, which compared the
bundle's stored triple against the -targets= string via raw string
equality, causing
`clang-offload-bundler -check-section -targets=host-x86_64-pc-windows-msvc`
to fail to find the host bundle.

This PR aligns CheckBundledSection with the existing -unbundle path:
both now go through OffloadTargetInfo/isCodeObjectCompatible(), which
already relies on Triple::isCompatibleWith() and ignores the environment-
version component. This fixes the root inconsistency between
-check-section and -unbundle target matching.

Test's 6-component change is due to a pre-existing upstream behavior:
OffloadTargetInfo's constructor silently drops an unrecognized trailing
target-id component (i.e. "-b") as `TargetID = ""`.
`-c`/`-d`/`-e` suffixed spir64/spir64_gen/spir64_x86_64 targets in the
test still match their un-suffixed counterparts because those go through
a different code path (target strings with fewer than 5 dash-separated
components) where the bogus suffix lands in llvm::Triple's vendor/
environment field instead; Triple::isCompatibleWith compares those
fields as enums, and any unrecognized string collapses to the same
Unknown enum value, so it still matches.
These are pre-existing behaviors, out of scope for this change.

CMPLRLLVM-76621

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
@wenju-he wenju-he requested review from a team as code owners July 5, 2026 05:07

@maksimsab maksimsab 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.

LGTM

@wenju-he wenju-he merged commit 8f2a993 into intel:sycl-web Jul 7, 2026
@wenju-he wenju-he deleted the fix-clang-offload-bundler-bc-archive-support-win-old-model.cpp branch July 7, 2026 01:08
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