Skip to content

[SYCL][NewOffloadModel] Support -fno-sycl-rdc with multiple SYCL target triples #23526

Open

Description

@srividya-sundaram

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

The old offloading model accepts this:

$ clang++ -fsycl --no-offload-new-driver -fsycl-targets=intel_gpu_pvc,spir64_x86_64 -fno-sycl-rdc -c t.cpp

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

new-offload-modelEnables testing with NewOffloadModel.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions