[Mlir-commits] [mlir] 17627f1 - [mlir][gpu] Fix mgpuLaunchKernel sharedMemBytes type in LevelZero runtime (#206119)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Fri Jun 26 09:11:44 PDT 2026


Author: Md Abdullah Shahneous Bari
Date: 2026-06-26T11:11:40-05:00
New Revision: 17627f1d463b74fa84602f525f4887da21eb6836

URL: https://github.com/llvm/llvm-project/commit/17627f1d463b74fa84602f525f4887da21eb6836
DIFF: https://github.com/llvm/llvm-project/commit/17627f1d463b74fa84602f525f4887da21eb6836.diff

LOG: [mlir][gpu] Fix mgpuLaunchKernel sharedMemBytes type in LevelZero runtime (#206119)

The GPU launch lowering in SelectObjectAttr.cpp declares and calls
`mgpuLaunchKernel` with the dynamic shared memory size argument typed as
`i32`, but the Level Zero runtime wrapper declared the corresponding
parameter as `size_t` (8 bytes on 64-bit targets). Since these are
positional C-ABI arguments, the 4-byte vs 8-byte mismatch shifts the
layout of every following argument (stream, params, extra, paramsCount),
corrupting the call and crashing at launch.

Change the parameter to int32_t to match the codegen, consistent with
the CUDA and ROCm runtime wrappers which already use int32_t smem.

Co-authored-by: Claude Opus 4.8 <noreply at anthropic.com>

Added: 
    

Modified: 
    mlir/lib/ExecutionEngine/LevelZeroRuntimeWrappers.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/ExecutionEngine/LevelZeroRuntimeWrappers.cpp b/mlir/lib/ExecutionEngine/LevelZeroRuntimeWrappers.cpp
index 91dab05b5a652..f38bd3275067a 100644
--- a/mlir/lib/ExecutionEngine/LevelZeroRuntimeWrappers.cpp
+++ b/mlir/lib/ExecutionEngine/LevelZeroRuntimeWrappers.cpp
@@ -551,7 +551,7 @@ extern "C" ze_kernel_handle_t mgpuModuleGetFunction(ze_module_handle_t module,
 extern "C" void mgpuLaunchKernel(ze_kernel_handle_t kernel, size_t gridX,
                                  size_t gridY, size_t gridZ, size_t blockX,
                                  size_t blockY, size_t blockZ,
-                                 size_t sharedMemBytes, StreamWrapper *stream,
+                                 int32_t sharedMemBytes, StreamWrapper *stream,
                                  void **params, void ** /*extra*/,
                                  size_t paramsCount) {
 


        


More information about the Mlir-commits mailing list