[Mlir-commits] [mlir] 03fd5f1 - [mlir][tosa] Enable Constant Operand Check by Default in TOSA Validation Pass (#150598)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Fri Aug 1 06:19:31 PDT 2025
Author: Luke Hutton
Date: 2025-08-01T14:19:28+01:00
New Revision: 03fd5f125b61ad6e80eb589b52db0bee22bdd540
URL: https://github.com/llvm/llvm-project/commit/03fd5f125b61ad6e80eb589b52db0bee22bdd540
DIFF: https://github.com/llvm/llvm-project/commit/03fd5f125b61ad6e80eb589b52db0bee22bdd540.diff
LOG: [mlir][tosa] Enable Constant Operand Check by Default in TOSA Validation Pass (#150598)
Previous behaviour was to only run the check for constant operands when
the "strict-op-spec-alignment" check was enabled. However, this type of
check seems more generally useful without this option enabled. For
example, tosa-to-linalg doesn't enable the "strict-op-spec-alignment"
option when running the tosa-validate pass, but it does expect operands
to be constant.
By enabling this type of checking by default, lowering that don't
support non constant operands and don't use the
"strict-op-spec-alignment" option will fail early, rather than later in
the lowering pipeline.
Should a use-case need to disable this type of checking,
`--tosa-validate="extension=dynamic"` can be used.
Added:
Modified:
mlir/lib/Dialect/Tosa/Transforms/TosaValidation.cpp
mlir/test/Dialect/Tosa/dynamic_extension.mlir
mlir/test/Dialect/Tosa/level_check.mlir
Removed:
################################################################################
diff --git a/mlir/lib/Dialect/Tosa/Transforms/TosaValidation.cpp b/mlir/lib/Dialect/Tosa/Transforms/TosaValidation.cpp
index 8ec77654fb896..c7b9534f9e744 100644
--- a/mlir/lib/Dialect/Tosa/Transforms/TosaValidation.cpp
+++ b/mlir/lib/Dialect/Tosa/Transforms/TosaValidation.cpp
@@ -1381,7 +1381,7 @@ void TosaValidation::runOnOperation() {
// Some uses of TOSA rely on the constant operands of particular
// operations.
- if (strictOpSpecAlignment && failed(applyConstantOperandCheck(op)))
+ if (failed(applyConstantOperandCheck(op)))
signalPassFailure();
// do level checks
diff --git a/mlir/test/Dialect/Tosa/dynamic_extension.mlir b/mlir/test/Dialect/Tosa/dynamic_extension.mlir
index 8739f979d8d50..e23ce43031a24 100644
--- a/mlir/test/Dialect/Tosa/dynamic_extension.mlir
+++ b/mlir/test/Dialect/Tosa/dynamic_extension.mlir
@@ -2,7 +2,7 @@
// Check operations when the dynamic extension is enabled.
//--------------------------------------------------------
-// RUN: mlir-opt %s -split-input-file -verify-diagnostics -tosa-validate="profile=pro_int,pro_fp extension=dynamic strict-op-spec-alignment allow-invalid-op-datatype-combinations"
+// RUN: mlir-opt %s -split-input-file -verify-diagnostics -tosa-validate="profile=pro_int,pro_fp extension=dynamic allow-invalid-op-datatype-combinations"
// -----
diff --git a/mlir/test/Dialect/Tosa/level_check.mlir b/mlir/test/Dialect/Tosa/level_check.mlir
index bf9ed8a8a8c89..0184d2b05f0ee 100644
--- a/mlir/test/Dialect/Tosa/level_check.mlir
+++ b/mlir/test/Dialect/Tosa/level_check.mlir
@@ -1,4 +1,4 @@
-// RUN: mlir-opt %s -split-input-file -verify-diagnostics --tosa-validate
+// RUN: mlir-opt %s -split-input-file -verify-diagnostics --tosa-validate="extension=dynamic"
func.func @test_argmax_rank_invalid(%arg0: tensor<1x1x1x1x29x29x4xf32>) -> tensor<1x1x1x1x29x4xi32> {
// expected-error at +1 {{'tosa.argmax' op failed level check: operand rank(shape) <= MAX_RANK}}
More information about the Mlir-commits
mailing list