[Mlir-commits] [mlir] [mlir][tosa] Apply error_if checks in tosa validation without strict mode (PR #235741)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Mon Oct 26 04:54:30 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-mlir
Author: Luke Hutton (lhutton1)
<details>
<summary>Changes</summary>
Enable most error_if checks by default rather than requiring `strict-op-spec-alignment`. This enables error_if checks in the tosa-to-linalg lowering pipeline.
Some resize checks are omitted as can be too strict for some implementations. Also note that the current implementation requires cond_if and while_loop operations be isolated from above. If this restriction is too strict, the check can be relaxed similarly to resize.
---
Full diff: https://github.com/llvm/llvm-project/pull/235741.diff
2 Files Affected:
- (modified) mlir/lib/Dialect/Tosa/Transforms/TosaValidation.cpp (+33-27)
- (modified) mlir/test/Dialect/Tosa/level_check.mlir (+63-48)
``````````diff
diff --git a/mlir/lib/Dialect/Tosa/Transforms/TosaValidation.cpp b/mlir/lib/Dialect/Tosa/Transforms/TosaValidation.cpp
index 5d465065497abf..6bb4d6715a3523 100644
--- a/mlir/lib/Dialect/Tosa/Transforms/TosaValidation.cpp
+++ b/mlir/lib/Dialect/Tosa/Transforms/TosaValidation.cpp
@@ -1098,7 +1098,8 @@ LogicalResult TosaValidation::applyVariableCheck(Operation *op) {
return success();
}
-LogicalResult checkErrorIfResize(Operation *op) {
+LogicalResult checkErrorIfResize(Operation *op,
+ bool checkStrictSpecConformance) {
auto resize = dyn_cast<tosa::ResizeOp>(op);
if (!resize)
return success();
@@ -1115,7 +1116,8 @@ LogicalResult checkErrorIfResize(Operation *op) {
// Ensure the image size is supported by GPU APIs and that for integer
// implementations, position * stride does not overflow int32_t.
- if (inputType.hasStaticShape() && outputType.hasStaticShape()) {
+ if (checkStrictSpecConformance && inputType.hasStaticShape() &&
+ outputType.hasStaticShape()) {
const SmallVector<int64_t, 4> sizes = {
outputType.getDimSize(1), outputType.getDimSize(2),
inputType.getDimSize(1), inputType.getDimSize(2)};
@@ -1154,27 +1156,30 @@ LogicalResult checkErrorIfResize(Operation *op) {
const int64_t offsetY = offset[0];
const int64_t offsetX = offset[1];
- // Set a consistent lower limit of 1/16 downscale to simplify
- // implementations
- if (offsetY < -scaleYN || offsetY >= 16 * scaleYN)
- return op->emitOpError(
- "expect offsetY / scaleYNumerator to be in range [-1, 16), got ")
- << offsetY << "/" << scaleYN;
- if (offsetX < -scaleXN || offsetX >= 16 * scaleXN)
- return op->emitOpError(
- "expect offsetX / scaleXNumerator to be in range [-1, 16), got ")
- << offsetX << "/" << scaleXN;
-
const int64_t borderY = border[0];
const int64_t borderX = border[1];
- if (borderY < -16 * scaleYN || borderY >= scaleYN)
- return op->emitOpError(
- "expect borderY / scaleYNumerator to be in range [-16, 1), got ")
- << borderY << "/" << scaleYN;
- if (borderX < -16 * scaleXN || borderX >= scaleXN)
- return op->emitOpError(
- "expect borderX / scaleXNumerator to be in range [-16, 1), got ")
- << borderX << "/" << scaleXN;
+
+ // Set a consistent lower limit of 1/16 downscale to simplify
+ // implementations
+ if (checkStrictSpecConformance) {
+ if (offsetY < -scaleYN || offsetY >= 16 * scaleYN)
+ return op->emitOpError("expect offsetY / scaleYNumerator to be in range "
+ "[-1, 16), got ")
+ << offsetY << "/" << scaleYN;
+ if (offsetX < -scaleXN || offsetX >= 16 * scaleXN)
+ return op->emitOpError("expect offsetX / scaleXNumerator to be in range "
+ "[-1, 16), got ")
+ << offsetX << "/" << scaleXN;
+
+ if (borderY < -16 * scaleYN || borderY >= scaleYN)
+ return op->emitOpError("expect borderY / scaleYNumerator to be in range "
+ "[-16, 1), got ")
+ << borderY << "/" << scaleYN;
+ if (borderX < -16 * scaleXN || borderX >= scaleXN)
+ return op->emitOpError("expect borderX / scaleXNumerator to be in range "
+ "[-16, 1), got ")
+ << borderX << "/" << scaleXN;
+ }
// The following section of code is mostly duplicated with ResizeOp::verify().
//
@@ -1516,11 +1521,12 @@ LogicalResult checkErrorIfScatter(Operation *op) {
}
LogicalResult TosaValidation::applyErrorIfCheck(Operation *op) {
- if (failed(checkErrorIfResize(op)) || failed(checkErrorIfMul(op)) ||
- failed(checkErrorIfTable(op)) || failed(checkErrorIfRescale(op)) ||
- failed(checkErrorIfPad(op)) || failed(checkErrorIfReshape(op)) ||
- failed(checkErrorIfSlice(op)) || failed(checkErrorIfCondIf(op)) ||
- failed(checkErrorIfWhileLoop(op)) || failed(checkErrorIfScatter(op)))
+ if (failed(checkErrorIfResize(op, strictOpSpecAlignment)) ||
+ failed(checkErrorIfMul(op)) || failed(checkErrorIfTable(op)) ||
+ failed(checkErrorIfRescale(op)) || failed(checkErrorIfPad(op)) ||
+ failed(checkErrorIfReshape(op)) || failed(checkErrorIfSlice(op)) ||
+ failed(checkErrorIfCondIf(op)) || failed(checkErrorIfWhileLoop(op)) ||
+ failed(checkErrorIfScatter(op)))
return failure();
return success();
}
@@ -1710,7 +1716,7 @@ void TosaValidation::runOnOperation() {
signalPassFailure();
// do error if checks
- if (strictOpSpecAlignment && failed(applyErrorIfCheck(op)))
+ if (failed(applyErrorIfCheck(op)))
signalPassFailure();
});
}
diff --git a/mlir/test/Dialect/Tosa/level_check.mlir b/mlir/test/Dialect/Tosa/level_check.mlir
index 2d1dfbf5b45b85..33e430680db105 100644
--- a/mlir/test/Dialect/Tosa/level_check.mlir
+++ b/mlir/test/Dialect/Tosa/level_check.mlir
@@ -1390,19 +1390,19 @@ module {
func.func @test_while_loop_tensor_size_invalid(%arg0: tensor<536870912xi32>, %arg1: tensor<i32>) {
%0 = "tosa.const"() <{values = dense<0> : tensor<i32>}> : () -> tensor<i32>
// expected-error at +1 {{'tosa.while_loop' op failed level check: operand tensor size (in bytes) <= (1 << MAX_LOG2_SIZE - 1)}}
- %1:3 = tosa.while_loop (%arg2 = %0, %arg3 = %0, %arg4 = %arg0) : (tensor<i32>, tensor<i32>, tensor<536870912xi32>) -> (tensor<i32>, tensor<i32>, tensor<536870912xi32>) {
- %2 = tosa.greater_equal %arg3, %arg1 : (tensor<i32>, tensor<i32>) -> tensor<i1>
+ %1:4 = tosa.while_loop (%arg2 = %0, %arg3 = %0, %arg4 = %arg0, %arg5 = %arg1) : (tensor<i32>, tensor<i32>, tensor<536870912xi32>, tensor<i32>) -> (tensor<i32>, tensor<i32>, tensor<536870912xi32>, tensor<i32>) {
+ %2 = tosa.greater_equal %arg3, %arg5 : (tensor<i32>, tensor<i32>) -> tensor<i1>
%3 = tosa.logical_not %2 : (tensor<i1>) -> tensor<i1>
tosa.yield %2 : tensor<i1>
} do {
- ^bb0(%arg2: tensor<i32>, %arg3: tensor<i32>, %arg4: tensor<536870912xi32>):
+ ^bb0(%arg2: tensor<i32>, %arg3: tensor<i32>, %arg4: tensor<536870912xi32>, %arg5: tensor<i32>):
%2 = "tosa.const"() <{values = dense<1> : tensor<i32>}> : () -> tensor<i32>
%3 = "tosa.const"() <{values = dense<4> : tensor<1xi32>}> : () -> tensor<1xi32>
%4 = tosa.add %arg3, %2 : (tensor<i32>, tensor<i32>) -> tensor<i32>
// expected-error at +1 {{'tosa.add' op failed level check: operand tensor size (in bytes) <= (1 << MAX_LOG2_SIZE - 1)}}
%5 = tosa.add %arg4, %3 : (tensor<536870912xi32>, tensor<1xi32>) -> tensor<536870912xi32>
%6 = tosa.add %arg2, %2 : (tensor<i32>, tensor<i32>) -> tensor<i32>
- tosa.yield %6, %4, %5 : tensor<i32>, tensor<i32>, tensor<536870912xi32>
+ tosa.yield %6, %4, %5, %arg5 : tensor<i32>, tensor<i32>, tensor<536870912xi32>, tensor<i32>
}
return
}
@@ -1461,17 +1461,17 @@ module {
// CHECK-LABEL: @test_while_loop
func.func @test_while_loop(%arg0: tensor<1x1x1x1x1x1x1xf32>, %arg1: tensor<i32>) {
%0 = "tosa.const"() <{values = dense<0> : tensor<i32>}> : () -> tensor<i32>
- %1:2 = "tosa.while_loop"(%0, %arg0) ({
- ^bb0(%arg3: tensor<i32>, %arg4: tensor<1x1x1x1x1x1x1xf32>):
- %2 = "tosa.greater_equal"(%arg3, %arg1) : (tensor<i32>, tensor<i32>) -> tensor<i1>
+ %1:3 = "tosa.while_loop"(%0, %arg0, %arg1) ({
+ ^bb0(%arg3: tensor<i32>, %arg4: tensor<1x1x1x1x1x1x1xf32>, %arg5: tensor<i32>):
+ %2 = "tosa.greater_equal"(%arg3, %arg5) : (tensor<i32>, tensor<i32>) -> tensor<i1>
%3 = "tosa.logical_not"(%2) : (tensor<i1>) -> tensor<i1>
"tosa.yield"(%3) : (tensor<i1>) -> ()
}, {
- ^bb0(%arg3: tensor<i32>, %arg4: tensor<1x1x1x1x1x1x1xf32>):
+ ^bb0(%arg3: tensor<i32>, %arg4: tensor<1x1x1x1x1x1x1xf32>, %arg5: tensor<i32>):
%2 = "tosa.const"() <{values = dense<1> : tensor<i32>}> : () -> tensor<i32>
%3 = "tosa.add"(%arg3, %2) : (tensor<i32>, tensor<i32>) -> tensor<i32>
- "tosa.yield"(%3, %arg4) : (tensor<i32>, tensor<1x1x1x1x1x1x1xf32>) -> ()
- }) : (tensor<i32>, tensor<1x1x1x1x1x1x1xf32>) -> (tensor<i32>, tensor<1x1x1x1x1x1x1xf32>)
+ tosa.yield %3, %arg4, %arg5 : tensor<i32>, tensor<1x1x1x1x1x1x1xf32>, tensor<i32>
+ }) : (tensor<i32>, tensor<1x1x1x1x1x1x1xf32>, tensor<i32>) -> (tensor<i32>, tensor<1x1x1x1x1x1x1xf32>, tensor<i32>)
return
}
@@ -1720,7 +1720,7 @@ func.func @test_while_tensor_list_size(%arg0: tensor<1x1x1x1x1x1x1xf32>, %arg1:
%0 = "tosa.const"() <{values = dense<0> : tensor<1xi32>}> : () -> tensor<1xi32>
// expected-error at +1 {{'tosa.while_loop' op failed level check: length(tensor_list_shape(inputs)) <= MAX_TENSOR_LIST_SIZE (64), got 65}}
%1:65 = "tosa.while_loop"(%0, %arg0,
- %0, %0, %0, %0, %0, %0, %0, %0, %0, %0,
+ %arg1, %0, %0, %0, %0, %0, %0, %0, %0, %0,
%0, %0, %0, %0, %0, %0, %0, %0, %0, %0,
%0, %0, %0, %0, %0, %0, %0, %0, %0, %0,
%0, %0, %0, %0, %0, %0, %0, %0, %0, %0,
@@ -1737,7 +1737,7 @@ func.func @test_while_tensor_list_size(%arg0: tensor<1x1x1x1x1x1x1xf32>, %arg1:
%50: tensor<1xi32>, %51: tensor<1xi32>, %52: tensor<1xi32>, %53: tensor<1xi32>, %54: tensor<1xi32>, %55: tensor<1xi32>, %56: tensor<1xi32>, %57: tensor<1xi32>, %58: tensor<1xi32>, %59: tensor<1xi32>,
%60: tensor<1xi32>, %61: tensor<1xi32>, %62: tensor<1xi32>
):
- %2 = "tosa.greater_equal"(%arg3, %arg1) : (tensor<1xi32>, tensor<1xi32>) -> tensor<1xi1>
+ %2 = "tosa.greater_equal"(%arg3, %00) : (tensor<1xi32>, tensor<1xi32>) -> tensor<1xi1>
%3 = "tosa.logical_not"(%2) : (tensor<1xi1>) -> tensor<1xi1>
"tosa.yield"(%3) : (tensor<1xi1>) -> ()
}, {
@@ -1753,13 +1753,13 @@ func.func @test_while_tensor_list_size(%arg0: tensor<1x1x1x1x1x1x1xf32>, %arg1:
%2 = "tosa.const"() <{values = dense<1> : tensor<1xi32>}> : () -> tensor<1xi32>
%3 = "tosa.add"(%arg3, %2) : (tensor<1xi32>, tensor<1xi32>) -> tensor<1xi32>
"tosa.yield"(%3, %arg4,
- %0, %0, %0, %0, %0, %0, %0, %0, %0, %0,
- %0, %0, %0, %0, %0, %0, %0, %0, %0, %0,
- %0, %0, %0, %0, %0, %0, %0, %0, %0, %0,
- %0, %0, %0, %0, %0, %0, %0, %0, %0, %0,
- %0, %0, %0, %0, %0, %0, %0, %0, %0, %0,
- %0, %0, %0, %0, %0, %0, %0, %0, %0, %0,
- %0, %0, %0
+ %00, %01, %01, %01, %01, %01, %01, %01, %01, %01,
+ %01, %01, %01, %01, %01, %01, %01, %01, %01, %01,
+ %01, %01, %01, %01, %01, %01, %01, %01, %01, %01,
+ %01, %01, %01, %01, %01, %01, %01, %01, %01, %01,
+ %01, %01, %01, %01, %01, %01, %01, %01, %01, %01,
+ %01, %01, %01, %01, %01, %01, %01, %01, %01, %01,
+ %01, %01, %01
) : (
tensor<1xi32>, tensor<1x1x1x1x1x1x1xf32>,
tensor<1xi32>, tensor<1xi32>, tensor<1xi32>, tensor<1xi32>, tensor<1xi32>, tensor<1xi32>, tensor<1xi32>, tensor<1xi32>, tensor<1xi32>, tensor<1xi32>,
@@ -1795,38 +1795,48 @@ func.func @test_while_tensor_list_size(%arg0: tensor<1x1x1x1x1x1x1xf32>, %arg1:
// -----
-func.func @test_cond_if_max_nested_depth(%arg0: tensor<f32>, %arg1: tensor<f32>, %arg2: tensor<i1>, %arg3: tensor<i1>) -> tensor<f32> {
+func.func @test_cond_if_max_nested_depth(%arg2: tensor<i1>) -> tensor<f32> {
%0 = tosa.cond_if %arg2 : tensor<i1> -> tensor<f32> {
- %1 = tosa.cond_if %arg3 : tensor<i1>-> tensor<f32> {
- %2 = tosa.cond_if %arg2 : tensor<i1> -> tensor<f32> {
- %3 = tosa.cond_if %arg3 : tensor<i1> -> tensor<f32> {
- %4 = tosa.cond_if %arg2 : tensor<i1> -> tensor<f32> {
+ %arg4 = tosa.const values(dense<true> : tensor<i1>) : () -> tensor<i1>
+ %1 = tosa.cond_if %arg4 : tensor<i1> -> tensor<f32> {
+ %arg5 = tosa.const values(dense<true> : tensor<i1>) : () -> tensor<i1>
+ %2 = tosa.cond_if %arg5 : tensor<i1> -> tensor<f32> {
+ %arg6 = tosa.const values(dense<true> : tensor<i1>) : () -> tensor<i1>
+ %3 = tosa.cond_if %arg6 : tensor<i1> -> tensor<f32> {
+ %arg7 = tosa.const values(dense<true> : tensor<i1>) : () -> tensor<i1>
+ %4 = tosa.cond_if %arg7 : tensor<i1> -> tensor<f32> {
+ %arg8 = tosa.const values(dense<true> : tensor<i1>) : () -> tensor<i1>
// expected-error at +1 {{'tosa.cond_if' op failed level check: tosa_nesting_depth < MAX_NESTING (6), got 6}}
- %5 = tosa.cond_if %arg3 : tensor<i1> -> tensor<f32> {
- %res = tosa.sub %arg0, %arg1 : (tensor<f32>, tensor<f32>) -> tensor<f32>
+ %5 = tosa.cond_if %arg8 : tensor<i1> -> tensor<f32> {
+ %res = tosa.const values(dense<0.0> : tensor<f32>) : () -> tensor<f32>
tosa.yield %res : tensor<f32>
} else {
- tosa.yield %arg0 : tensor<f32>
+ %arg9 = tosa.const values(dense<0.0> : tensor<f32>) : () -> tensor<f32>
+ tosa.yield %arg9 : tensor<f32>
}
tosa.yield %5 : tensor<f32>
} else {
- tosa.yield %arg0 : tensor<f32>
+ %arg9 = tosa.const values(dense<0.0> : tensor<f32>) : () -> tensor<f32>
+ tosa.yield %arg9 : tensor<f32>
}
tosa.yield %4 : tensor<f32>
} else {
- tosa.yield %arg0 : tensor<f32>
+ %arg9 = tosa.const values(dense<0.0> : tensor<f32>) : () -> tensor<f32>
+ tosa.yield %arg9 : tensor<f32>
}
tosa.yield %3 : tensor<f32>
} else {
- tosa.yield %arg0 : tensor<f32>
+ %arg9 = tosa.const values(dense<0.0> : tensor<f32>) : () -> tensor<f32>
+ tosa.yield %arg9 : tensor<f32>
}
tosa.yield %2 : tensor<f32>
} else {
- tosa.yield %arg0 : tensor<f32>
+ %arg9 = tosa.const values(dense<0.0> : tensor<f32>) : () -> tensor<f32>
+ tosa.yield %arg9 : tensor<f32>
}
tosa.yield %1 : tensor<f32>
} else {
- %res = tosa.sub %arg0, %arg1 : (tensor<f32>, tensor<f32>) -> tensor<f32>
+ %res = tosa.const values(dense<0.0> : tensor<f32>) : () -> tensor<f32>
tosa.yield %res : tensor<f32>
}
return %0 : tensor<f32>
@@ -1836,54 +1846,59 @@ func.func @test_cond_if_max_nested_depth(%arg0: tensor<f32>, %arg1: tensor<f32>,
func.func @test_while_loop_max_nested_depth(%arg0: tensor<i32>) {
%init_0 = "tosa.const"() <{values = dense<0> : tensor<i32>}> : () -> tensor<i32>
- %cst_1 = "tosa.const"() <{values = dense<1> : tensor<i32>}> : () -> tensor<i32>
%1:2 = tosa.while_loop (%arg2 = %init_0, %arg3 = %arg0) : (tensor<i32>, tensor<i32>) -> (tensor<i32>, tensor<i32>) {
%2 = tosa.greater_equal %arg3, %arg2 : (tensor<i32>, tensor<i32>) -> tensor<i1>
tosa.yield %2 : tensor<i1>
} do {
^bb0(%arg2: tensor<i32>, %arg2b: tensor<i32>):
- %1:2 = tosa.while_loop (%arg4 = %init_0, %arg5 = %arg0) : (tensor<i32>, tensor<i32>) -> (tensor<i32>, tensor<i32>) {
+ %1:2 = tosa.while_loop (%arg4 = %arg2, %arg5 = %arg2b) : (tensor<i32>, tensor<i32>) -> (tensor<i32>, tensor<i32>) {
%2 = tosa.greater_equal %arg5, %arg4 : (tensor<i32>, tensor<i32>) -> tensor<i1>
tosa.yield %2 : tensor<i1>
} do {
^bb0(%arg4: tensor<i32>, %arg4b: tensor<i32>):
- %1:2 = tosa.while_loop (%arg6 = %init_0, %arg7 = %arg0) : (tensor<i32>, tensor<i32>) -> (tensor<i32>, tensor<i32>) {
+ %1:2 = tosa.while_loop (%arg6 = %arg4, %arg7 = %arg4b) : (tensor<i32>, tensor<i32>) -> (tensor<i32>, tensor<i32>) {
%2 = tosa.greater_equal %arg7, %arg6 : (tensor<i32>, tensor<i32>) -> tensor<i1>
tosa.yield %2 : tensor<i1>
} do {
^bb0(%arg6: tensor<i32>, %arg6b: tensor<i32>):
- %1:2 = tosa.while_loop (%arg8 = %init_0, %arg9 = %arg0) : (tensor<i32>, tensor<i32>) -> (tensor<i32>, tensor<i32>) {
+ %1:2 = tosa.while_loop (%arg8 = %arg6, %arg9 = %arg6b) : (tensor<i32>, tensor<i32>) -> (tensor<i32>, tensor<i32>) {
%2 = tosa.greater_equal %arg9, %arg8 : (tensor<i32>, tensor<i32>) -> tensor<i1>
tosa.yield %2 : tensor<i1>
} do {
^bb0(%arg8: tensor<i32>, %arg8b: tensor<i32>):
- %1:2 = tosa.while_loop (%arg10 = %init_0, %arg11 = %arg0) : (tensor<i32>, tensor<i32>) -> (tensor<i32>, tensor<i32>) {
+ %1:2 = tosa.while_loop (%arg10 = %arg8, %arg11 = %arg8b) : (tensor<i32>, tensor<i32>) -> (tensor<i32>, tensor<i32>) {
%2 = tosa.greater_equal %arg11, %arg10 : (tensor<i32>, tensor<i32>) -> tensor<i1>
tosa.yield %2 : tensor<i1>
} do {
^bb0(%arg10: tensor<i32>, %arg10b: tensor<i32>):
// expected-error at +1 {{'tosa.while_loop' op failed level check: tosa_nesting_depth < MAX_NESTING (6), got 6}}
- %1:2 = tosa.while_loop (%arg12 = %init_0, %arg13 = %arg0) : (tensor<i32>, tensor<i32>) -> (tensor<i32>, tensor<i32>) {
+ %1:2 = tosa.while_loop (%arg12 = %arg10, %arg13 = %arg10b) : (tensor<i32>, tensor<i32>) -> (tensor<i32>, tensor<i32>) {
%2 = tosa.greater_equal %arg13, %arg12 : (tensor<i32>, tensor<i32>) -> tensor<i1>
tosa.yield %2 : tensor<i1>
} do {
^bb0(%arg12: tensor<i32>, %arg12b: tensor<i32>):
- %3 = tosa.add %arg12, %cst_1 : (tensor<i32>, tensor<i32>) -> tensor<i32>
- tosa.yield %arg2, %3: tensor<i32>, tensor<i32>
+ %arg14 = tosa.const values(dense<1> : tensor<i32>) : () -> tensor<i32>
+ %3 = tosa.add %arg12, %arg14 : (tensor<i32>, tensor<i32>) -> tensor<i32>
+ tosa.yield %arg12, %3: tensor<i32>, tensor<i32>
}
- %3 = tosa.add %arg10, %cst_1 : (tensor<i32>, tensor<i32>) -> tensor<i32>
- tosa.yield %arg2, %3: tensor<i32>, tensor<i32>
+ %arg14 = tosa.const values(dense<1> : tensor<i32>) : () -> tensor<i32>
+ %3 = tosa.add %arg10, %arg14 : (tensor<i32>, tensor<i32>) -> tensor<i32>
+ tosa.yield %arg10, %3: tensor<i32>, tensor<i32>
}
- %3 = tosa.add %arg8, %cst_1 : (tensor<i32>, tensor<i32>) -> tensor<i32>
- tosa.yield %arg2, %3: tensor<i32>, tensor<i32>
+ %arg14 = tosa.const values(dense<1> : tensor<i32>) : () -> tensor<i32>
+ %3 = tosa.add %arg8, %arg14 : (tensor<i32>, tensor<i32>) -> tensor<i32>
+ tosa.yield %arg8, %3: tensor<i32>, tensor<i32>
}
- %3 = tosa.add %arg6, %cst_1 : (tensor<i32>, tensor<i32>) -> tensor<i32>
- tosa.yield %arg2, %3: tensor<i32>, tensor<i32>
+ %arg14 = tosa.const values(dense<1> : tensor<i32>) : () -> tensor<i32>
+ %3 = tosa.add %arg6, %arg14 : (tensor<i32>, tensor<i32>) -> tensor<i32>
+ tosa.yield %arg6, %3: tensor<i32>, tensor<i32>
}
- %3 = tosa.add %arg4, %cst_1 : (tensor<i32>, tensor<i32>) -> tensor<i32>
- tosa.yield %arg2, %3: tensor<i32>, tensor<i32>
+ %arg14 = tosa.const values(dense<1> : tensor<i32>) : () -> tensor<i32>
+ %3 = tosa.add %arg4, %arg14 : (tensor<i32>, tensor<i32>) -> tensor<i32>
+ tosa.yield %arg4, %3: tensor<i32>, tensor<i32>
}
+ %cst_1 = tosa.const values(dense<1> : tensor<i32>) : () -> tensor<i32>
%3 = tosa.add %arg2, %cst_1 : (tensor<i32>, tensor<i32>) -> tensor<i32>
tosa.yield %arg2, %3: tensor<i32>, tensor<i32>
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/235741
More information about the Mlir-commits
mailing list