1
1
module amdgpu
2
2
3
- import ... IR:
4
- IR, NamedAttribute, Value, Location, Block, Region, Attribute, context, IndexType
3
+ import ... IR: IR, NamedAttribute, Value, Location, Block, Region, Attribute, context, IndexType
5
4
import .. Dialects: namedattribute, operandsegmentsizes
6
5
6
+
7
7
"""
8
8
`lds_barrier`
9
9
@@ -25,16 +25,12 @@ function lds_barrier(; location=Location())
25
25
owned_regions = Region[]
26
26
successors = Block[]
27
27
attributes = NamedAttribute[]
28
-
29
- return IR. create_operation (
30
- " amdgpu.lds_barrier" ,
31
- location;
32
- operands,
33
- owned_regions,
34
- successors,
35
- attributes,
28
+
29
+ IR. create_operation (
30
+ " amdgpu.lds_barrier" , location;
31
+ operands, owned_regions, successors, attributes,
36
32
results= results,
37
- result_inference= false ,
33
+ result_inference= false
38
34
)
39
35
end
40
36
@@ -67,52 +63,25 @@ order (that is, v[0] will go to arg[7:0], v[1] to arg[15:8] and so on).
67
63
The negateA, negateB, and negateC flags are only supported for double-precision
68
64
operations on gfx940+.
69
65
"""
70
- function mfma (
71
- sourceA:: Value ,
72
- sourceB:: Value ,
73
- destC:: Value ;
74
- destD:: IR.Type ,
75
- m,
76
- n,
77
- k,
78
- blocks,
79
- cbsz= nothing ,
80
- abid= nothing ,
81
- blgp= nothing ,
82
- reducePrecision= nothing ,
83
- negateA= nothing ,
84
- negateB= nothing ,
85
- negateC= nothing ,
86
- location= Location (),
87
- )
88
- results = IR. Type[destD,]
89
- operands = Value[sourceA, sourceB, destC]
66
+ function mfma (sourceA:: Value , sourceB:: Value , destC:: Value ; destD:: IR.Type , m, n, k, blocks, cbsz= nothing , abid= nothing , blgp= nothing , reducePrecision= nothing , negateA= nothing , negateB= nothing , negateC= nothing , location= Location ())
67
+ results = IR. Type[destD, ]
68
+ operands = Value[sourceA, sourceB, destC, ]
90
69
owned_regions = Region[]
91
70
successors = Block[]
92
- attributes = NamedAttribute[
93
- namedattribute (" m" , m),
94
- namedattribute (" n" , n),
95
- namedattribute (" k" , k),
96
- namedattribute (" blocks" , blocks),
97
- ]
71
+ attributes = NamedAttribute[namedattribute (" m" , m), namedattribute (" n" , n), namedattribute (" k" , k), namedattribute (" blocks" , blocks), ]
98
72
! isnothing (cbsz) && push! (attributes, namedattribute (" cbsz" , cbsz))
99
73
! isnothing (abid) && push! (attributes, namedattribute (" abid" , abid))
100
74
! isnothing (blgp) && push! (attributes, namedattribute (" blgp" , blgp))
101
- ! isnothing (reducePrecision) &&
102
- push! (attributes, namedattribute (" reducePrecision" , reducePrecision))
75
+ ! isnothing (reducePrecision) && push! (attributes, namedattribute (" reducePrecision" , reducePrecision))
103
76
! isnothing (negateA) && push! (attributes, namedattribute (" negateA" , negateA))
104
77
! isnothing (negateB) && push! (attributes, namedattribute (" negateB" , negateB))
105
78
! isnothing (negateC) && push! (attributes, namedattribute (" negateC" , negateC))
106
-
107
- return IR. create_operation (
108
- " amdgpu.mfma" ,
109
- location;
110
- operands,
111
- owned_regions,
112
- successors,
113
- attributes,
79
+
80
+ IR. create_operation (
81
+ " amdgpu.mfma" , location;
82
+ operands, owned_regions, successors, attributes,
114
83
results= results,
115
- result_inference= false ,
84
+ result_inference= false
116
85
)
117
86
end
118
87
@@ -136,37 +105,22 @@ Out of bounds atomic operations are ignored in hardware.
136
105
See `amdgpu.raw_buffer_load` for a description of how the underlying
137
106
instruction is constructed.
138
107
"""
139
- function raw_buffer_atomic_fadd (
140
- value:: Value ,
141
- memref:: Value ,
142
- indices:: Vector{Value} ,
143
- sgprOffset= nothing :: Union{Nothing,Value} ;
144
- boundsCheck= nothing ,
145
- indexOffset= nothing ,
146
- location= Location (),
147
- )
108
+ function raw_buffer_atomic_fadd (value:: Value , memref:: Value , indices:: Vector{Value} , sgprOffset= nothing :: Union{Nothing, Value} ; boundsCheck= nothing , indexOffset= nothing , location= Location ())
148
109
results = IR. Type[]
149
- operands = Value[value, memref, indices... ]
110
+ operands = Value[value, memref, indices... , ]
150
111
owned_regions = Region[]
151
112
successors = Block[]
152
113
attributes = NamedAttribute[]
153
114
! isnothing (sgprOffset) && push! (operands, sgprOffset)
154
- push! (
155
- attributes,
156
- operandsegmentsizes ([1 , 1 , length (indices), (sgprOffset == nothing ) ? 0 : 1 ]),
157
- )
115
+ push! (attributes, operandsegmentsizes ([1 , 1 , length (indices), isnothing (sgprOffset) ? 0 : 1 , ]))
158
116
! isnothing (boundsCheck) && push! (attributes, namedattribute (" boundsCheck" , boundsCheck))
159
117
! isnothing (indexOffset) && push! (attributes, namedattribute (" indexOffset" , indexOffset))
160
-
161
- return IR. create_operation (
162
- " amdgpu.raw_buffer_atomic_fadd" ,
163
- location;
164
- operands,
165
- owned_regions,
166
- successors,
167
- attributes,
118
+
119
+ IR. create_operation (
120
+ " amdgpu.raw_buffer_atomic_fadd" , location;
121
+ operands, owned_regions, successors, attributes,
168
122
results= results,
169
- result_inference= false ,
123
+ result_inference= false
170
124
)
171
125
end
172
126
@@ -202,37 +156,22 @@ are translated to intrinsic arguments as follows:
202
156
to 2 to disable bounds checks, otherwise it is 3
203
157
- The cache coherency bits are off
204
158
"""
205
- function raw_buffer_load (
206
- memref:: Value ,
207
- indices:: Vector{Value} ,
208
- sgprOffset= nothing :: Union{Nothing,Value} ;
209
- value:: IR.Type ,
210
- boundsCheck= nothing ,
211
- indexOffset= nothing ,
212
- location= Location (),
213
- )
214
- results = IR. Type[value,]
215
- operands = Value[memref, indices... ]
159
+ function raw_buffer_load (memref:: Value , indices:: Vector{Value} , sgprOffset= nothing :: Union{Nothing, Value} ; value:: IR.Type , boundsCheck= nothing , indexOffset= nothing , location= Location ())
160
+ results = IR. Type[value, ]
161
+ operands = Value[memref, indices... , ]
216
162
owned_regions = Region[]
217
163
successors = Block[]
218
164
attributes = NamedAttribute[]
219
165
! isnothing (sgprOffset) && push! (operands, sgprOffset)
220
- push! (
221
- attributes,
222
- operandsegmentsizes ([1 , length (indices), (sgprOffset == nothing ) ? 0 : 1 ]),
223
- )
166
+ push! (attributes, operandsegmentsizes ([1 , length (indices), isnothing (sgprOffset) ? 0 : 1 , ]))
224
167
! isnothing (boundsCheck) && push! (attributes, namedattribute (" boundsCheck" , boundsCheck))
225
168
! isnothing (indexOffset) && push! (attributes, namedattribute (" indexOffset" , indexOffset))
226
-
227
- return IR. create_operation (
228
- " amdgpu.raw_buffer_load" ,
229
- location;
230
- operands,
231
- owned_regions,
232
- successors,
233
- attributes,
169
+
170
+ IR. create_operation (
171
+ " amdgpu.raw_buffer_load" , location;
172
+ operands, owned_regions, successors, attributes,
234
173
results= results,
235
- result_inference= false ,
174
+ result_inference= false
236
175
)
237
176
end
238
177
@@ -256,37 +195,22 @@ components is partically completed is chipset-dependent.
256
195
See `amdgpu.raw_buffer_load` for a description of how the underlying
257
196
instruction is constructed.
258
197
"""
259
- function raw_buffer_store (
260
- value:: Value ,
261
- memref:: Value ,
262
- indices:: Vector{Value} ,
263
- sgprOffset= nothing :: Union{Nothing,Value} ;
264
- boundsCheck= nothing ,
265
- indexOffset= nothing ,
266
- location= Location (),
267
- )
198
+ function raw_buffer_store (value:: Value , memref:: Value , indices:: Vector{Value} , sgprOffset= nothing :: Union{Nothing, Value} ; boundsCheck= nothing , indexOffset= nothing , location= Location ())
268
199
results = IR. Type[]
269
- operands = Value[value, memref, indices... ]
200
+ operands = Value[value, memref, indices... , ]
270
201
owned_regions = Region[]
271
202
successors = Block[]
272
203
attributes = NamedAttribute[]
273
204
! isnothing (sgprOffset) && push! (operands, sgprOffset)
274
- push! (
275
- attributes,
276
- operandsegmentsizes ([1 , 1 , length (indices), (sgprOffset == nothing ) ? 0 : 1 ]),
277
- )
205
+ push! (attributes, operandsegmentsizes ([1 , 1 , length (indices), isnothing (sgprOffset) ? 0 : 1 , ]))
278
206
! isnothing (boundsCheck) && push! (attributes, namedattribute (" boundsCheck" , boundsCheck))
279
207
! isnothing (indexOffset) && push! (attributes, namedattribute (" indexOffset" , indexOffset))
280
-
281
- return IR. create_operation (
282
- " amdgpu.raw_buffer_store" ,
283
- location;
284
- operands,
285
- owned_regions,
286
- successors,
287
- attributes,
208
+
209
+ IR. create_operation (
210
+ " amdgpu.raw_buffer_store" , location;
211
+ operands, owned_regions, successors, attributes,
288
212
results= results,
289
- result_inference= false ,
213
+ result_inference= false
290
214
)
291
215
end
292
216
0 commit comments