Skip to content

Commit 519fc80

Browse files
committed
LLVM16: generated dialects
1 parent 988f595 commit 519fc80

35 files changed

+10030
-20100
lines changed

Diff for: src/Dialects/16/AMDGPU.jl

+42-118
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
module amdgpu
22

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
54
import ..Dialects: namedattribute, operandsegmentsizes
65

6+
77
"""
88
`lds_barrier`
99
@@ -25,16 +25,12 @@ function lds_barrier(; location=Location())
2525
owned_regions = Region[]
2626
successors = Block[]
2727
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,
3632
results=results,
37-
result_inference=false,
33+
result_inference=false
3834
)
3935
end
4036

@@ -67,52 +63,25 @@ order (that is, v[0] will go to arg[7:0], v[1] to arg[15:8] and so on).
6763
The negateA, negateB, and negateC flags are only supported for double-precision
6864
operations on gfx940+.
6965
"""
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, ]
9069
owned_regions = Region[]
9170
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), ]
9872
!isnothing(cbsz) && push!(attributes, namedattribute("cbsz", cbsz))
9973
!isnothing(abid) && push!(attributes, namedattribute("abid", abid))
10074
!isnothing(blgp) && push!(attributes, namedattribute("blgp", blgp))
101-
!isnothing(reducePrecision) &&
102-
push!(attributes, namedattribute("reducePrecision", reducePrecision))
75+
!isnothing(reducePrecision) && push!(attributes, namedattribute("reducePrecision", reducePrecision))
10376
!isnothing(negateA) && push!(attributes, namedattribute("negateA", negateA))
10477
!isnothing(negateB) && push!(attributes, namedattribute("negateB", negateB))
10578
!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,
11483
results=results,
115-
result_inference=false,
84+
result_inference=false
11685
)
11786
end
11887

@@ -136,37 +105,22 @@ Out of bounds atomic operations are ignored in hardware.
136105
See `amdgpu.raw_buffer_load` for a description of how the underlying
137106
instruction is constructed.
138107
"""
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())
148109
results = IR.Type[]
149-
operands = Value[value, memref, indices...]
110+
operands = Value[value, memref, indices..., ]
150111
owned_regions = Region[]
151112
successors = Block[]
152113
attributes = NamedAttribute[]
153114
!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, ]))
158116
!isnothing(boundsCheck) && push!(attributes, namedattribute("boundsCheck", boundsCheck))
159117
!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,
168122
results=results,
169-
result_inference=false,
123+
result_inference=false
170124
)
171125
end
172126

@@ -202,37 +156,22 @@ are translated to intrinsic arguments as follows:
202156
to 2 to disable bounds checks, otherwise it is 3
203157
- The cache coherency bits are off
204158
"""
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..., ]
216162
owned_regions = Region[]
217163
successors = Block[]
218164
attributes = NamedAttribute[]
219165
!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, ]))
224167
!isnothing(boundsCheck) && push!(attributes, namedattribute("boundsCheck", boundsCheck))
225168
!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,
234173
results=results,
235-
result_inference=false,
174+
result_inference=false
236175
)
237176
end
238177

@@ -256,37 +195,22 @@ components is partically completed is chipset-dependent.
256195
See `amdgpu.raw_buffer_load` for a description of how the underlying
257196
instruction is constructed.
258197
"""
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())
268199
results = IR.Type[]
269-
operands = Value[value, memref, indices...]
200+
operands = Value[value, memref, indices..., ]
270201
owned_regions = Region[]
271202
successors = Block[]
272203
attributes = NamedAttribute[]
273204
!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, ]))
278206
!isnothing(boundsCheck) && push!(attributes, namedattribute("boundsCheck", boundsCheck))
279207
!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,
288212
results=results,
289-
result_inference=false,
213+
result_inference=false
290214
)
291215
end
292216

0 commit comments

Comments
 (0)