diff options
| author | River Riddle <riverriddle@google.com> | 2019-10-16 22:25:23 -0700 |
|---|---|---|
| committer | A. Unique TensorFlower <gardener@tensorflow.org> | 2019-10-16 22:37:00 -0700 |
| commit | bdc250c5a744e95a7d0ddd283c6b19c564c725a5 (patch) | |
| tree | 72f0989c20b5df1e6b7a53e7c9f924e3a5ad0210 /mlir/test/Examples | |
| parent | 0e3efb32c6fc38de789d766eec05fc698c129c33 (diff) | |
| download | bcm5719-llvm-bdc250c5a744e95a7d0ddd283c6b19c564c725a5.tar.gz bcm5719-llvm-bdc250c5a744e95a7d0ddd283c6b19c564c725a5.zip | |
Fix invalid transpose in example and add proper verification.
The transpose in the example had the same result type as its input, which is incorrect.
PiperOrigin-RevId: 275186568
Diffstat (limited to 'mlir/test/Examples')
| -rw-r--r-- | mlir/test/Examples/Toy/Ch5/affine-lowering.mlir | 72 |
1 files changed, 36 insertions, 36 deletions
diff --git a/mlir/test/Examples/Toy/Ch5/affine-lowering.mlir b/mlir/test/Examples/Toy/Ch5/affine-lowering.mlir index 74617f8fbc2..07bbc22ab6e 100644 --- a/mlir/test/Examples/Toy/Ch5/affine-lowering.mlir +++ b/mlir/test/Examples/Toy/Ch5/affine-lowering.mlir @@ -3,9 +3,9 @@ func @main() { %0 = "toy.constant"() {value = dense<[[1.000000e+00, 2.000000e+00, 3.000000e+00], [4.000000e+00, 5.000000e+00, 6.000000e+00]]> : tensor<2x3xf64>} : () -> tensor<2x3xf64> - %2 = "toy.transpose"(%0) : (tensor<2x3xf64>) -> tensor<2x3xf64> - %3 = "toy.mul"(%2, %2) : (tensor<2x3xf64>, tensor<2x3xf64>) -> tensor<2x3xf64> - "toy.print"(%3) : (tensor<2x3xf64>) -> () + %2 = "toy.transpose"(%0) : (tensor<2x3xf64>) -> tensor<3x2xf64> + %3 = "toy.mul"(%2, %2) : (tensor<3x2xf64>, tensor<3x2xf64>) -> tensor<3x2xf64> + "toy.print"(%3) : (tensor<3x2xf64>) -> () "toy.return"() : () -> () } @@ -16,8 +16,8 @@ func @main() { // CHECK: [[VAL_3:%.*]] = constant 4.000000e+00 : f64 // CHECK: [[VAL_4:%.*]] = constant 5.000000e+00 : f64 // CHECK: [[VAL_5:%.*]] = constant 6.000000e+00 : f64 -// CHECK: [[VAL_6:%.*]] = alloc() : memref<2x3xf64> -// CHECK: [[VAL_7:%.*]] = alloc() : memref<2x3xf64> +// CHECK: [[VAL_6:%.*]] = alloc() : memref<3x2xf64> +// CHECK: [[VAL_7:%.*]] = alloc() : memref<3x2xf64> // CHECK: [[VAL_8:%.*]] = alloc() : memref<2x3xf64> // CHECK: affine.store [[VAL_0]], [[VAL_8]][0, 0] : memref<2x3xf64> // CHECK: affine.store [[VAL_1]], [[VAL_8]][0, 1] : memref<2x3xf64> @@ -25,41 +25,41 @@ func @main() { // CHECK: affine.store [[VAL_3]], [[VAL_8]][1, 0] : memref<2x3xf64> // CHECK: affine.store [[VAL_4]], [[VAL_8]][1, 1] : memref<2x3xf64> // CHECK: affine.store [[VAL_5]], [[VAL_8]][1, 2] : memref<2x3xf64> -// CHECK: affine.for [[VAL_9:%.*]] = 0 to 2 { -// CHECK: affine.for [[VAL_10:%.*]] = 0 to 3 { +// CHECK: affine.for [[VAL_9:%.*]] = 0 to 3 { +// CHECK: affine.for [[VAL_10:%.*]] = 0 to 2 { // CHECK: [[VAL_11:%.*]] = affine.load [[VAL_8]]{{\[}}[[VAL_10]], [[VAL_9]]] : memref<2x3xf64> -// CHECK: affine.store [[VAL_11]], [[VAL_7]]{{\[}}[[VAL_9]], [[VAL_10]]] : memref<2x3xf64> -// CHECK: affine.for [[VAL_12:%.*]] = 0 to 2 { -// CHECK: affine.for [[VAL_13:%.*]] = 0 to 3 { -// CHECK: [[VAL_14:%.*]] = affine.load [[VAL_7]]{{\[}}[[VAL_12]], [[VAL_13]]] : memref<2x3xf64> -// CHECK: [[VAL_15:%.*]] = affine.load [[VAL_7]]{{\[}}[[VAL_12]], [[VAL_13]]] : memref<2x3xf64> +// CHECK: affine.store [[VAL_11]], [[VAL_7]]{{\[}}[[VAL_9]], [[VAL_10]]] : memref<3x2xf64> +// CHECK: affine.for [[VAL_12:%.*]] = 0 to 3 { +// CHECK: affine.for [[VAL_13:%.*]] = 0 to 2 { +// CHECK: [[VAL_14:%.*]] = affine.load [[VAL_7]]{{\[}}[[VAL_12]], [[VAL_13]]] : memref<3x2xf64> +// CHECK: [[VAL_15:%.*]] = affine.load [[VAL_7]]{{\[}}[[VAL_12]], [[VAL_13]]] : memref<3x2xf64> // CHECK: [[VAL_16:%.*]] = mulf [[VAL_14]], [[VAL_15]] : f64 -// CHECK: affine.store [[VAL_16]], [[VAL_6]]{{\[}}[[VAL_12]], [[VAL_13]]] : memref<2x3xf64> -// CHECK: "toy.print"([[VAL_6]]) : (memref<2x3xf64>) -> () +// CHECK: affine.store [[VAL_16]], [[VAL_6]]{{\[}}[[VAL_12]], [[VAL_13]]] : memref<3x2xf64> +// CHECK: "toy.print"([[VAL_6]]) : (memref<3x2xf64>) -> () // CHECK: dealloc [[VAL_8]] : memref<2x3xf64> -// CHECK: dealloc [[VAL_7]] : memref<2x3xf64> -// CHECK: dealloc [[VAL_6]] : memref<2x3xf64> +// CHECK: dealloc [[VAL_7]] : memref<3x2xf64> +// CHECK: dealloc [[VAL_6]] : memref<3x2xf64> // OPT-LABEL: func @main() -// OPT: [[VAL_1:%.*]] = constant 1.000000e+00 : f64 -// OPT: [[VAL_2:%.*]] = constant 2.000000e+00 : f64 -// OPT: [[VAL_3:%.*]] = constant 3.000000e+00 : f64 -// OPT: [[VAL_4:%.*]] = constant 4.000000e+00 : f64 -// OPT: [[VAL_5:%.*]] = constant 5.000000e+00 : f64 -// OPT: [[VAL_6:%.*]] = constant 6.000000e+00 : f64 +// OPT: [[VAL_0:%.*]] = constant 1.000000e+00 : f64 +// OPT: [[VAL_1:%.*]] = constant 2.000000e+00 : f64 +// OPT: [[VAL_2:%.*]] = constant 3.000000e+00 : f64 +// OPT: [[VAL_3:%.*]] = constant 4.000000e+00 : f64 +// OPT: [[VAL_4:%.*]] = constant 5.000000e+00 : f64 +// OPT: [[VAL_5:%.*]] = constant 6.000000e+00 : f64 +// OPT: [[VAL_6:%.*]] = alloc() : memref<3x2xf64> // OPT: [[VAL_7:%.*]] = alloc() : memref<2x3xf64> -// OPT: [[VAL_8:%.*]] = alloc() : memref<2x3xf64> -// OPT: affine.store [[VAL_1]], [[VAL_8]]{{\[}}0, 0] : memref<2x3xf64> -// OPT: affine.store [[VAL_2]], [[VAL_8]]{{\[}}0, 1] : memref<2x3xf64> -// OPT: affine.store [[VAL_3]], [[VAL_8]]{{\[}}0, 2] : memref<2x3xf64> -// OPT: affine.store [[VAL_4]], [[VAL_8]]{{\[}}1, 0] : memref<2x3xf64> -// OPT: affine.store [[VAL_5]], [[VAL_8]]{{\[}}1, 1] : memref<2x3xf64> -// OPT: affine.store [[VAL_6]], [[VAL_8]]{{\[}}1, 2] : memref<2x3xf64> -// OPT: affine.for [[VAL_9:%.*]] = 0 to 2 { -// OPT: affine.for [[VAL_10:%.*]] = 0 to 3 { -// OPT: [[VAL_11:%.*]] = affine.load [[VAL_8]]{{\[}}[[VAL_10]], [[VAL_9]]] : memref<2x3xf64> -// OPT: [[VAL_12:%.*]] = mulf [[VAL_11]], [[VAL_11]] : f64 -// OPT: affine.store [[VAL_12]], [[VAL_7]]{{\[}}[[VAL_9]], [[VAL_10]]] : memref<2x3xf64> -// OPT: "toy.print"([[VAL_7]]) : (memref<2x3xf64>) -> () -// OPT: dealloc [[VAL_8]] : memref<2x3xf64> +// OPT: affine.store [[VAL_0]], [[VAL_7]][0, 0] : memref<2x3xf64> +// OPT: affine.store [[VAL_1]], [[VAL_7]][0, 1] : memref<2x3xf64> +// OPT: affine.store [[VAL_2]], [[VAL_7]][0, 2] : memref<2x3xf64> +// OPT: affine.store [[VAL_3]], [[VAL_7]][1, 0] : memref<2x3xf64> +// OPT: affine.store [[VAL_4]], [[VAL_7]][1, 1] : memref<2x3xf64> +// OPT: affine.store [[VAL_5]], [[VAL_7]][1, 2] : memref<2x3xf64> +// OPT: affine.for [[VAL_8:%.*]] = 0 to 3 { +// OPT: affine.for [[VAL_9:%.*]] = 0 to 2 { +// OPT: [[VAL_10:%.*]] = affine.load [[VAL_7]]{{\[}}[[VAL_9]], [[VAL_8]]] : memref<2x3xf64> +// OPT: [[VAL_11:%.*]] = mulf [[VAL_10]], [[VAL_10]] : f64 +// OPT: affine.store [[VAL_11]], [[VAL_6]]{{\[}}[[VAL_8]], [[VAL_9]]] : memref<3x2xf64> +// OPT: "toy.print"([[VAL_6]]) : (memref<3x2xf64>) -> () // OPT: dealloc [[VAL_7]] : memref<2x3xf64> +// OPT: dealloc [[VAL_6]] : memref<3x2xf64> |

