[Mlir-commits] [mlir] [MLIR][Benchmark] Refactor setup_passes function (PR #85456)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Fri Mar 15 12:43:30 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-mlir

Author: None (morphide)

<details>
<summary>Changes</summary>



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


1 Files Affected:

- (modified) mlir/benchmark/python/common.py (+5-5) 


``````````diff
diff --git a/mlir/benchmark/python/common.py b/mlir/benchmark/python/common.py
index 0b924172c8dad7..6ac19e50f93a4d 100644
--- a/mlir/benchmark/python/common.py
+++ b/mlir/benchmark/python/common.py
@@ -9,11 +9,11 @@
 from mlir.passmanager import PassManager
 
 
-def setup_passes(mlir_module):
-    """Setup pass pipeline parameters for benchmark functions."""
-    opt = (
-        "parallelization-strategy=none"
-    )
+def setup_passes(mlir_module, optimization_options=None):
+    if optimization_options is None:
+        optimization_options = {"parallelization-strategy": "none"}
+
+    opt = ", ".join([f"{key}={value}" for key, value in optimization_options.items()])
     pipeline = f"builtin.module(sparsifier{{{opt}}})"
     PassManager.parse(pipeline).run(mlir_module.operation)
 

``````````

</details>


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


More information about the Mlir-commits mailing list