|
| 1 | +// RUN: enzymexlamlir-opt --enzyme-hlo-generate-td="patterns=noop_reverse" --transform-interpreter --enzyme-hlo-remove-transform %s | FileCheck %s |
| 2 | + |
| 3 | +module { |
| 4 | + func.func @main() -> tensor<8x4x3xf32> { |
| 5 | + %cst = stablehlo.constant dense<0.000000e+00> : tensor<8x4x3xf32> |
| 6 | + %1 = stablehlo.reverse %cst, dims = [2, 1] : tensor<8x4x3xf32> |
| 7 | + return %1 : tensor<8x4x3xf32> |
| 8 | + // CHECK: %cst = stablehlo.constant dense<0.000000e+00> : tensor<8x4x3xf32> |
| 9 | + // CHECK-NEXT: return %cst : tensor<8x4x3xf32> |
| 10 | + } |
| 11 | +} |
| 12 | + |
| 13 | +module { |
| 14 | + func.func @main(%arg0: tensor<8x1xf32>) -> tensor<8x4x3x1xf32> { |
| 15 | + %0 = stablehlo.broadcast_in_dim %arg0, dims = [0, 3] : (tensor<8x1xf32>) -> tensor<8x4x3x1xf32> |
| 16 | + %1 = stablehlo.reverse %0, dims = [3, 2, 0] : tensor<8x4x3x1xf32> |
| 17 | + return %1 : tensor<8x4x3x1xf32> |
| 18 | + |
| 19 | + // CHECK: %0 = stablehlo.broadcast_in_dim %arg0, dims = [0, 3] : (tensor<8x1xf32>) -> tensor<8x4x3x1xf32> |
| 20 | + // CHECK-NEXT: %1 = stablehlo.reverse %0, dims = [0] : tensor<8x4x3x1xf32> |
| 21 | + // CHECK-NEXT: return %1 : tensor<8x4x3x1xf32> |
| 22 | + } |
| 23 | +} |
| 24 | + |
| 25 | +module { |
| 26 | + func.func @main(%arg0: tensor<8x1xf32>) -> tensor<8x4x3x1xf32> { |
| 27 | + %0 = stablehlo.broadcast_in_dim %arg0, dims = [0, 3] : (tensor<8x1xf32>) -> tensor<8x4x3x1xf32> |
| 28 | + %1 = stablehlo.reverse %0, dims = [2, 0] : tensor<8x4x3x1xf32> |
| 29 | + return %1 : tensor<8x4x3x1xf32> |
| 30 | + |
| 31 | + // CHECK: %0 = stablehlo.broadcast_in_dim %arg0, dims = [0, 3] : (tensor<8x1xf32>) -> tensor<8x4x3x1xf32> |
| 32 | + // CHECK-NEXT: %1 = stablehlo.reverse %0, dims = [0] : tensor<8x4x3x1xf32> |
| 33 | + // CHECK-NEXT: return %1 : tensor<8x4x3x1xf32> |
| 34 | + } |
| 35 | +} |
| 36 | + |
| 37 | +module { |
| 38 | + func.func @main(%arg0: tensor<1x8xf32>) -> tensor<1x8xf32> { |
| 39 | + %0 = stablehlo.reverse %arg0, dims = [0, 1] : tensor<1x8xf32> |
| 40 | + return %0 : tensor<1x8xf32> |
| 41 | + |
| 42 | + // CHECK: %0 = stablehlo.reverse %arg0, dims = [1] : tensor<1x8xf32> |
| 43 | + // CHECK-NEXT: return %0 : tensor<1x8xf32> |
| 44 | + } |
| 45 | +} |
0 commit comments