[Mlir-commits] [mlir] [mlir] Add filtering callback to GenerateRuntimeVerification pass (PR #150013)
Matthias Springer
llvmlistbot at llvm.org
Tue Jul 22 06:46:57 PDT 2025
================
@@ -17,16 +17,46 @@ namespace mlir {
#include "mlir/Transforms/Passes.h.inc"
} // namespace mlir
+#define DEBUG_TYPE "generate-runtime-verification"
+#define DBGS() (llvm::dbgs() << '[' << DEBUG_TYPE << "] ")
+#define LDBG(X) LLVM_DEBUG(DBGS() << X << "\n")
+
using namespace mlir;
+static bool defaultShouldHandleVerifiableOpFn(RuntimeVerifiableOpInterface op) {
+ // By default, all verifiable ops are considered
+ return true;
+}
+
namespace {
struct GenerateRuntimeVerificationPass
: public impl::GenerateRuntimeVerificationBase<
GenerateRuntimeVerificationPass> {
+
+ GenerateRuntimeVerificationPass();
+ GenerateRuntimeVerificationPass(const GenerateRuntimeVerificationPass &) =
+ default;
+ GenerateRuntimeVerificationPass(
+ std::function<bool(RuntimeVerifiableOpInterface)>
+ shouldHandleVerifiableOpFn);
+
void runOnOperation() override;
+
+private:
+ // A filter function to select verifiable ops to generate verification for.
+ // If empty, all verifiable ops are considered.
+ std::function<bool(RuntimeVerifiableOpInterface)> shouldHandleVerifiableOpFn;
----------------
matthias-springer wrote:
@joker-eph Can we have such non-serializable fields here or should this be a parameter for a new function that is publicly accessible and called from `runOnOperation`?
https://github.com/llvm/llvm-project/pull/150013
More information about the Mlir-commits
mailing list