[Mlir-commits] [mlir] [MLIR] Add options to generate-runtime-verification to enable faster pass running (PR #160331)

Hanchenng Wu llvmlistbot at llvm.org
Mon Oct 6 07:31:15 PDT 2025


HanchengWu wrote:

> This LGTM, but can we get an upstream repro for:
> 
> > Currently, the pass is extremely expensive. For example, with a mobilenet v2 ssd network(converted to mlir), running this pass alone will take 30 minutes. The same observation has been made to other networks as small as 5 Mb.
> > Perf profiling shows that 98% percent of the time is spent in the constructor of SSANameState.
> 
> I'd like to be able to benchmark this upstream to check how to improve this pass.

Hi, Mehdi
Below is the reproduce steps if you wanna try llvm LKG. 

https://drive.google.com/file/d/1KavPyfMPobtpnnQxqmK6Iq5IBbdMe3PY/view?usp=sharing

Download the ssd_mobilenet_v2.standard.mlir, then run below:

mlir-opt --generate-runtime-verification -mlir-disable-threading=true -mlir-timing -mlir-timing-display=tree  ssd_mobilenet_v2.standard.mlir -o ssd_mobilenet_v2.lkg.mlir

We can see the reported running time is somewhere 150 seconds to 200 seconds, depending on the machine.

Then comment out the line op->print(...) in "RuntimeVerifiableOpInterface.cpp", recompile llvm, then run above agin.
We should see the pass finished within 0.3 second.

As I replied earlier, the operand names returned by op->print(...) for the error message is not that useful. They are neither in input mlir, nor are they in output mlir.


Or, you can check out my changes and try verbose 0, 1, 2, you would  see verbose2 takes 150-200 seconds, while verbose 0,1 take only 0.2-0.3 seconds.

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


More information about the Mlir-commits mailing list