Repository navigation
Description
Summary
A SYCL static library built for several NVIDIA architectures cannot be linked per architecture with DPC++ 7.1.0: the SDK's clang-offload-bundler matches the five-part bundle IDs its driver writes (sycl-nvptx64-nvidia-cuda-sm_89) to every NVPTX request. Unbundling the archive for one architecture yields the members of all of them, and the device link reports duplicate definitions. The defect is the SDK's (upstream); this issue tracks it for mcpp and mcpp-plugins.
Scope
- Affected: a multi-architecture SYCL static archive consumed through the SDK's archive unbundling (mcpp-plugins
sycl+{nvptx64-sm_89,nvptx64-sm_90}with a library dependency). - Not affected: multi-architecture objects linked directly, single-architecture archives, mixed SPIR-V + one NVIDIA architecture.
- mcpp and mcpp-plugins keep both architectures; neither discards a variant nor reuses one architecture's IR for another. The core needs no vendor-specific link mode.
Resolution
Fixed in the SDK (bundle IDs with an explicit environment, or a target-ID parser that reads the five-part form), followed by the final device link and the cross-package control in mcpp-plugins' SYCL consumers. Until then mcpp-plugins documents the combination as unsupported (docs/rules.md).
Upstream analysis
Version
- DPC++ 7.1.0 (Nightly 2026-09-01),
clang version 22.1.0 (https://github.com/intel/llvm 880399f47228ac92f403e3b2b865cf1d6f0b1382) - CUDA 12.9.86 (
--cuda-path), Linux x86_64
Reproduction
// k.cpp
#include <sycl/sycl.hpp>
SYCL_EXTERNAL int add_seven(int v) { return v + 7; }clang++ -fsycl -fsycl-targets=nvidia_gpu_sm_89,nvidia_gpu_sm_90 --cuda-path=$CUDA -c k.cpp -o k.o
clang-offload-bundler --list --type=o --input=k.o
# sycl-nvptx64-nvidia-cuda-sm_89
# sycl-nvptx64-nvidia-cuda-sm_90
# host-x86_64-unknown-linux-gnu
# Object: the sm_90 request returns the sm_89 device code.
clang-offload-bundler --unbundle --type=o --targets=sycl-nvptx64-nvidia-cuda-sm_89 --input=k.o --output=obj-sm_89.bc
clang-offload-bundler --unbundle --type=o --targets=sycl-nvptx64-nvidia-cuda-sm_90 --input=k.o --output=obj-sm_90.bc
sha256sum obj-sm_89.bc obj-sm_90.bc # identical
# Archive: each request returns the members of both architectures.
llvm-ar rcs libk.a k.o
clang-offload-bundler --unbundle --type=a --targets=sycl-nvptx64-nvidia-cuda-sm_89 \
--input=libk.a --output=out-sm_89.a --allow-missing-bundles
llvm-ar t out-sm_89.a
# k-sycl-nvptx64-nvidia-cuda-sm_89k.o
# k-sycl-nvptx64-nvidia-cuda-sm_90k.oExpected
Each request returns the one bundle of its architecture: obj-sm_90.bc is the sm_90 device code, and out-sm_89.a holds only the sm_89 member. The archive members extracted for both requests are byte-identical to the device code of their own architecture, so the content is correct and only the selection is wrong.
Control
The same host and device bytes re-bundled under six-part IDs with an explicit environment (sycl-nvptx64-nvidia-cuda-unknown-sm_89, ...-unknown-sm_90) unbundle correctly: the object request for each architecture returns that architecture's bytes, and each archive request returns one member.
Analysis
In clang/lib/Driver/OffloadBundler.cpp at this revision, an offload target ID's fifth component is taken as the triple's environment and the target ID (the GPU architecture) only from a sixth component. For sycl-nvptx64-nvidia-cuda-sm_89, sm_89 becomes the environment, the target ID is empty, and the compatibility check accepts any NVPTX bundle for any request. The driver writes exactly these five-part IDs, so every multi-architecture SYCL object and static library is affected.
Impact
A static library compiled for several NVIDIA architectures links the device code of every architecture into each device image (duplicate definitions such as add_seven), and an object's device code for one architecture can be taken for another.
Activity