Skip to content

[cmake] Combine -fsycl-targets across all enabled GPU backends (fixes #708) - #753

Open
zjin-lcf wants to merge 1 commit into
uxlfoundation:developfrom
zjin-lcf:fix/708-multi-vendor-fsycl-targets
Open

[cmake] Combine -fsycl-targets across all enabled GPU backends (fixes #708)#753
zjin-lcf wants to merge 1 commit into
uxlfoundation:developfrom
zjin-lcf:fix/708-multi-vendor-fsycl-targets

Conversation

@zjin-lcf

Copy link
Copy Markdown
Contributor

Summary

Fixes #708.

example_lapack_getrs_usm (and other USM examples) throw a SYCL No kernel named ... was found exception on an NVIDIA GPU when oneMath is built with multiple GPU vendor backends enabled at once (e.g. CUDA + Intel + AMD).

Root cause

The SYCL offload targets were set on the shared ONEMATH::SYCL::SYCL interface target in two places:

  • cmake/FindCompiler.cmake used a mutually-exclusive if/elseif, so only one vendor's -fsycl-targets triple was ever selected.
  • Each vendor backend's CMakeLists.txt (cublas, rocblas, cusparse) additionally appended its own -fsycl-targets flag.

DPC++ only honors the last -fsycl-targets flag on the command line, so in a multi-vendor build all but the last triple were silently dropped. The device images for the other vendor(s) were never generated, so their SYCL kernels (e.g. the getrf 32→64-bit pivot-casting parallel_for in the cuSOLVER backend) were missing at runtime.

Fix

  • Assemble the offload target triples for all enabled GPU backends once, in cmake/FindCompiler.cmake, and pass them together as a single comma-separated -fsycl-targets=... list (with per-target -Xsycl-target-backend=<triple> arch options).
  • Preserve the Intel GPU spir64 image when ENABLE_MKLGPU_BACKEND is combined with a CUDA/HIP backend.
  • Remove the now-redundant per-backend -fsycl-targets appends from the cublas, rocblas, and cusparse CMakeLists.txt.

For a tri-vendor build this now produces e.g. -fsycl-targets=nvptx64-nvidia-cuda,amdgcn-amd-amdhsa,spir64, so every enabled vendor gets a device image. Single-vendor builds are unchanged.

Test plan

DPC++ only honors the last -fsycl-targets flag on the command line. oneMath
appended -fsycl-targets to the shared ONEMATH::SYCL::SYCL interface from
several vendor backends independently (FindCompiler.cmake, cublas, rocblas,
cusparse), so in a multi-vendor build all but the last target triple were
silently dropped. The device kernels of the other vendor(s) - notably the
32<->64-bit ipiv casting parallel_for in the LAPACK getrf/getrs USM wrappers,
which are the only real SYCL device kernels in those backends - were then
missing at runtime, producing "No kernel named ...getrf... was found"
(issue uxlfoundation#708).

Assemble a single comma-separated -fsycl-targets list covering every enabled
CUDA/ROCm backend (plus spir64 when the Intel oneMKL GPU backend is enabled)
in FindCompiler.cmake, with per-target -Xsycl-target-backend arch options, and
drop the now-redundant per-backend -fsycl-targets appends.

Fixes uxlfoundation#708

Co-authored-by: Cursor <cursoragent@cursor.com>
@zjin-lcf
zjin-lcf requested review from a team as code owners August 11, 2026 03:09
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.

example_lapack_getrs_usm throws SYCL exception on NVIDIA GPU when built with support for AMD GPU backends

1 participant