[Mlir-commits] [mlir] 39e93ee - [TOSA] Handle dialect check more efficiently (#120960)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Mon Dec 30 03:05:41 PST 2024


Author: Luke Hutton
Date: 2024-12-30T11:05:37Z
New Revision: 39e93eee76ab86c9892540e2d4ad881c41ad54d4

URL: https://github.com/llvm/llvm-project/commit/39e93eee76ab86c9892540e2d4ad881c41ad54d4
DIFF: https://github.com/llvm/llvm-project/commit/39e93eee76ab86c9892540e2d4ad881c41ad54d4.diff

LOG: [TOSA] Handle dialect check more efficiently (#120960)

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Dialect/Tosa/Transforms/TosaValidation.cpp b/mlir/lib/Dialect/Tosa/Transforms/TosaValidation.cpp
index 6fd671051362ca..8588c878bfe4f8 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