Skip to content

Commit

Permalink
[TOSA] Handle dialect check more efficiently
Browse files Browse the repository at this point in the history
After a suggestion in llvm#120205, this commit adjusts a dialect check
that runs per op to be more efficient.

Signed-off-by: Luke Hutton <luke.hutton@arm.com>
Change-Id: I137ec8e1fd73dc2de0b211e1ff38cb128e99a671
  • Loading branch information
lhutton1 committed Dec 23, 2024
1 parent ce393be commit cee2f4a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions mlir/lib/Dialect/Tosa/Transforms/TosaValidation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down

0 comments on commit cee2f4a

Please sign in to comment.