Skip to content

Commit 03fd5f1

Browse files
authored
[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.
1 parent 2ae996c commit 03fd5f1

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1381,7 +1381,7 @@ void TosaValidation::runOnOperation() {
13811381

13821382
// Some uses of TOSA rely on the constant operands of particular
13831383
// operations.
1384-
if (strictOpSpecAlignment && failed(applyConstantOperandCheck(op)))
1384+
if (failed(applyConstantOperandCheck(op)))
13851385
signalPassFailure();
13861386

13871387
// do level checks

mlir/test/Dialect/Tosa/dynamic_extension.mlir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Check operations when the dynamic extension is enabled.
33
//--------------------------------------------------------
44

5-
// 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"
5+
// RUN: mlir-opt %s -split-input-file -verify-diagnostics -tosa-validate="profile=pro_int,pro_fp extension=dynamic allow-invalid-op-datatype-combinations"
66

77
// -----
88

mlir/test/Dialect/Tosa/level_check.mlir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: mlir-opt %s -split-input-file -verify-diagnostics --tosa-validate
1+
// RUN: mlir-opt %s -split-input-file -verify-diagnostics --tosa-validate="extension=dynamic"
22

33
func.func @test_argmax_rank_invalid(%arg0: tensor<1x1x1x1x29x29x4xf32>) -> tensor<1x1x1x1x29x4xi32> {
44
// expected-error@+1 {{'tosa.argmax' op failed level check: operand rank(shape) <= MAX_RANK}}

0 commit comments

Comments
 (0)