[Mlir-commits] [mlir] [TOSA] Handle dialect check more efficiently (PR #120960)
Luke Hutton
llvmlistbot at llvm.org
Mon Dec 23 04:02:23 PST 2024
https://github.com/lhutton1 created https://github.com/llvm/llvm-project/pull/120960
After a suggestion in #120205, this commit adjusts a dialect check that runs per op to be more efficient.
>From cee2f4afa48066a79a4a17be8000e4c17f319d68 Mon Sep 17 00:00:00 2001
From: Luke Hutton <luke.hutton at arm.com>
Date: Fri, 20 Dec 2024 21:18:13 +0000
Subject: [PATCH] [TOSA] Handle dialect check more efficiently
After a suggestion in #120205, this commit adjusts a dialect check
that runs per op to be more efficient.
Signed-off-by: Luke Hutton <luke.hutton at arm.com>
Change-Id: I137ec8e1fd73dc2de0b211e1ff38cb128e99a671
---
mlir/lib/Dialect/Tosa/Transforms/TosaValidation.cpp | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/mlir/lib/Dialect/Tosa/Transforms/TosaValidation.cpp b/mlir/lib/Dialect/Tosa/Transforms/TosaValidation.cpp
index 6fd671051362ca..c58f8927217940 100644
--- a/mlir/lib/Dialect/Tosa/Transforms/TosaValidation.cpp
+++ b/mlir/lib/Dialect/Tosa/Transforms/TosaValidation.cpp
@@ -542,9 +542,13 @@ bool TosaValidation::isValidElementType(Type type) {
void TosaValidation::runOnOperation() {
configLevelAndProfile();
+
+ TosaDialect* tosaDialect = getContext().getLoadedDialect<TosaDialect>();
+ if (!tosaDialect)
+ return;
+
getOperation().walk([&](Operation *op) {
- if (!op->getDialect() ||
- op->getDialect()->getNamespace() != TosaDialect::getDialectNamespace())
+ if (op->getDialect() != tosaDialect)
return;
for (Value operand : op->getOperands()) {
More information about the Mlir-commits
mailing list