File tree Expand file tree Collapse file tree 2 files changed +4
-4
lines changed
lib/Dialect/Tosa/Transforms Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -586,9 +586,8 @@ struct TosaFoldConstantReshape
586
586
// Check that we can apply folding
587
587
auto preCondCheck =
588
588
notifyIfNoTosaDenseConstantTensor (inputTensor, op, rewriter);
589
- if (failed (preCondCheck)) {
589
+ if (failed (preCondCheck))
590
590
return preCondCheck;
591
- }
592
591
593
592
// Extract the tensor values
594
593
DenseElementsAttr inputValues;
@@ -1756,9 +1755,9 @@ void mlir::tosa::populateTosaFoldConstantPatterns(
1756
1755
bool foldSplatOrSingleUseOnly,
1757
1756
bool enableIntCastFolding) {
1758
1757
1759
- patterns.add <TosaFoldConstantReshape>(ctx, foldSplatOrSingleUseOnly);
1760
1758
patterns.add <TosaFoldConstantTranspose>(ctx, foldSplatOrSingleUseOnly);
1761
1759
patterns.add <TosaFoldConstantReciprocal>(ctx, foldSplatOrSingleUseOnly);
1760
+ patterns.add <TosaFoldConstantReshape>(ctx, foldSplatOrSingleUseOnly);
1762
1761
patterns.add <TosaFoldConstantRSQRT>(ctx, foldSplatOrSingleUseOnly);
1763
1762
patterns.add <TosaFoldConstantLogicalNot>(ctx, foldSplatOrSingleUseOnly);
1764
1763
patterns.add <TosaFoldConstantPow>(ctx, foldSplatOrSingleUseOnly);
Original file line number Diff line number Diff line change 1
1
// RUN: mlir-opt --split-input-file --tosa-layerwise-constant-fold %s | FileCheck %s
2
2
// RUN: mlir-opt --split-input-file --tosa-layerwise-constant-fold="fold-splat-or-single-use-only=0" %s | FileCheck %s --check-prefix CHECK-MULTI
3
+
3
4
// CHECK-LABEL: @reshape_single_user
4
5
func.func @reshape_single_user () -> tensor <1 x2 xf32 > {
5
6
// CHECK: %[[RES:.*]] = "tosa.const"{{.*}}-> tensor<1x2xf32>
@@ -9,7 +10,7 @@ func.func @reshape_single_user() -> tensor<1x2xf32> {
9
10
return %1 : tensor <1 x2 xf32 >
10
11
}
11
12
12
- // CHECK-LABEL: @reshape_multi_user
13
+ // CHECK-LABEL: @reshape_multi_user_splat
13
14
func.func @reshape_multi_user_splat () -> (tensor <1 x2 xf32 >, tensor <2 xf32 >) {
14
15
// CHECK-DAG: %[[RES:.*]] = "tosa.const"{{.*}}-> tensor<2xf32>
15
16
// CHECK-DAG: %[[RESHAPED:.*]] = "tosa.const"{{.*}}-> tensor<1x2xf32>
You can’t perform that action at this time.
0 commit comments