diff options
| author | Aart Bik <ajcbik@google.com> | 2019-11-26 14:43:03 -0800 |
|---|---|---|
| committer | A. Unique TensorFlower <gardener@tensorflow.org> | 2019-11-26 14:43:31 -0800 |
| commit | cf97263cb8cd4f6f21f00eabb9d6a007e221eaab (patch) | |
| tree | b313b50e227d67d8c88e71f01398ff03c662efb4 /mlir/test/Dialect/VectorOps | |
| parent | 18aec3e2e5b6ded304ff2a12f807bc2ace1b3a4b (diff) | |
| download | bcm5719-llvm-cf97263cb8cd4f6f21f00eabb9d6a007e221eaab.tar.gz bcm5719-llvm-cf97263cb8cd4f6f21f00eabb9d6a007e221eaab.zip | |
[VectorOps] Add a BroadcastOp to the VectorOps dialect
PiperOrigin-RevId: 282643305
Diffstat (limited to 'mlir/test/Dialect/VectorOps')
| -rw-r--r-- | mlir/test/Dialect/VectorOps/invalid.mlir | 7 | ||||
| -rw-r--r-- | mlir/test/Dialect/VectorOps/ops.mlir | 9 |
2 files changed, 16 insertions, 0 deletions
diff --git a/mlir/test/Dialect/VectorOps/invalid.mlir b/mlir/test/Dialect/VectorOps/invalid.mlir index 60d57740e69..92e956ef29a 100644 --- a/mlir/test/Dialect/VectorOps/invalid.mlir +++ b/mlir/test/Dialect/VectorOps/invalid.mlir @@ -2,6 +2,13 @@ // ----- +func @broadcast_rank_too_high(%arg0: vector<4x4xf32>, %arg1: vector<4xf32>) { + // expected-error@+1 {{source rank higher than destination rank}} + %2 = vector.broadcast %arg0, %arg1 : vector<4x4xf32> into vector<4xf32> +} + +// ----- + func @extract_element_vector_type(%arg0: index) { // expected-error@+1 {{expected vector type}} %1 = vector.extractelement %arg0[] : index diff --git a/mlir/test/Dialect/VectorOps/ops.mlir b/mlir/test/Dialect/VectorOps/ops.mlir index a2b1ac34142..51dbc4f0435 100644 --- a/mlir/test/Dialect/VectorOps/ops.mlir +++ b/mlir/test/Dialect/VectorOps/ops.mlir @@ -22,6 +22,15 @@ func @vector_transfer_ops(%arg0: memref<?x?xf32>) { return } +// CHECK-LABEL: @vector_broadcast +func @vector_broadcast(%a: f32, %b: vector<16xf32>, %c: vector<8x16xf32>) { + // CHECK: vector.broadcast %{{.*}}, %{{.*}} : f32 into vector<16xf32> + %0 = vector.broadcast %a, %b : f32 into vector<16xf32> + // CHECK-NEXT: vector.broadcast %{{.*}}, %{{.*}} : vector<16xf32> into vector<8x16xf32> + %1 = vector.broadcast %b, %c : vector<16xf32> into vector<8x16xf32> + return +} + // CHECK-LABEL: @extractelement func @extractelement(%arg0: vector<4x8x16xf32>) -> (vector<8x16xf32>, vector<16xf32>, f32) { // CHECK: vector.extractelement {{.*}}[3 : i32] : vector<4x8x16xf32> |

