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

Guray Ozen llvmlistbot at llvm.org
Wed Oct 4 00:14:50 PDT 2023


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

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

>From 81646cf447ad607f264d6cae7cb9a227832567de Mon Sep 17 00:00:00 2001
From: Guray Ozen <guray.ozen at gmail.com>
Date: Wed, 4 Oct 2023 09:14:22 +0200
Subject: [PATCH] [mlir] Add `opt-level` to `test-lower-to-nvvm` Pipeline

This PR adds the `opt-level` parameter to control code optimization for NVIDIA GPU targets in the `test-lower-to-nvvm` pipeline.
---
 mlir/test/lib/Dialect/GPU/TestLowerToNVVM.cpp | 5 +++++
 1 file changed, 5 insertions(+)

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