[Mlir-commits] [mlir] dff04fc - [mlir][SPIRV] Enable use of opaque-pointers in spirv-cpu-runner

Markus Böck llvmlistbot at llvm.org
Fri Feb 24 08:16:09 PST 2023


Author: Markus Böck
Date: 2023-02-24T17:04:43+01:00
New Revision: dff04fc21c6a88a958495c02776a367829783f17

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

LOG: [mlir][SPIRV] Enable use of opaque-pointers in spirv-cpu-runner

Part of https://discourse.llvm.org/t/rfc-switching-the-llvm-dialect-and-dialect-lowerings-to-opaque-pointers/68179

All passes required for lowering have already been successfully converted to allowing opaque-pointers. Switching the Spir-V runner to opaque-pointers is therefore only a matter of turning it on in these conversion passes. Regression tests also did not find any issues.

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

Added: 
    

Modified: 
    mlir/tools/mlir-spirv-cpu-runner/mlir-spirv-cpu-runner.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/tools/mlir-spirv-cpu-runner/mlir-spirv-cpu-runner.cpp b/mlir/tools/mlir-spirv-cpu-runner/mlir-spirv-cpu-runner.cpp
index 1055305dd089b..ba9683ca9d7b1 100644
--- a/mlir/tools/mlir-spirv-cpu-runner/mlir-spirv-cpu-runner.cpp
+++ b/mlir/tools/mlir-spirv-cpu-runner/mlir-spirv-cpu-runner.cpp
@@ -82,11 +82,18 @@ static LogicalResult runMLIRPasses(Operation *module,
   passManager.addPass(createGpuKernelOutliningPass());
   passManager.addPass(createConvertGPUToSPIRVPass(/*mapMemorySpace=*/true));
 
+  auto enableOpaquePointers = [](auto options) {
+    options.useOpaquePointers = true;
+    return options;
+  };
+
   OpPassManager &nestedPM = passManager.nest<spirv::ModuleOp>();
   nestedPM.addPass(spirv::createSPIRVLowerABIAttributesPass());
   nestedPM.addPass(spirv::createSPIRVUpdateVCEPass());
-  passManager.addPass(createLowerHostCodeToLLVMPass());
-  passManager.addPass(createConvertSPIRVToLLVMPass());
+  passManager.addPass(createLowerHostCodeToLLVMPass(
+      enableOpaquePointers(LowerHostCodeToLLVMPassOptions{})));
+  passManager.addPass(createConvertSPIRVToLLVMPass(
+      enableOpaquePointers(ConvertSPIRVToLLVMPassOptions{})));
   return passManager.run(module);
 }
 


        


More information about the Mlir-commits mailing list