[Mlir-commits] [mlir] [mlir] Add `opt-level` to `test-lower-to-nvvm` Pipeline (PR #68183)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Wed Oct 4 00:16:03 PDT 2023


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-mlir

<details>
<summary>Changes</summary>

This PR adds the `opt-level` parameter to control code optimization for NVIDIA GPU targets in the `test-lower-to-nvvm` pipeline.

---
Full diff: https://github.com/llvm/llvm-project/pull/68183.diff


1 Files Affected:

- (modified) mlir/test/lib/Dialect/GPU/TestLowerToNVVM.cpp (+5) 


``````````diff
diff --git a/mlir/test/lib/Dialect/GPU/TestLowerToNVVM.cpp b/mlir/test/lib/Dialect/GPU/TestLowerToNVVM.cpp
index 328c803c39efb73..174d27b0da8a1dd 100644
--- a/mlir/test/lib/Dialect/GPU/TestLowerToNVVM.cpp
+++ b/mlir/test/lib/Dialect/GPU/TestLowerToNVVM.cpp
@@ -74,6 +74,10 @@ struct TestLowerToNVVMOptions
       *this, "cubin-format",
       llvm::cl::desc("Compilation format to use to serialize to cubin."),
       llvm::cl::init("isa")};
+  PassOptions::Option<int> optLevel{
+      *this, "opt-level",
+      llvm::cl::desc("Optimization level for NVVM compilation"),
+      llvm::cl::init(2)};
 };
 
 //===----------------------------------------------------------------------===//
@@ -242,6 +246,7 @@ void buildLowerToNVVMPassPipeline(OpPassManager &pm,
   nvvmTargetOptions.triple = options.cubinTriple;
   nvvmTargetOptions.chip = options.cubinChip;
   nvvmTargetOptions.features = options.cubinFeatures;
+  nvvmTargetOptions.optLevel = options.optLevel;
   pm.addPass(createGpuNVVMAttachTarget(nvvmTargetOptions));
 
   // Convert GPU to LLVM.

``````````

</details>


https://github.com/llvm/llvm-project/pull/68183


More information about the Mlir-commits mailing list