6
6
; TODO: Validation is disabled till the moment the tools in CI are updated (passes locally)
7
7
; R/UN: spirv-val %t.spv
8
8
9
- ; TODO: come up with an approach and implement reverse translation
10
- ; R/UN: llvm-spirv -r --spirv-target-env=SPV-IR %t.spv -o %t.rev.bc
11
- ; R/UN: llvm-dis %t.rev.bc
12
- ; R/UN: FileCheck < %t.rev.ll %s --check-prefix=CHECK-LLVM
9
+ ; RUN: llvm-spirv -r --spirv-target-env=SPV-IR %t.spv -o %t.rev.bc
10
+ ; RUN: llvm-dis %t.rev.bc
11
+ ; RUN: FileCheck < %t.rev.ll %s --check-prefix=CHECK-LLVM
13
12
14
13
; CHECK-SPIRV: TypeInt [[#TypeInt:]] 32 0
15
14
; CHECK-SPIRV: TypeCooperativeMatrixKHR [[#MatrixTypeInt:]] [[#TypeInt]]
@@ -21,6 +20,8 @@ target triple = "spir-unknown-unknown"
21
20
22
21
; CHECK-SPIRV: CompositeConstruct [[#MatrixTypeInt]] [[#MatrixIn:]] [[#]] {{$}}
23
22
; CHECK-SPIRV: SNegate [[#MatrixTypeInt]] [[#]] [[#MatrixIn]]
23
+ ; CHECK-LLVM: %1 = call spir_func target("spirv.CooperativeMatrixKHR", i32, 3, 12, 12, 3) @_Z26__spirv_CompositeConstructi(i32 0)
24
+ ; CHECK-LLVM: %call = call spir_func target("spirv.CooperativeMatrixKHR", i32, 3, 12, 12, 3) @_Z15__spirv_SNegatePU3AS144__spirv_CooperativeMatrixKHR__uint_3_12_12_3(target("spirv.CooperativeMatrixKHR", i32, 3, 12, 12, 3) %1)
24
25
define spir_kernel void @testSNegate (i32 %a ) #0 !kernel_arg_addr_space !10 !kernel_arg_access_qual !11 !kernel_arg_type !12 !kernel_arg_type_qual !9 !kernel_arg_base_type !12 {
25
26
%1 = tail call spir_func noundef target ("spirv.CooperativeMatrixKHR" , i32 , 3 , 12 , 12 , 3 ) @_Z26__spirv_CompositeConstructInt32 (i32 0 )
26
27
%call = call spir_func target ("spirv.CooperativeMatrixKHR" , i32 , 3 , 12 , 12 , 3 ) @_Z15__spirv_SNegate (target ("spirv.CooperativeMatrixKHR" , i32 , 3 , 12 , 12 , 3 ) %1 )
@@ -29,7 +30,8 @@ define spir_kernel void @testSNegate(i32 %a) #0 !kernel_arg_addr_space !10 !kern
29
30
30
31
; CHECK-SPIRV: CompositeConstruct [[#MatrixTypeFloat]] [[#MatrixIn:]] [[#]] {{$}}
31
32
; CHECK-SPIRV: FNegate [[#MatrixTypeFloat]] [[#]] [[#MatrixIn]]
32
- ; CHECK-LLVM: fneg
33
+ ; CHECK-LLVM: %0 = call spir_func target("spirv.CooperativeMatrixKHR", float, 3, 12, 12, 3) @_Z26__spirv_CompositeConstructf(float 0.000000e+00)
34
+ ; CHECK-LLVM: %call = call spir_func target("spirv.CooperativeMatrixKHR", float, 3, 12, 12, 3) @_Z15__spirv_FNegatePU3AS145__spirv_CooperativeMatrixKHR__float_3_12_12_3(target("spirv.CooperativeMatrixKHR", float, 3, 12, 12, 3) %0)
33
35
define spir_kernel void @testFNeg (float %a ) local_unnamed_addr #0 !kernel_arg_addr_space !2 !kernel_arg_access_qual !3 !kernel_arg_type !4 !kernel_arg_base_type !4 !kernel_arg_type_qual !9 {
34
36
entry:
35
37
%0 = tail call spir_func noundef target ("spirv.CooperativeMatrixKHR" , float , 3 , 12 , 12 , 3 ) @_Z26__spirv_CompositeConstructFloat (float 0 .000000e+00 )
40
42
; CHECK-SPIRV: CompositeConstruct [[#MatrixTypeInt]] [[#MatrixA:]] [[#]] {{$}}
41
43
; CHECK-SPIRV: CompositeConstruct [[#MatrixTypeInt]] [[#MatrixB:]] [[#]] {{$}}
42
44
; CHECK-SPIRV: IAdd [[#MatrixTypeInt]] [[#]] [[#MatrixA]] [[#MatrixB]]
45
+ ; CHECK-LLVM: %1 = call spir_func target("spirv.CooperativeMatrixKHR", i32, 3, 12, 12, 3) @_Z26__spirv_CompositeConstructi(i32 0)
46
+ ; CHECK-LLVM: %2 = call spir_func target("spirv.CooperativeMatrixKHR", i32, 3, 12, 12, 3) @_Z26__spirv_CompositeConstructi(i32 0)
47
+ ; CHECK-LLVM: %call = call spir_func target("spirv.CooperativeMatrixKHR", i32, 3, 12, 12, 3) @_Z12__spirv_IAddPU3AS144__spirv_CooperativeMatrixKHR__uint_3_12_12_3S1_(target("spirv.CooperativeMatrixKHR", i32, 3, 12, 12, 3) %1, target("spirv.CooperativeMatrixKHR", i32, 3, 12, 12, 3) %2)
43
48
define spir_kernel void @testIAdd (i32 %a , i32 %b ) #0 !kernel_arg_addr_space !4 !kernel_arg_access_qual !5 !kernel_arg_type !6 !kernel_arg_type_qual !7 !kernel_arg_base_type !6 {
44
49
%1 = tail call spir_func noundef target ("spirv.CooperativeMatrixKHR" , i32 , 3 , 12 , 12 , 3 ) @_Z26__spirv_CompositeConstructInt32 (i32 0 )
45
50
%2 = tail call spir_func noundef target ("spirv.CooperativeMatrixKHR" , i32 , 3 , 12 , 12 , 3 ) @_Z26__spirv_CompositeConstructInt32 (i32 0 )
@@ -50,6 +55,7 @@ define spir_kernel void @testIAdd(i32 %a, i32 %b) #0 !kernel_arg_addr_space !4 !
50
55
; CHECK-SPIRV: CompositeConstruct [[#MatrixTypeInt]] [[#MatrixA:]] [[#]] {{$}}
51
56
; CHECK-SPIRV: CompositeConstruct [[#MatrixTypeInt]] [[#MatrixB:]] [[#]] {{$}}
52
57
; CHECK-SPIRV: ISub [[#MatrixTypeInt]] [[#]] [[#MatrixA]] [[#MatrixB]]
58
+ ; CHECK-LLVM: %call = call spir_func target("spirv.CooperativeMatrixKHR", i32, 3, 12, 12, 3) @_Z12__spirv_ISubPU3AS144__spirv_CooperativeMatrixKHR__uint_3_12_12_3S1_(target("spirv.CooperativeMatrixKHR", i32, 3, 12, 12, 3) %1, target("spirv.CooperativeMatrixKHR", i32, 3, 12, 12, 3) %2)
53
59
define spir_kernel void @testISub (i32 %a , i32 %b ) #0 !kernel_arg_addr_space !4 !kernel_arg_access_qual !5 !kernel_arg_type !6 !kernel_arg_type_qual !7 !kernel_arg_base_type !6 {
54
60
%1 = tail call spir_func noundef target ("spirv.CooperativeMatrixKHR" , i32 , 3 , 12 , 12 , 3 ) @_Z26__spirv_CompositeConstructInt32 (i32 0 )
55
61
%2 = tail call spir_func noundef target ("spirv.CooperativeMatrixKHR" , i32 , 3 , 12 , 12 , 3 ) @_Z26__spirv_CompositeConstructInt32 (i32 0 )
@@ -60,6 +66,7 @@ define spir_kernel void @testISub(i32 %a, i32 %b) #0 !kernel_arg_addr_space !4 !
60
66
; CHECK-SPIRV: CompositeConstruct [[#MatrixTypeInt]] [[#MatrixA:]] [[#]] {{$}}
61
67
; CHECK-SPIRV: CompositeConstruct [[#MatrixTypeInt]] [[#MatrixB:]] [[#]] {{$}}
62
68
; CHECK-SPIRV: IMul [[#MatrixTypeInt]] [[#]] [[#MatrixA]] [[#MatrixB]]
69
+ ; CHECK-LLVM: %call = call spir_func target("spirv.CooperativeMatrixKHR", i32, 3, 12, 12, 3) @_Z12__spirv_IMulPU3AS144__spirv_CooperativeMatrixKHR__uint_3_12_12_3S1_(target("spirv.CooperativeMatrixKHR", i32, 3, 12, 12, 3) %1, target("spirv.CooperativeMatrixKHR", i32, 3, 12, 12, 3) %2)
63
70
define spir_kernel void @testIMul (i32 %a , i32 %b ) #0 !kernel_arg_addr_space !4 !kernel_arg_access_qual !5 !kernel_arg_type !6 !kernel_arg_type_qual !7 !kernel_arg_base_type !6 {
64
71
%1 = tail call spir_func noundef target ("spirv.CooperativeMatrixKHR" , i32 , 3 , 12 , 12 , 3 ) @_Z26__spirv_CompositeConstructInt32 (i32 0 )
65
72
%2 = tail call spir_func noundef target ("spirv.CooperativeMatrixKHR" , i32 , 3 , 12 , 12 , 3 ) @_Z26__spirv_CompositeConstructInt32 (i32 0 )
@@ -70,6 +77,7 @@ define spir_kernel void @testIMul(i32 %a, i32 %b) #0 !kernel_arg_addr_space !4 !
70
77
; CHECK-SPIRV: CompositeConstruct [[#MatrixTypeInt]] [[#MatrixA:]] [[#]] {{$}}
71
78
; CHECK-SPIRV: CompositeConstruct [[#MatrixTypeInt]] [[#MatrixB:]] [[#]] {{$}}
72
79
; CHECK-SPIRV: SDiv [[#MatrixTypeInt]] [[#]] [[#MatrixA]] [[#MatrixB]]
80
+ ; CHECK-LLVM: %call = call spir_func target("spirv.CooperativeMatrixKHR", i32, 3, 12, 12, 3) @_Z12__spirv_SDivPU3AS144__spirv_CooperativeMatrixKHR__uint_3_12_12_3S1_(target("spirv.CooperativeMatrixKHR", i32, 3, 12, 12, 3) %1, target("spirv.CooperativeMatrixKHR", i32, 3, 12, 12, 3) %2)
73
81
define void @testSDiv (i32 %a , i32 %b ) {
74
82
%1 = tail call spir_func noundef target ("spirv.CooperativeMatrixKHR" , i32 , 3 , 12 , 12 , 3 ) @_Z26__spirv_CompositeConstructInt32 (i32 0 )
75
83
%2 = tail call spir_func noundef target ("spirv.CooperativeMatrixKHR" , i32 , 3 , 12 , 12 , 3 ) @_Z26__spirv_CompositeConstructInt32 (i32 0 )
@@ -80,6 +88,7 @@ define void @testSDiv(i32 %a, i32 %b) {
80
88
; CHECK-SPIRV: CompositeConstruct [[#MatrixTypeInt]] [[#MatrixA:]] [[#]] {{$}}
81
89
; CHECK-SPIRV: CompositeConstruct [[#MatrixTypeInt]] [[#MatrixB:]] [[#]] {{$}}
82
90
; CHECK-SPIRV: UDiv [[#MatrixTypeInt]] [[#]] [[#MatrixA]] [[#MatrixB]]
91
+ ; CHECK-LLVM: %call = call spir_func target("spirv.CooperativeMatrixKHR", i32, 3, 12, 12, 3) @_Z12__spirv_UDivPU3AS144__spirv_CooperativeMatrixKHR__uint_3_12_12_3S1_(target("spirv.CooperativeMatrixKHR", i32, 3, 12, 12, 3) %1, target("spirv.CooperativeMatrixKHR", i32, 3, 12, 12, 3) %2)
83
92
define void @testUDiv (i32 %a , i32 %b ) {
84
93
%1 = tail call spir_func noundef target ("spirv.CooperativeMatrixKHR" , i32 , 3 , 12 , 12 , 3 ) @_Z26__spirv_CompositeConstructInt32 (i32 0 )
85
94
%2 = tail call spir_func noundef target ("spirv.CooperativeMatrixKHR" , i32 , 3 , 12 , 12 , 3 ) @_Z26__spirv_CompositeConstructInt32 (i32 0 )
@@ -91,44 +100,50 @@ define void @testUDiv(i32 %a, i32 %b) {
91
100
; CHECK-SPIRV: CompositeConstruct [[#MatrixTypeFloat]] [[#MatrixA:]] [[#]] {{$}}
92
101
; CHECK-SPIRV: CompositeConstruct [[#MatrixTypeFloat]] [[#MatrixB:]] [[#]] {{$}}
93
102
; CHECK-SPIRV: FAdd [[#MatrixTypeFloat]] [[#]] [[#MatrixA]] [[#MatrixB]]
103
+ ; CHECK-LLVM: %0 = call spir_func target("spirv.CooperativeMatrixKHR", float, 3, 12, 12, 3) @_Z26__spirv_CompositeConstructf(float 0.000000e+00)
104
+ ; CHECK-LLVM: %1 = call spir_func target("spirv.CooperativeMatrixKHR", float, 3, 12, 12, 3) @_Z26__spirv_CompositeConstructf(float 0.000000e+00)
105
+ ; CHECK-LLVM: %call = call spir_func target("spirv.CooperativeMatrixKHR", float, 3, 12, 12, 3) @_Z12__spirv_FAddPU3AS145__spirv_CooperativeMatrixKHR__float_3_12_12_3S1_(target("spirv.CooperativeMatrixKHR", float, 3, 12, 12, 3) %0, target("spirv.CooperativeMatrixKHR", float, 3, 12, 12, 3) %1)
94
106
define spir_kernel void @testFAdd (float %a , float %b ) local_unnamed_addr #0 !kernel_arg_addr_space !2 !kernel_arg_access_qual !3 !kernel_arg_type !4 !kernel_arg_base_type !4 !kernel_arg_type_qual !5 {
95
107
entry:
96
108
%0 = tail call spir_func noundef target ("spirv.CooperativeMatrixKHR" , float , 3 , 12 , 12 , 3 ) @_Z26__spirv_CompositeConstructFloat (float 0 .000000e+00 )
97
109
%1 = tail call spir_func noundef target ("spirv.CooperativeMatrixKHR" , float , 3 , 12 , 12 , 3 ) @_Z26__spirv_CompositeConstructFloat (float 0 .000000e+00 )
98
- %call = call spir_func target ("spirv.CooperativeMatrixKHR" , float , 3 , 12 , 12 , 3 ) @_Z12__spirv_FAdd (target ("spirv.CooperativeMatrixKHR" , float , 3 , 12 , 12 , 3 ) %0 , target ("spirv.CooperativeMatrixKHR" , float , 3 , 12 , 12 , 3 ) %1 )
110
+ %call = call spir_func target ("spirv.CooperativeMatrixKHR" , float , 3 , 12 , 12 , 3 ) @_Z12__spirv_FAdd (target ("spirv.CooperativeMatrixKHR" , float , 3 , 12 , 12 , 3 ) %0 , target ("spirv.CooperativeMatrixKHR" , float , 3 , 12 , 12 , 3 ) %1 )
99
111
ret void
100
112
}
101
113
102
114
; CHECK-SPIRV: CompositeConstruct [[#MatrixTypeFloat]] [[#MatrixA:]] [[#]] {{$}}
103
115
; CHECK-SPIRV: CompositeConstruct [[#MatrixTypeFloat]] [[#MatrixB:]] [[#]] {{$}}
104
116
; CHECK-SPIRV: FSub [[#MatrixTypeFloat]] [[#]] [[#MatrixA]] [[#MatrixB]]
117
+ ; CHECK-LLVM: %call = call spir_func target("spirv.CooperativeMatrixKHR", float, 3, 12, 12, 3) @_Z12__spirv_FSubPU3AS145__spirv_CooperativeMatrixKHR__float_3_12_12_3S1_(target("spirv.CooperativeMatrixKHR", float, 3, 12, 12, 3) %0, target("spirv.CooperativeMatrixKHR", float, 3, 12, 12, 3) %1)
105
118
define spir_kernel void @testFSub (float %a , float %b ) local_unnamed_addr #0 !kernel_arg_addr_space !2 !kernel_arg_access_qual !3 !kernel_arg_type !4 !kernel_arg_base_type !4 !kernel_arg_type_qual !5 {
106
119
entry:
107
120
%0 = tail call spir_func noundef target ("spirv.CooperativeMatrixKHR" , float , 3 , 12 , 12 , 3 ) @_Z26__spirv_CompositeConstructFloat (float 0 .000000e+00 )
108
121
%1 = tail call spir_func noundef target ("spirv.CooperativeMatrixKHR" , float , 3 , 12 , 12 , 3 ) @_Z26__spirv_CompositeConstructFloat (float 0 .000000e+00 )
109
- %call = call spir_func target ("spirv.CooperativeMatrixKHR" , float , 3 , 12 , 12 , 3 ) @_Z12__spirv_FSub (target ("spirv.CooperativeMatrixKHR" , float , 3 , 12 , 12 , 3 ) %0 , target ("spirv.CooperativeMatrixKHR" , float , 3 , 12 , 12 , 3 ) %1 )
122
+ %call = call spir_func target ("spirv.CooperativeMatrixKHR" , float , 3 , 12 , 12 , 3 ) @_Z12__spirv_FSub (target ("spirv.CooperativeMatrixKHR" , float , 3 , 12 , 12 , 3 ) %0 , target ("spirv.CooperativeMatrixKHR" , float , 3 , 12 , 12 , 3 ) %1 )
110
123
ret void
111
124
}
112
125
113
126
; CHECK-SPIRV: CompositeConstruct [[#MatrixTypeFloat]] [[#MatrixA:]] [[#]] {{$}}
114
127
; CHECK-SPIRV: CompositeConstruct [[#MatrixTypeFloat]] [[#MatrixB:]] [[#]] {{$}}
115
128
; CHECK-SPIRV: FMul [[#MatrixTypeFloat]] [[#]] [[#MatrixA]] [[#MatrixB]]
129
+ ; CHECK-LLVM: %call = call spir_func target("spirv.CooperativeMatrixKHR", float, 3, 12, 12, 3) @_Z12__spirv_FMulPU3AS145__spirv_CooperativeMatrixKHR__float_3_12_12_3S1_(target("spirv.CooperativeMatrixKHR", float, 3, 12, 12, 3) %0, target("spirv.CooperativeMatrixKHR", float, 3, 12, 12, 3) %1)
116
130
define spir_kernel void @testFMul (float %a , float %b ) local_unnamed_addr #0 !kernel_arg_addr_space !2 !kernel_arg_access_qual !3 !kernel_arg_type !4 !kernel_arg_base_type !4 !kernel_arg_type_qual !5 {
117
131
entry:
118
132
%0 = tail call spir_func noundef target ("spirv.CooperativeMatrixKHR" , float , 3 , 12 , 12 , 3 ) @_Z26__spirv_CompositeConstructFloat (float 0 .000000e+00 )
119
133
%1 = tail call spir_func noundef target ("spirv.CooperativeMatrixKHR" , float , 3 , 12 , 12 , 3 ) @_Z26__spirv_CompositeConstructFloat (float 0 .000000e+00 )
120
- %call = call spir_func target ("spirv.CooperativeMatrixKHR" , float , 3 , 12 , 12 , 3 ) @_Z12__spirv_FMul (target ("spirv.CooperativeMatrixKHR" , float , 3 , 12 , 12 , 3 ) %0 , target ("spirv.CooperativeMatrixKHR" , float , 3 , 12 , 12 , 3 ) %1 )
134
+ %call = call spir_func target ("spirv.CooperativeMatrixKHR" , float , 3 , 12 , 12 , 3 ) @_Z12__spirv_FMul (target ("spirv.CooperativeMatrixKHR" , float , 3 , 12 , 12 , 3 ) %0 , target ("spirv.CooperativeMatrixKHR" , float , 3 , 12 , 12 , 3 ) %1 )
121
135
ret void
122
136
}
123
137
124
138
; CHECK-SPIRV: CompositeConstruct [[#MatrixTypeFloat]] [[#MatrixA:]] [[#]] {{$}}
125
139
; CHECK-SPIRV: CompositeConstruct [[#MatrixTypeFloat]] [[#MatrixB:]] [[#]] {{$}}
126
140
; CHECK-SPIRV: FDiv [[#MatrixTypeFloat]] [[#]] [[#MatrixA]] [[#MatrixB]]
141
+ ; CHECK-LLVM: %call = call spir_func target("spirv.CooperativeMatrixKHR", float, 3, 12, 12, 3) @_Z12__spirv_FDivPU3AS145__spirv_CooperativeMatrixKHR__float_3_12_12_3S1_(target("spirv.CooperativeMatrixKHR", float, 3, 12, 12, 3) %0, target("spirv.CooperativeMatrixKHR", float, 3, 12, 12, 3) %1)
127
142
define spir_kernel void @testFDiv (float %a , float %b ) local_unnamed_addr #0 !kernel_arg_addr_space !2 !kernel_arg_access_qual !3 !kernel_arg_type !4 !kernel_arg_base_type !4 !kernel_arg_type_qual !5 {
128
143
entry:
129
144
%0 = tail call spir_func noundef target ("spirv.CooperativeMatrixKHR" , float , 3 , 12 , 12 , 3 ) @_Z26__spirv_CompositeConstructFloat (float 0 .000000e+00 )
130
145
%1 = tail call spir_func noundef target ("spirv.CooperativeMatrixKHR" , float , 3 , 12 , 12 , 3 ) @_Z26__spirv_CompositeConstructFloat (float 0 .000000e+00 )
131
- %call = call spir_func target ("spirv.CooperativeMatrixKHR" , float , 3 , 12 , 12 , 3 ) @_Z12__spirv_FDiv (target ("spirv.CooperativeMatrixKHR" , float , 3 , 12 , 12 , 3 ) %0 , target ("spirv.CooperativeMatrixKHR" , float , 3 , 12 , 12 , 3 ) %1 )
146
+ %call = call spir_func target ("spirv.CooperativeMatrixKHR" , float , 3 , 12 , 12 , 3 ) @_Z12__spirv_FDiv (target ("spirv.CooperativeMatrixKHR" , float , 3 , 12 , 12 , 3 ) %0 , target ("spirv.CooperativeMatrixKHR" , float , 3 , 12 , 12 , 3 ) %1 )
132
147
ret void
133
148
}
134
149
0 commit comments