diff options
author | Hanchenng Wu <42194432+HanchengWu@users.noreply.github.com> | 2025-10-08 06:48:34 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-10-08 11:48:34 +0100 |
commit | a6d1a52b8da9cb3c351a086180f8b871f0fd2a6e (patch) | |
tree | c657e46e4d94981ce6fb7dec05ca80628c8e56e1 /llvm/tools/llvm-offload-binary/llvm-offload-binary.cpp | |
parent | 4d45718b478940cd11ac80dd64db8408bb21dbca (diff) | |
download | llvm-a6d1a52b8da9cb3c351a086180f8b871f0fd2a6e.zip llvm-a6d1a52b8da9cb3c351a086180f8b871f0fd2a6e.tar.gz llvm-a6d1a52b8da9cb3c351a086180f8b871f0fd2a6e.tar.bz2 |
[MLIR] Reuse AsmState to enable fast generate-runtime-verification pass; add location-only pass option (#160331)
The pass generate-runtime-verification generates additional runtime op
verification checks.
Currently, the pass is extremely expensive. For example, with a
mobilenet v2 ssd network(converted to mlir), running this pass alone in
debug mode will take 30 minutes. The same observation has been made to
other networks as small as 5 Mb.
The culprit is this line "op->print(stream, flags);" in function
"RuntimeVerifiableOpInterface::generateErrorMessage" in File
mlir/lib/Interfaces/RuntimeVerifiableOpInterface.cpp.
As we are printing the op with all the names of the operands in the
middle end, we are constructing a new SSANameState for each
op->print(...) call. Thus, we are doing a new SSA analysis for each
error message printed.
Perf profiling shows that 98% percent of the time is spent in the
constructor of SSANameState.
This change refactored the message generator. We use a toplevel
AsmState, and reuse it with all the op-print(stream, asmState). With a
release build, this change reduces the pass exeuction time from ~160
seconds to 0.3 seconds on my machine.
This change also adds verbose options to generate-runtime-verification
pass.
verbose 0: print only source location with error message.
verbose 1: print the full op, including the name of the operands.
Diffstat (limited to 'llvm/tools/llvm-offload-binary/llvm-offload-binary.cpp')
0 files changed, 0 insertions, 0 deletions