Skip to content

Commit 45db2af

Browse files
authored
Merge pull request #26 from Xilinx/tina.cleanupfoldingtests
Fix: Add tests checked that no casts are present
2 parents aa8d96a + 7921e58 commit 45db2af

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

mlir/test/Dialect/Tosa/constant-add-opt.mlir

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
// RUN: mlir-opt --split-input-file -verify-diagnostics --tosa-layerwise-constant-fold %s | FileCheck %s
22

3-
// -----
43
// Float additions
54

65
// CHECK-LABEL: @add_fold_float
76
func.func @add_fold_float() -> tensor<4xf16> {
87
// CHECK: [[RES:]] ={{.*}}tosa.const{{.*}}-1.5{{.*}}e+02, 1.9{{.*}}e+00, 0.{{0*}}e+00, 5.{{0*}}e+00
9-
// CHECK-NOT: tosa.cast
8+
// CHECK-NOT: tosa.add
109
// CHECK: return [[RES]]
1110
%0 = "tosa.const"() {value =
1211
dense<[-17.4978, 4.9882, 0.0, -0.0]> :
@@ -23,7 +22,7 @@ func.func @add_fold_float() -> tensor<4xf16> {
2322
// CHECK-LABEL: @add_fold_float_infinity_nan
2423
func.func @add_fold_float_infinity_nan() -> tensor<6xf32> {
2524
// CHECK: [[RES:]] ={{.*}}tosa.const{{.*}}0x7F800000, 0xFF800000, 0x7F800000, 0xFF800000, 0x7FC00000, 0x7FC00000
26-
// CHECK-NOT: tosa.cast
25+
// CHECK-NOT: tosa.add
2726
// CHECK: return [[RES]]
2827
%0 = "tosa.const"() {value =
2928
dense<[0x7F800000, 0xFF800000, 0x7F800000, 0xFF800000, 0x7FC00000, 0x7F800000]> :
@@ -40,7 +39,7 @@ func.func @add_fold_float_infinity_nan() -> tensor<6xf32> {
4039
// CHECK-LABEL: @add_fold_float_overflow
4140
func.func @add_fold_float_overflow() -> tensor<2xf32> {
4241
// CHECK: [[RES:]] ={{.*}}tosa.const{{.*}}0x7F800000, 0xFF800000
43-
// CHECK-NOT: tosa.cast
42+
// CHECK-NOT: tosa.add
4443
// CHECK: return [[RES]]
4544
%0 = "tosa.const"() {value =
4645
dense<[3.1e+38, -3.1e+38]> :
@@ -60,7 +59,7 @@ func.func @add_fold_float_overflow() -> tensor<2xf32> {
6059
// CHECK-LABEL: @add_fold_int
6160
func.func @add_fold_int() -> tensor<4xi32> {
6261
// CHECK: [[RES:]] ={{.*}}tosa.const{{.*}}-149, 1, 0, 5
63-
// CHECK-NOT: tosa.cast
62+
// CHECK-NOT: tosa.add
6463
// CHECK: return [[RES]]
6564
%0 = "tosa.const"() {value =
6665
dense<[-17, 4, 0, 0]> :
@@ -77,7 +76,7 @@ func.func @add_fold_int() -> tensor<4xi32> {
7776
// CHECK-LABEL: @add_fold_int_overflow
7877
func.func @add_fold_int_overflow() -> tensor<4xi32> {
7978
// CHECK: [[RES:]] ={{.*}}tosa.const{{.*}}2147483647, 2147483647, -2147483648, -2147483648
80-
// CHECK-NOT: tosa.cast
79+
// CHECK-NOT: tosa.add
8180
// CHECK: return [[RES]]
8281
%0 = "tosa.const"() {value =
8382
dense<[2147483647, 2147483640, -2147483648, -2147483640]> :
@@ -97,7 +96,7 @@ func.func @add_fold_int_overflow() -> tensor<4xi32> {
9796
// CHECK-LABEL: @add_fold_equal_args
9897
func.func @add_fold_equal_args() -> tensor<3xi32> {
9998
// CHECK: [[RES:]] ={{.*}}tosa.const{{.*}}-34, 8, 0
100-
// CHECK-NOT: tosa.cast
99+
// CHECK-NOT: tosa.add
101100
// CHECK: return [[RES]]
102101
%0 = "tosa.const"() {value =
103102
dense<[-17, 4, 0]> :
@@ -113,7 +112,7 @@ func.func @add_fold_equal_args() -> tensor<3xi32> {
113112
// CHECK-LABEL: @add_fold_int_broadcast_simple
114113
func.func @add_fold_int_broadcast_simple() -> tensor<3xi32> {
115114
// CHECK: [[RES:]] ={{.*}}tosa.const{{.*}}-29, -8, -12
116-
// CHECK-NOT: tosa.cast
115+
// CHECK-NOT: tosa.add
117116
// CHECK: return [[RES]]
118117
%0 = "tosa.const"() {value =
119118
dense<[-17, 4, 0]> :
@@ -133,7 +132,7 @@ func.func @add_fold_int_broadcast_complex() -> tensor<3x3xi32> {
133132
// CHECK-SAME{LITERAL}: [[-29, -10, -13],
134133
// CHECK-SAME{LITERAL}: [-11, 8, 5],
135134
// CHECK-SAME{LITERAL}: [7, 26, 23]]
136-
// CHECK-NOT: tosa.cast
135+
// CHECK-NOT: tosa.add
137136
// CHECK: return [[RES]]
138137
%0 = "tosa.const"() {value =
139138
dense<[[-17], [1], [19]]> :

mlir/test/Dialect/Tosa/constant-cast-opt.mlir

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// RUN: mlir-opt --split-input-file -verify-diagnostics --tosa-layerwise-constant-fold %s | FileCheck %s
22

3-
// -----
43
// Casts from float to int
54

65
// CHECK-LABEL: @cast_fold_f32_to_i1_all_none_zero

0 commit comments

Comments
 (0)