[Mlir-commits] [mlir] [mlir][gpu] Fix mgpuLaunchKernel sharedMemBytes type in L0 runtime (PR #206119)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Fri Jun 26 09:01:26 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-mlir-execution-engine
Author: Md Abdullah Shahneous Bari (mshahneo)
<details>
<summary>Changes</summary>
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.
---
Full diff: https://github.com/llvm/llvm-project/pull/206119.diff
1 Files Affected:
- (modified) mlir/lib/ExecutionEngine/LevelZeroRuntimeWrappers.cpp (+1-1)
``````````diff
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) {
``````````
</details>
https://github.com/llvm/llvm-project/pull/206119
More information about the Mlir-commits
mailing list