You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[SYCL][NewOffloadModel] Support -fno-sycl-rdc with multiple SYCL target triples #23526
With the new offloading model, -fno-sycl-rdc only accepts SYCL targets of one triple. Several architectures of the same triple work (e.g. -fsycl-targets=intel_gpu_pvc,intel_gpu_dg2, after #23492), but mixing triples is rejected:
$ clang++ -fsycl --offload-new-driver -fsycl-targets=intel_gpu_pvc,spir64 -fno-sycl-rdc -c t.cpp
clang++: error: '-fno-sycl-rdc' is not supported with multiple SYCL offloading targets
It finalizes each triple separately, running clang-offload-wrapper -target=spir64_gen and clang-offload-wrapper -target=spir64_x86_64, and bundles both results into the object.
Why the new model rejects it
With -fno-sycl-rdc -c, each TU's device code is finalized by a single clang-linker-wrapper --no-sycl-rdc --emit-fatbin-only job, created for the whole packaged device code of the TU (clang/lib/Driver/Driver.cpp, the SYCLNoRDC branch that creates the LinkerWrapperJobAction).
That job writes one offload wrapper module. Every image in a wrapper module is labeled with the arch name of one target triple (DeviceTargetSpec, e.g. spir64_gen), which the runtime uses to pick images for a device. So images of different triples can't share one module.
The driver therefore rejects multiple SYCL targets for -fno-sycl-rdc (clang/lib/Driver/Driver.cpp, err_drv_sycl_no_rdc_multiple_targets); the comment there notes that the old offloading model supports this.
What's needed
Produce one wrapper module per triple in the -fno-sycl-rdc compile step and have the host compilation include all of them, then remove the driver restriction.
Activity
[SYCL][clang-linker-wrapper] Wrap all architectures in one module for…