Skip to content

Commit

Permalink
[mlir][benchmark] Fix broken benchmark script (llvm#68841)
Browse files Browse the repository at this point in the history
The mbr script was broken, so this patch fixes it to follow the latest
python binding.
  • Loading branch information
sott0n authored Dec 6, 2023
1 parent 68f0bc6 commit a05e20b
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions mlir/benchmark/python/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,9 @@ def setup_passes(mlir_module):
"""Setup pass pipeline parameters for benchmark functions."""
opt = (
"parallelization-strategy=none"
" vectorization-strategy=none vl=1 enable-simd-index32=False"
)
pipeline = f"sparsifier{{{opt}}}"
PassManager.parse(pipeline).run(mlir_module)
pipeline = f"builtin.module(sparsifier{{{opt}}})"
PassManager.parse(pipeline).run(mlir_module.operation)


def create_sparse_np_tensor(dimensions, number_of_elements):
Expand Down Expand Up @@ -73,7 +72,7 @@ def emit_benchmark_wrapped_main_func(kernel_func, timer_func):
create a "time measuring" variant of a function.
"""
i64_type = ir.IntegerType.get_signless(64)
memref_of_i64_type = ir.MemRefType.get([-1], i64_type)
memref_of_i64_type = ir.MemRefType.get([ir.ShapedType.get_dynamic_size()], i64_type)
wrapped_func = func.FuncOp(
# Same signature and an extra buffer of indices to save timings.
"main",
Expand All @@ -86,7 +85,7 @@ def emit_benchmark_wrapped_main_func(kernel_func, timer_func):
with ir.InsertionPoint(wrapped_func.add_entry_block()):
timer_buffer = wrapped_func.arguments[-1]
zero = arith.ConstantOp.create_index(0)
n_iterations = memref.DimOp(ir.IndexType.get(), timer_buffer, zero)
n_iterations = memref.DimOp(timer_buffer, zero)
one = arith.ConstantOp.create_index(1)
iter_args = list(wrapped_func.arguments[-num_results - 1 : -1])
loop = scf.ForOp(zero, n_iterations, one, iter_args)
Expand Down

0 comments on commit a05e20b

Please sign in to comment.