[Mlir-commits] [mlir] [MLIR] Add options to generate-runtime-verification to enable faster pass running (PR #160331)
Mehdi Amini
llvmlistbot at llvm.org
Mon Oct 6 07:54:28 PDT 2025
joker-eph wrote:
Can you apply this patch:
```
diff --git a/mlir/lib/Transforms/GenerateRuntimeVerification.cpp b/mlir/lib/Transforms/GenerateRuntimeVerification.cpp
index cfe531385fef..9a25b7087d4d 100644
--- a/mlir/lib/Transforms/GenerateRuntimeVerification.cpp
+++ b/mlir/lib/Transforms/GenerateRuntimeVerification.cpp
@@ -6,6 +6,7 @@
//
//===----------------------------------------------------------------------===//
+#include "mlir/IR/AsmState.h"
#include "mlir/Transforms/Passes.h"
#include "mlir/IR/Builders.h"
@@ -43,23 +44,22 @@ void GenerateRuntimeVerificationPass::runOnOperation() {
getOperation()->walk([&](RuntimeVerifiableOpInterface verifiableOp) {
ops.push_back(verifiableOp);
});
-
+ OpPrintingFlags flags;
+ // We may generate a lot of error messages and so we need to ensure the
+ // printing is fast.
+ flags.elideLargeElementsAttrs();
+ flags.skipRegions();
+ flags.useLocalScope();
+ AsmState state(getOperation(), flags);
// Create error message generator based on verboseLevel
- auto errorMsgGenerator = [vLevel = verboseLevel.getValue()](
+ auto errorMsgGenerator = [vLevel = verboseLevel.getValue(), &state](
Operation *op, StringRef msg) -> std::string {
std::string buffer;
llvm::raw_string_ostream stream(buffer);
- OpPrintingFlags flags;
- // We may generate a lot of error messages and so we need to ensure the
- // printing is fast.
- flags.elideLargeElementsAttrs();
- flags.printGenericOpForm();
- flags.skipRegions();
- flags.useLocalScope();
stream << "ERROR: Runtime op verification failed\n";
if (vLevel == 2) {
// print full op including operand names, very expensive
- op->print(stream, flags);
+ op->print(stream, state);
stream << "\n " << msg;
} else if (vLevel == 1) {
// print op name and operand types
```
And then redo the benchmarks and the SSA value comparisons and let me know how does this look now?
https://github.com/llvm/llvm-project/pull/160331
More information about the Mlir-commits
mailing list