[cmake] Combine -fsycl-targets across all enabled GPU backends (fixes #708) - #753
Open
zjin-lcf wants to merge 1 commit into
Open
[cmake] Combine -fsycl-targets across all enabled GPU backends (fixes #708)#753zjin-lcf wants to merge 1 commit into
zjin-lcf wants to merge 1 commit into
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #708.
example_lapack_getrs_usm(and other USM examples) throw a SYCLNo kernel named ... was foundexception 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::SYCLinterface target in two places:cmake/FindCompiler.cmakeused a mutually-exclusiveif/elseif, so only one vendor's-fsycl-targetstriple was ever selected.CMakeLists.txt(cublas,rocblas,cusparse) additionally appended its own-fsycl-targetsflag.DPC++ only honors the last
-fsycl-targetsflag 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. thegetrf32→64-bit pivot-castingparallel_forin the cuSOLVER backend) were missing at runtime.Fix
cmake/FindCompiler.cmake, and pass them together as a single comma-separated-fsycl-targets=...list (with per-target-Xsycl-target-backend=<triple>arch options).spir64image whenENABLE_MKLGPU_BACKENDis combined with a CUDA/HIP backend.-fsycl-targetsappends from thecublas,rocblas, andcusparseCMakeLists.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
-DENABLE_MKLGPU_BACKEND+ allCU*+ allROC*backends (-DHIP_TARGETS=gfx1100) as in example_lapack_getrs_usm throws SYCL exception on NVIDIA GPU when built with support for AMD GPU backends #708.example_lapack_getrs_usmon the NVIDIA GPU and confirm it no longer throwsNo kernel named ... was found.