[Mlir-commits] [mlir] 821262e - [mlir] Fix GPU LaunchFunc conversion to the LLVM dialect

Alex Zinenko llvmlistbot at llvm.org
Tue Sep 7 07:50:19 PDT 2021


Author: Alex Zinenko
Date: 2021-09-07T16:50:11+02:00
New Revision: 821262eef210af8675b794fe7efe6d2ed6f81d3a

URL: https://github.com/llvm/llvm-project/commit/821262eef210af8675b794fe7efe6d2ed6f81d3a
DIFF: https://github.com/llvm/llvm-project/commit/821262eef210af8675b794fe7efe6d2ed6f81d3a.diff

LOG: [mlir] Fix GPU LaunchFunc conversion to the LLVM dialect

The conversion has been incorrectly using the operands of the original
operation instead of the converted operands provided to the matchAndRewrite
call. This may lead to spurious materializations and generally invalid IR if
the producer of the original operands is deleted in the process of conversion.

Reviewed By: csigg

Differential Revision: https://reviews.llvm.org/D109356

Added: 
    

Modified: 
    mlir/lib/Conversion/GPUCommon/GPUToLLVMConversion.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Conversion/GPUCommon/GPUToLLVMConversion.cpp b/mlir/lib/Conversion/GPUCommon/GPUToLLVMConversion.cpp
index e4f7858d8d1d4..08ac7d0626a57 100644
--- a/mlir/lib/Conversion/GPUCommon/GPUToLLVMConversion.cpp
+++ b/mlir/lib/Conversion/GPUCommon/GPUToLLVMConversion.cpp
@@ -752,10 +752,10 @@ LogicalResult ConvertLaunchFuncOpToGpuRuntimeCallPattern::matchAndRewrite(
   auto kernelParams = generateParamsArray(launchOp, operands, rewriter);
   auto nullpointer = rewriter.create<LLVM::NullOp>(loc, llvmPointerPointerType);
   launchKernelCallBuilder.create(loc, rewriter,
-                                 {function.getResult(0), launchOp.gridSizeX(),
-                                  launchOp.gridSizeY(), launchOp.gridSizeZ(),
-                                  launchOp.blockSizeX(), launchOp.blockSizeY(),
-                                  launchOp.blockSizeZ(),
+                                 {function.getResult(0), adaptor.gridSizeX(),
+                                  adaptor.gridSizeY(), adaptor.gridSizeZ(),
+                                  adaptor.blockSizeX(), adaptor.blockSizeY(),
+                                  adaptor.blockSizeZ(),
                                   /*sharedMemBytes=*/zero, stream, kernelParams,
                                   /*extra=*/nullpointer});
 


        


More information about the Mlir-commits mailing list