@@ -4,10 +4,8 @@ module attributes {
4
4
gpu.container_module ,
5
5
spirv.target_env = #spirv.target_env <#spirv.vce <v1.4 , [Shader , CooperativeMatrixNV , Float16 ], [SPV_KHR_storage_buffer_storage_class , SPV_NV_cooperative_matrix ]>, #spirv.resource_limits <>>} {
6
6
gpu.module @kernels {
7
- // CHECK: spirv.module @{{.*}} Logical GLSL450 {
8
7
// CHECK-LABEL: spirv.func @gpu_wmma_load_op
9
- // CHECK-SAME: {{%.*}}: !spirv.ptr<!spirv.struct<(!spirv.array<512 x f32, stride=4> [0])>, StorageBuffer> {spirv.interface_var_abi = #spirv.interface_var_abi<(0, 0)>}
10
- // CHECK-SAME: spirv.entry_point_abi = #spirv.entry_point_abi<workgroup_size = [32, 4, 1]>
8
+ // CHECK-SAME: !spirv.ptr<!spirv.struct<(!spirv.array<512 x f32, stride=4> [0])>, StorageBuffer>
11
9
gpu.func @gpu_wmma_load_op (%arg0 : memref <32 x32 xf16 , #spirv.storage_class <StorageBuffer >>) kernel
12
10
attributes {spirv.entry_point_abi = #spirv.entry_point_abi <workgroup_size = [32 , 4 , 1 ]>} {
13
11
%i = arith.constant 16 : index
@@ -27,7 +25,6 @@ module attributes {
27
25
gpu.container_module ,
28
26
spirv.target_env = #spirv.target_env <#spirv.vce <v1.4 , [Shader , CooperativeMatrixNV , Float16 ], [SPV_KHR_storage_buffer_storage_class , SPV_NV_cooperative_matrix ]>, #spirv.resource_limits <>>} {
29
27
gpu.module @kernels {
30
- // CHECK: spirv.module @{{.*}} Logical GLSL450 {
31
28
// CHECK-LABEL: spirv.func @gpu_wmma_load_op_transpose
32
29
// CHECK-SAME: {{%.*}}: !spirv.ptr<!spirv.struct<(!spirv.array<512 x f32, stride=4> [0])>, StorageBuffer> {spirv.interface_var_abi = #spirv.interface_var_abi<(0, 0)>}
33
30
// CHECK-SAME: spirv.entry_point_abi = #spirv.entry_point_abi<workgroup_size = [32, 4, 1]>
@@ -50,11 +47,9 @@ module attributes {
50
47
gpu.container_module ,
51
48
spirv.target_env = #spirv.target_env <#spirv.vce <v1.4 , [Shader , CooperativeMatrixNV , Float16 ], [SPV_KHR_storage_buffer_storage_class , SPV_NV_cooperative_matrix ]>, #spirv.resource_limits <>>} {
52
49
gpu.module @kernels {
53
- // CHECK: spirv.module @{{.*}} Logical GLSL450 {
54
50
// CHECK-LABEL: spirv.func @gpu_wmma_store_op
55
- // CHECK-SAME: {{%.*}}: !spirv.ptr<!spirv.struct<(!spirv.array<512 x f32, stride=4> [0])>, StorageBuffer> {spirv.interface_var_abi = #spirv.interface_var_abi<(0, 0)>}
56
- // CHECK-SAME: {{%.*}}: !spirv.coopmatrix<16x16xf16, Subgroup> {spirv.interface_var_abi = #spirv.interface_var_abi<(0, 1)>})
57
- // CHECK-SAME: spirv.entry_point_abi = #spirv.entry_point_abi<workgroup_size = [32, 4, 1]>
51
+ // CHECK-SAME: !spirv.ptr<!spirv.struct<(!spirv.array<512 x f32, stride=4> [0])>, StorageBuffer>
52
+ // CHECK-SAME: !spirv.coopmatrix<16x16xf16, Subgroup>
58
53
gpu.func @gpu_wmma_store_op (%arg0 : memref <32 x32 xf16 , #spirv.storage_class <StorageBuffer >>, %arg1 : !gpu.mma_matrix <16 x16 xf16 , " COp" >) kernel
59
54
attributes {spirv.entry_point_abi = #spirv.entry_point_abi <workgroup_size = [32 , 4 , 1 ]>} {
60
55
%i = arith.constant 16 : index
@@ -74,7 +69,6 @@ module attributes {
74
69
gpu.container_module ,
75
70
spirv.target_env = #spirv.target_env <#spirv.vce <v1.4 , [Shader , CooperativeMatrixNV , Float16 ], [SPV_KHR_storage_buffer_storage_class , SPV_NV_cooperative_matrix ]>, #spirv.resource_limits <>>} {
76
71
gpu.module @kernels {
77
- // CHECK: spirv.module @{{.*}} Logical GLSL450 {
78
72
// CHECK-LABEL: spirv.func @gpu_wmma_store_op_transpose
79
73
// CHECK-SAME: {{%.*}}: !spirv.ptr<!spirv.struct<(!spirv.array<512 x f32, stride=4> [0])>, StorageBuffer> {spirv.interface_var_abi = #spirv.interface_var_abi<(0, 0)>}
80
74
// CHECK-SAME: {{%.*}}: !spirv.coopmatrix<16x16xf16, Subgroup> {spirv.interface_var_abi = #spirv.interface_var_abi<(0, 1)>})
@@ -98,12 +92,10 @@ module attributes {
98
92
gpu.container_module ,
99
93
spirv.target_env = #spirv.target_env <#spirv.vce <v1.4 , [Shader , CooperativeMatrixNV , Float16 ], [SPV_KHR_storage_buffer_storage_class , SPV_NV_cooperative_matrix ]>, #spirv.resource_limits <>>} {
100
94
gpu.module @kernels {
101
- // CHECK: spirv.module @{{.*}} Logical GLSL450 {
102
95
// CHECK-LABEL: spirv.func @gpu_wmma_mma_op
103
- // CHECK-SAME: {{%.*}}: !spirv.coopmatrix<16x16xf16, Subgroup> {spirv.interface_var_abi = #spirv.interface_var_abi<(0, 0)>}
104
- // CHECK-SAME: {{%.*}}: !spirv.coopmatrix<16x16xf16, Subgroup> {spirv.interface_var_abi = #spirv.interface_var_abi<(0, 1)>}
105
- // CHECK-SAME: {{%.*}}: !spirv.coopmatrix<16x16xf16, Subgroup> {spirv.interface_var_abi = #spirv.interface_var_abi<(0, 2)>})
106
- // CHECK-SAME: spirv.entry_point_abi = #spirv.entry_point_abi<workgroup_size = [32, 4, 1]>
96
+ // CHECK-SAME: !spirv.coopmatrix<16x16xf16, Subgroup>
97
+ // CHECK-SAME: !spirv.coopmatrix<16x16xf16, Subgroup>
98
+ // CHECK-SAME: !spirv.coopmatrix<16x16xf16, Subgroup>
107
99
gpu.func @gpu_wmma_mma_op (%A : !gpu.mma_matrix <16 x16 xf16 , " AOp" >, %B : !gpu.mma_matrix <16 x16 xf16 , " BOp" >, %C : !gpu.mma_matrix <16 x16 xf16 , " COp" >) kernel
108
100
attributes {spirv.entry_point_abi = #spirv.entry_point_abi <workgroup_size = [32 , 4 , 1 ]>} {
109
101
// CHECK: {{%.*}} = spirv.NV.CooperativeMatrixMulAdd {{%.*}}, {{%.*}}, {{%.*}} : !spirv.coopmatrix<16x16xf16, Subgroup>, !spirv.coopmatrix<16x16xf16, Subgroup> -> !spirv.coopmatrix<16x16xf16, Subgroup>
@@ -120,7 +112,6 @@ module attributes {
120
112
gpu.container_module ,
121
113
spirv.target_env = #spirv.target_env <#spirv.vce <v1.4 , [Shader , CooperativeMatrixNV , Float16 ], [SPV_KHR_storage_buffer_storage_class , SPV_NV_cooperative_matrix ]>, #spirv.resource_limits <>>} {
122
114
gpu.module @kernels {
123
- // CHECK: spirv.module @{{.*}} Logical GLSL450 {
124
115
// CHECK-LABEL: spirv.func @gpu_wmma_constant_op
125
116
gpu.func @gpu_wmma_constant_op () kernel
126
117
attributes {spirv.entry_point_abi = #spirv.entry_point_abi <workgroup_size = [32 , 4 , 1 ]>} {
@@ -140,11 +131,10 @@ module attributes {
140
131
gpu.container_module ,
141
132
spirv.target_env = #spirv.target_env <#spirv.vce <v1.4 , [Shader , CooperativeMatrixNV , Float16 ], [SPV_KHR_storage_buffer_storage_class , SPV_NV_cooperative_matrix ]>, #spirv.resource_limits <>>} {
142
133
gpu.module @kernels {
143
- // CHECK: spirv.module @{{.*}} Logical GLSL450 {
144
- // CHECK-LABEL: spirv.func @gpu_wmma_elementwise_op
145
- // CHECK-SAME: {{%.*}}: !spirv.coopmatrix<16x16xf16, Subgroup> {spirv.interface_var_abi = #spirv.interface_var_abi<(0, 0)>}
146
- // CHECK-SAME: {{%.*}}: !spirv.coopmatrix<16x16xf16, Subgroup> {spirv.interface_var_abi = #spirv.interface_var_abi<(0, 1)>})
147
- gpu.func @gpu_wmma_elementwise_op (%A : !gpu.mma_matrix <16 x16 xf16 , " COp" >, %B : !gpu.mma_matrix <16 x16 xf16 , " COp" >) kernel
134
+ // CHECK-LABEL: spirv.func @gpu_wmma_elementwise_op_default
135
+ // CHECK-SAME: !spirv.coopmatrix<16x16xf16, Subgroup>
136
+ // CHECK-SAME: !spirv.coopmatrix<16x16xf16, Subgroup>
137
+ gpu.func @gpu_wmma_elementwise_op_default (%A : !gpu.mma_matrix <16 x16 xf16 , " COp" >, %B : !gpu.mma_matrix <16 x16 xf16 , " COp" >) kernel
148
138
attributes {spirv.entry_point_abi = #spirv.entry_point_abi <workgroup_size = [32 , 4 , 1 ]>} {
149
139
// CHECK: {{%.*}} = spirv.FAdd {{%.*}}, {{%.*}} : !spirv.coopmatrix<16x16xf16, Subgroup>
150
140
%C = gpu.subgroup_mma_elementwise addf %A , %B : (!gpu.mma_matrix <16 x16 xf16 , " COp" >, !gpu.mma_matrix <16 x16 xf16 , " COp" >) -> !gpu.mma_matrix <16 x16 xf16 , " COp" >
@@ -157,3 +147,24 @@ module attributes {
157
147
}
158
148
}
159
149
}
150
+
151
+ // -----
152
+
153
+ module attributes {
154
+ gpu.container_module ,
155
+ spirv.target_env = #spirv.target_env <#spirv.vce <v1.4 , [Shader , CooperativeMatrixNV , Float16 ], [SPV_KHR_storage_buffer_storage_class , SPV_NV_cooperative_matrix ]>, #spirv.resource_limits <>>} {
156
+ gpu.module @kernels {
157
+ // CHECK-LABEL: spirv.func @gpu_wmma_elementwise_op_matrix_times_scalar
158
+ // CHECK-SAME: %[[A:.+]]: !spirv.coopmatrix<16x16xf16, Subgroup>
159
+ // CHECK-SAME: %[[S:.+]]: f16
160
+ gpu.func @gpu_wmma_elementwise_op_matrix_times_scalar (%A : !gpu.mma_matrix <16 x16 xf16 , " COp" >, %scalar : f16 ) kernel
161
+ attributes {spirv.entry_point_abi = #spirv.entry_point_abi <workgroup_size = [32 , 4 , 1 ]>} {
162
+ %B = gpu.subgroup_mma_constant_matrix %scalar : !gpu.mma_matrix <16 x16 xf16 , " COp" >
163
+ // CHECK: %{{.+}} = spirv.MatrixTimesScalar %[[A]], %[[S]] : !spirv.coopmatrix<16x16xf16, Subgroup>, f16
164
+ %C = gpu.subgroup_mma_elementwise mulf %A , %B : (!gpu.mma_matrix <16 x16 xf16 , " COp" >, !gpu.mma_matrix <16 x16 xf16 , " COp" >) -> !gpu.mma_matrix <16 x16 xf16 , " COp" >
165
+ // CHECK: %{{.+}} = spirv.MatrixTimesScalar %[[A]], %[[S]] : !spirv.coopmatrix<16x16xf16, Subgroup>, f16
166
+ %D = gpu.subgroup_mma_elementwise mulf %B , %A : (!gpu.mma_matrix <16 x16 xf16 , " COp" >, !gpu.mma_matrix <16 x16 xf16 , " COp" >) -> !gpu.mma_matrix <16 x16 xf16 , " COp" >
167
+ gpu.return
168
+ }
169
+ }
170
+ }
0 commit comments