@@ -62,6 +62,10 @@ func.func @const() -> () {
62
62
// CHECK: spirv.Constant dense<1.000000e+00> : tensor<2x3xf32> : !spirv.array<2 x !spirv.array<3 x f32>>
63
63
// CHECK: spirv.Constant dense<{{\[}}[1, 2, 3], [4, 5, 6]]> : tensor<2x3xi32> : !spirv.array<2 x !spirv.array<3 x i32>>
64
64
// CHECK: spirv.Constant dense<{{\[}}[1.000000e+00, 2.000000e+00, 3.000000e+00], [4.000000e+00, 5.000000e+00, 6.000000e+00]]> : tensor<2x3xf32> : !spirv.array<2 x !spirv.array<3 x f32>>
65
+ // CHECK: spirv.Constant dense<0.000000e+00> : !spirv.coopmatrix<16x16xf32, Subgroup, MatrixAcc>
66
+ // CHECK: spirv.Constant dense<4.200000e+00> : !spirv.coopmatrix<16x16xf32, Subgroup, MatrixAcc>
67
+ // CHECK: spirv.Constant dense<0> : !spirv.coopmatrix<16x16xi8, Subgroup, MatrixAcc>
68
+ // CHECK: spirv.Constant dense<4> : !spirv.coopmatrix<16x16xi8, Subgroup, MatrixAcc>
65
69
66
70
%0 = spirv.Constant true
67
71
%1 = spirv.Constant 42 : i32
@@ -73,6 +77,10 @@ func.func @const() -> () {
73
77
%7 = spirv.Constant dense <[[1 , 2 , 3 ], [4 , 5 , 6 ]]> : tensor <2 x3 xi32 > : !spirv.array <2 x !spirv.array <3 x i32 >>
74
78
%8 = spirv.Constant dense <[[1.0 , 2.0 , 3.0 ], [4.0 , 5.0 , 6.0 ]]> : tensor <2 x3 xf32 > : !spirv.array <2 x !spirv.array <3 x f32 >>
75
79
%9 = spirv.Constant [[dense <3.0 > : vector <2 xf32 >]] : !spirv.array <1 x !spirv.array <1 xvector <2 xf32 >>>
80
+ %10 = spirv.Constant dense <0.000000e+00 > : !spirv.coopmatrix <16 x16 xf32 , Subgroup , MatrixAcc >
81
+ %11 = spirv.Constant dense <4.200000e+00 > : !spirv.coopmatrix <16 x16 xf32 , Subgroup , MatrixAcc >
82
+ %12 = spirv.Constant dense <0 > : !spirv.coopmatrix <16 x16 xi8 , Subgroup , MatrixAcc >
83
+ %13 = spirv.Constant dense <4 > : !spirv.coopmatrix <16 x16 xi8 , Subgroup , MatrixAcc >
76
84
return
77
85
}
78
86
@@ -132,6 +140,31 @@ func.func @value_result_num_elements_mismatch() -> () {
132
140
133
141
// -----
134
142
143
+ func.func @coop_matrix_const_non_splat () -> () {
144
+ // expected-error @+1 {{expected a splat dense attribute for cooperative matrix constant, but found}}
145
+ %0 = spirv.Constant dense <[[1.0 , 2.0 ], [3.0 , 4.0 ]]> : !spirv.coopmatrix <2 x2 xf32 , Subgroup , MatrixAcc >
146
+ return
147
+ }
148
+
149
+ // -----
150
+
151
+ func.func @coop_matrix_const_non_dense () -> () {
152
+ // expected-error @+2 {{floating point value not valid for specified type}}
153
+ %0 = spirv.Constant 0.000000e+00 : !spirv.coopmatrix <16 x16 xf32 , Subgroup , MatrixAcc >
154
+ return
155
+ }
156
+
157
+ // -----
158
+
159
+ func.func @coop_matrix_const_wrong_type () -> () {
160
+ // expected-error @below {{unexpected decimal integer literal for a floating point value}}
161
+ // expected-note @+1 {{add a trailing dot to make the literal a float}}
162
+ %0 = spirv.Constant dense <4 > : !spirv.coopmatrix <16 x16 xf32 , Subgroup , MatrixAcc >
163
+ return
164
+ }
165
+
166
+ // -----
167
+
135
168
//===----------------------------------------------------------------------===//
136
169
// spirv.EntryPoint
137
170
//===----------------------------------------------------------------------===//
0 commit comments