Skip to content

Commit 185f775

Browse files
committed
[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 <[email protected]> Change-Id: I137ec8e1fd73dc2de0b211e1ff38cb128e99a671
1 parent ce393be commit 185f775

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

mlir/lib/Dialect/Tosa/Transforms/TosaValidation.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -542,9 +542,13 @@ bool TosaValidation::isValidElementType(Type type) {
542542

543543
void TosaValidation::runOnOperation() {
544544
configLevelAndProfile();
545+
546+
TosaDialect *tosaDialect = getContext().getLoadedDialect<TosaDialect>();
547+
if (!tosaDialect)
548+
return;
549+
545550
getOperation().walk([&](Operation *op) {
546-
if (!op->getDialect() ||
547-
op->getDialect()->getNamespace() != TosaDialect::getDialectNamespace())
551+
if (op->getDialect() != tosaDialect)
548552
return;
549553

550554
for (Value operand : op->getOperands()) {

0 commit comments

Comments
 (0)