Skip to content

Commit 148e1ec

Browse files
committed
Add more tests
1 parent bd56160 commit 148e1ec

File tree

1 file changed

+49
-7
lines changed

1 file changed

+49
-7
lines changed

mlir/test/Dialect/Linalg/invalid.mlir

Lines changed: 49 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -455,11 +455,23 @@ func.func @map_input_output_shape_mismatch(
455455

456456
// -----
457457

458-
func.func @map_no_operands(
458+
func.func @map_no_operands1() {
459+
// expected-error @+1 {{'linalg.map' op requires one region}}
460+
linalg.map { arith.addf }
461+
}
462+
463+
// -----
464+
465+
func.func @map_no_operands2() {
466+
// expected-error @+1 {{'linalg.map' op requires one region}}
467+
"linalg.map"() : () -> ()
468+
}
469+
470+
// -----
471+
472+
func.func @map_no_operands3(
459473
%lhs: tensor<64xf32>, %rhs: tensor<64xf32>, %init: tensor<64xf32>)
460474
-> tensor<64xf32> {
461-
// This must not crash the parser.
462-
linalg.map { arith.addf }
463475
// expected-error @+1 {{cannot name an operation with no results}}
464476
%add = linalg.map { arith.addf }
465477
func.return %add : tensor<64xf32>
@@ -688,9 +700,23 @@ func.func @transpose_input_init_rank_mismatch(%input: tensor<16x32xf32>,
688700

689701
// -----
690702

691-
func.func @transpose_no_operands() -> tensor<32x64x16xf32> {
692-
// This must not crash the parser.
703+
func.func @transpose_no_operands1() {
704+
// expected-error @+1 {{'linalg.transpose' op expected 2 operands, but found 0}}
693705
linalg.transpose permutation = [1, 0, 2]
706+
}
707+
708+
// -----
709+
710+
func.func @transpose_no_operands2() {
711+
// expected-error @+1 {{'linalg.transpose' op expected 2 operands, but found 0}}
712+
"linalg.transpose"() <{permutation = array<i64: 1, 0, 2>}> ({
713+
^bb0:
714+
}) : () -> ()
715+
}
716+
717+
// -----
718+
719+
func.func @transpose_no_operands3() -> tensor<32x64x16xf32> {
694720
// expected-error @+1 {{cannot name an operation with no results}}
695721
%transpose = linalg.transpose permutation = [1, 0, 2]
696722
func.return %transpose : tensor<32x64x16xf32>
@@ -747,11 +773,27 @@ func.func @broadcast_size_1_extension_not_supported(
747773
dimensions = [1]
748774
func.return %bcast : tensor<4x?x16xf32>
749775
}
776+
750777
// -----
751778

752-
func.func @broadcast_no_operands()
753-
-> tensor<4x?x16xf32> {
779+
func.func @broadcast_no_operands1() {
780+
// expected-error @+1 {{'linalg.broadcast' op expected 2 operands, but found 0}}
754781
linalg.broadcast dimensions = [1]
782+
}
783+
784+
// -----
785+
786+
func.func @broadcast_no_operands2() {
787+
// expected-error @+1 {{'linalg.broadcast' op expected 2 operands, but found 0}}
788+
"linalg.broadcast"() <{dimensions = array<i64: 1>}> ({
789+
^bb0:
790+
}) : () -> ()
791+
}
792+
793+
// -----
794+
795+
func.func @broadcast_no_operands3()
796+
-> tensor<4x?x16xf32> {
755797
// expected-error @+1 {{cannot name an operation with no results}}
756798
%broadcast = linalg.broadcast dimensions = [1]
757799
func.return %broadcast : tensor<32x64x16xf32>

0 commit comments

Comments
 (0)