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

llvmlistbot at llvm.org llvmlistbot at llvm.org
Wed Oct 4 00:25:57 PDT 2023


Author: Guray Ozen
Date: 2023-10-04T09:25:53+02:00
New Revision: 9d54ae862a9ea272f0a8f204205fbf76511f9517

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

LOG: [mlir] Add `opt-level` to `test-lower-to-nvvm` Pipeline (#68183)

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

Added: 
    

Modified: 
    mlir/test/lib/Dialect/GPU/TestLowerToNVVM.cpp

Removed: 
    


################################################################################
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.


        


More information about the Mlir-commits mailing list