Skip to content

Commit a05e20b

Browse files
authored
[mlir][benchmark] Fix broken benchmark script (#68841)
The mbr script was broken, so this patch fixes it to follow the latest python binding.
1 parent 68f0bc6 commit a05e20b

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

mlir/benchmark/python/common.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,9 @@ def setup_passes(mlir_module):
1313
"""Setup pass pipeline parameters for benchmark functions."""
1414
opt = (
1515
"parallelization-strategy=none"
16-
" vectorization-strategy=none vl=1 enable-simd-index32=False"
1716
)
18-
pipeline = f"sparsifier{{{opt}}}"
19-
PassManager.parse(pipeline).run(mlir_module)
17+
pipeline = f"builtin.module(sparsifier{{{opt}}})"
18+
PassManager.parse(pipeline).run(mlir_module.operation)
2019

2120

2221
def create_sparse_np_tensor(dimensions, number_of_elements):
@@ -73,7 +72,7 @@ def emit_benchmark_wrapped_main_func(kernel_func, timer_func):
7372
create a "time measuring" variant of a function.
7473
"""
7574
i64_type = ir.IntegerType.get_signless(64)
76-
memref_of_i64_type = ir.MemRefType.get([-1], i64_type)
75+
memref_of_i64_type = ir.MemRefType.get([ir.ShapedType.get_dynamic_size()], i64_type)
7776
wrapped_func = func.FuncOp(
7877
# Same signature and an extra buffer of indices to save timings.
7978
"main",
@@ -86,7 +85,7 @@ def emit_benchmark_wrapped_main_func(kernel_func, timer_func):
8685
with ir.InsertionPoint(wrapped_func.add_entry_block()):
8786
timer_buffer = wrapped_func.arguments[-1]
8887
zero = arith.ConstantOp.create_index(0)
89-
n_iterations = memref.DimOp(ir.IndexType.get(), timer_buffer, zero)
88+
n_iterations = memref.DimOp(timer_buffer, zero)
9089
one = arith.ConstantOp.create_index(1)
9190
iter_args = list(wrapped_func.arguments[-num_results - 1 : -1])
9291
loop = scf.ForOp(zero, n_iterations, one, iter_args)

0 commit comments

Comments
 (0)