Skip to content

[SYCL-MLIR]: Add convert-spirv-builtin-to-nvvm Pass #19101

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: sycl-mlir
Choose a base branch
from

Conversation

SealSoul117
Copy link

Enable SYCL-MLIR to Run on NVIDIA GPUs
This patch introduces a new pass to support executing SYCL-MLIR-generated code on NVIDIA GPUs.
The pass is intended to be applied to the final MLIR after lowering with cgeist, where the IR is already in the LLVM dialect.

The pass performs the following key transformations to enable compatibility with NVIDIA backends:

  1. Mark kernel functions so they can be recognized as GPU kernels.
  2. Replace SPIR-V-specific global variables and accessor logic with direct NVVM intrinsic calls, ensuring compatibility with the NVIDIA CUDA backend.

With this pass, I have successfully executed SYCL code on an NVIDIA GPU using the following steps:

  1. Use cgeist to lower SYCL C++ code to MLIR in the LLVM dialect.
  2. Apply this pass to the generated MLIR using sycl-mlir-opt.
  3. Convert the transformed MLIR to LLVM IR using mlir-translate.
  4. Integrate the resulting LLVM IR into the standard DPC++ NVIDIA compilation pipeline by replacing the corresponding IR.
  5. Successfully generate a runnable binary for execution on NVIDIA GPUs.

Signed-off-by: SealSoul117 <asky117814@163.com>
@SealSoul117 SealSoul117 requested a review from a team as a code owner June 23, 2025 17:30
Copy link
Contributor

github-actions bot commented Jun 23, 2025

✅ With the latest revision this PR passed the C/C++ code formatter.

Signed-off-by: SealSoul117 <asky117814@163.com>
Signed-off-by: SealSoul117 <asky117814@163.com>
Signed-off-by: SealSoul117 <asky117814@163.com>
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.

1 participant