Skip to content

Commit fd9e830

Browse files
committed
Update to LLVM.jl 4
1 parent 3073525 commit fd9e830

13 files changed

+148
-139
lines changed

Manifest.toml

+41-34
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ version = "1.0.1"
88

99
[[Adapt]]
1010
deps = ["LinearAlgebra"]
11-
git-tree-sha1 = "ffcfa2d345aaee0ef3d8346a073d5dd03c983ebe"
11+
git-tree-sha1 = "84918055d15b3114ede17ac6a7182f68870c16f7"
1212
uuid = "79e6a3ab-5dfb-504d-930d-738a2a938a0e"
13-
version = "3.2.0"
13+
version = "3.3.1"
1414

1515
[[ArgTools]]
1616
uuid = "0dad84c5-d112-42e6-8d28-ef12dabb789f"
@@ -40,15 +40,15 @@ version = "0.4.1"
4040

4141
[[Compat]]
4242
deps = ["Base64", "Dates", "DelimitedFiles", "Distributed", "InteractiveUtils", "LibGit2", "Libdl", "LinearAlgebra", "Markdown", "Mmap", "Pkg", "Printf", "REPL", "Random", "SHA", "Serialization", "SharedArrays", "Sockets", "SparseArrays", "Statistics", "Test", "UUIDs", "Unicode"]
43-
git-tree-sha1 = "919c7f3151e79ff196add81d7f4e45d91bbf420b"
43+
git-tree-sha1 = "dc7dedc2c2aa9faf59a55c622760a25cbefbe941"
4444
uuid = "34da2185-b29b-5c13-b0c7-acf172513d20"
45-
version = "3.25.0"
45+
version = "3.31.0"
4646

4747
[[ConstructionBase]]
4848
deps = ["LinearAlgebra"]
49-
git-tree-sha1 = "48920211c95a6da1914a06c44ec94be70e84ffff"
49+
git-tree-sha1 = "f74e9d5388b8620b4cee35d4c5a618dd4dc547f4"
5050
uuid = "187b0558-2788-49d3-abe0-74a17ed4e7c9"
51-
version = "1.1.0"
51+
version = "1.3.0"
5252

5353
[[DataStructures]]
5454
deps = ["Compat", "InteractiveUtils", "OrderedCollections"]
@@ -79,40 +79,47 @@ uuid = "ab5a07f8-06af-567f-a878-e8bb879eba5a"
7979
version = "0.179.0+0"
8080

8181
[[ExprTools]]
82-
git-tree-sha1 = "10407a39b87f29d47ebaca8edbc75d7c302ff93e"
82+
git-tree-sha1 = "b7e3d17636b348f005f11040025ae8c6f645fe92"
8383
uuid = "e2ba6199-217a-4e67-a87a-7c52f15ade04"
84-
version = "0.1.3"
84+
version = "0.1.6"
8585

8686
[[Future]]
8787
deps = ["Random"]
8888
uuid = "9fa8497b-333b-5362-9e8d-4d0656e87820"
8989

9090
[[GPUArrays]]
91-
deps = ["AbstractFFTs", "Adapt", "LinearAlgebra", "Printf", "Random", "Serialization"]
92-
git-tree-sha1 = "f99a25fe0313121f2f9627002734c7d63b4dd3bd"
91+
deps = ["AbstractFFTs", "Adapt", "LinearAlgebra", "Printf", "Random", "Serialization", "Statistics"]
92+
git-tree-sha1 = "df5b8569904c5c10e84c640984cfff054b18c086"
9393
uuid = "0c68f7d7-f131-5f86-a1c3-88cf8149b2d7"
94-
version = "6.2.0"
94+
version = "6.4.1"
9595

9696
[[GPUCompiler]]
97-
deps = ["DataStructures", "ExprTools", "InteractiveUtils", "LLVM", "Libdl", "Logging", "Scratch", "Serialization", "TimerOutputs", "UUIDs"]
98-
git-tree-sha1 = "0bae2d5a40c54c6c680a1a223f83a3c415ec730b"
97+
deps = ["DataStructures", "ExprTools", "InteractiveUtils", "LLVM", "Libdl", "Logging", "TimerOutputs", "UUIDs"]
98+
git-tree-sha1 = "e8a09182a4440489e2e3dedff5ad3f6bbe555396"
9999
uuid = "61eb1bfa-7361-4325-ad38-22787b887f55"
100-
version = "0.11.0"
100+
version = "0.12.5"
101101

102102
[[InteractiveUtils]]
103103
deps = ["Markdown"]
104104
uuid = "b77e0a4c-d291-57a0-90e8-8db25a27a240"
105105

106106
[[JLLWrappers]]
107-
git-tree-sha1 = "a431f5f2ca3f4feef3bd7a5e94b8b8d4f2f647a0"
107+
deps = ["Preferences"]
108+
git-tree-sha1 = "642a199af8b68253517b80bd3bfd17eb4e84df6e"
108109
uuid = "692b3bcd-3c85-4b1f-b108-f13ce0eb3210"
109-
version = "1.2.0"
110+
version = "1.3.0"
110111

111112
[[LLVM]]
112-
deps = ["CEnum", "Libdl", "Printf", "Unicode"]
113-
git-tree-sha1 = "b616937c31337576360cb9fb872ec7633af7b194"
113+
deps = ["CEnum", "LLVMExtra_jll", "Libdl", "Printf", "Unicode"]
114+
git-tree-sha1 = "1b7ba36ea7aa6fa2278118951bad114fbb8359f2"
114115
uuid = "929cbde3-209d-540e-8aea-75f648917ca0"
115-
version = "3.6.0"
116+
version = "4.1.0"
117+
118+
[[LLVMExtra_jll]]
119+
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"]
120+
git-tree-sha1 = "b36c0677a0549c7d1dc8719899a4133abbfacf7d"
121+
uuid = "dad2f222-ce93-54a1-a47d-0025e8a3acab"
122+
version = "0.0.6+0"
116123

117124
[[LibCURL]]
118125
deps = ["LibCURL_jll", "MozillaCACerts_jll"]
@@ -170,14 +177,20 @@ version = "2.0.13+1"
170177
uuid = "ca575930-c2e3-43a9-ace4-1e988b2c1908"
171178

172179
[[OrderedCollections]]
173-
git-tree-sha1 = "4fa2ba51070ec13fcc7517db714445b4ab986bdf"
180+
git-tree-sha1 = "85f8e6578bf1f9ee0d11e7bb1b1456435479d47c"
174181
uuid = "bac558e1-5e72-5ebc-8fee-abe8a469f55d"
175-
version = "1.4.0"
182+
version = "1.4.1"
176183

177184
[[Pkg]]
178185
deps = ["Artifacts", "Dates", "Downloads", "LibGit2", "Libdl", "Logging", "Markdown", "Printf", "REPL", "Random", "SHA", "Serialization", "TOML", "Tar", "UUIDs", "p7zip_jll"]
179186
uuid = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
180187

188+
[[Preferences]]
189+
deps = ["TOML"]
190+
git-tree-sha1 = "00cfd92944ca9c760982747e9a1d0d5d86ab1e5a"
191+
uuid = "21216c6a-2e73-6563-6e65-726566657250"
192+
version = "1.2.2"
193+
181194
[[Printf]]
182195
deps = ["Unicode"]
183196
uuid = "de0858da-6303-5e67-8744-51eddeeeb8d7"
@@ -199,12 +212,6 @@ version = "1.1.3"
199212
[[SHA]]
200213
uuid = "ea8e919c-243c-51af-8825-aaa63cd721ce"
201214

202-
[[Scratch]]
203-
deps = ["Dates"]
204-
git-tree-sha1 = "ad4b278adb62d185bbcb6864dc24959ab0627bf6"
205-
uuid = "6c6a2e73-6563-6170-7368-637461726353"
206-
version = "1.0.3"
207-
208215
[[Serialization]]
209216
uuid = "9e88b42a-f829-5b0c-bbe9-9e923198166b"
210217

@@ -242,10 +249,10 @@ deps = ["InteractiveUtils", "Logging", "Random", "Serialization"]
242249
uuid = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
243250

244251
[[TimerOutputs]]
245-
deps = ["Printf"]
246-
git-tree-sha1 = "32cdbe6cd2d214c25a0b88f985c9e0092877c236"
252+
deps = ["ExprTools", "Printf"]
253+
git-tree-sha1 = "209a8326c4f955e2442c07b56029e88bb48299c7"
247254
uuid = "a759f4b9-e2f1-59dc-863e-4aeb61b1ea8f"
248-
version = "0.5.8"
255+
version = "0.5.12"
249256

250257
[[UUIDs]]
251258
deps = ["Random", "SHA"]
@@ -272,9 +279,9 @@ version = "1.3.0+0"
272279

273280
[[fts_jll]]
274281
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"]
275-
git-tree-sha1 = "fa3d234bbbad588979c5409eee29e7967b6ed8a6"
282+
git-tree-sha1 = "78732b942383d2cb521df8a1a0814911144e663d"
276283
uuid = "d65627f6-89bd-53e8-8ab5-8b75ff535eee"
277-
version = "1.2.7+0"
284+
version = "1.2.7+1"
278285

279286
[[hsa_rocr_jll]]
280287
deps = ["Artifacts", "Elfutils_jll", "JLLWrappers", "Libdl", "NUMA_jll", "Pkg", "Zlib_jll", "hsakmt_roct_jll"]
@@ -294,9 +301,9 @@ uuid = "8e850ede-7688-5339-a07c-302acd2aaf8d"
294301

295302
[[obstack_jll]]
296303
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"]
297-
git-tree-sha1 = "c417cbbce3efb49a309b2d478fea9df7cfe024c0"
304+
git-tree-sha1 = "1c4a6b66e934fc6db4649cb2910c72f53bbfea7e"
298305
uuid = "c88a4935-d25e-5644-aacc-5db6f1b8ef79"
299-
version = "1.1.0+0"
306+
version = "1.2.2+0"
300307

301308
[[p7zip_jll]]
302309
deps = ["Artifacts", "Libdl"]

Project.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ BinaryProvider = "0.5"
2828
CEnum = "0.2, 0.3, 0.4"
2929
GPUArrays = "6"
3030
GPUCompiler = "0.12"
31-
LLVM = "3"
31+
LLVM = "4"
3232
MacroTools = "0.5"
3333
Requires = "1"
3434
Setfield = "0.5, 0.6, 0.7"

src/device/gcn/assertion.jl

+3-3
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ end
3838
assert_counter = 0
3939

4040
@generated function rocassert_fail(::Val{msg}, ::Val{file}, ::Val{line}) where {msg, file, line}
41-
JuliaContext() do ctx
41+
Context() do ctx
4242
T_void = LLVM.VoidType(ctx)
4343
T_int32 = LLVM.Int32Type(ctx)
4444
T_pint8 = LLVM.PointerType(LLVM.Int8Type(ctx))
@@ -49,15 +49,15 @@ assert_counter = 0
4949

5050
# generate IR
5151
Builder(ctx) do builder
52-
entry = BasicBlock(llvm_f, "entry", ctx)
52+
entry = BasicBlock(llvm_f, "entry"; ctx)
5353
position!(builder, entry)
5454
global assert_counter
5555
assert_counter += 1
5656
message = globalstring_ptr!(builder, String(msg), "assert_message_$(assert_counter)")
5757
file = globalstring_ptr!(builder, String(file), "assert_file_$(assert_counter)")
5858
line = ConstantInt(T_int32, line)
5959
func = globalstring_ptr!(builder, "unknown", "assert_function_$(assert_counter)")
60-
charSize = ConstantInt(Csize_t(1), ctx)
60+
charSize = ConstantInt(Csize_t(1); ctx)
6161

6262
# invoke __assertfail and return
6363
# TODO: mark noreturn since we don't use ptxas?

src/device/gcn/atomics.jl

+10-10
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,16 @@
2121
# > that points to either the global address space or the shared address space.
2222

2323
@generated function llvm_atomic_op(::Val{binop}, ptr::LLVMPtr{T,A}, val::T) where {binop, T, A}
24-
JuliaContext() do ctx
25-
T_val = convert(LLVMType, T, ctx)
26-
T_ptr = convert(LLVMType, ptr, ctx)
24+
Context() do ctx
25+
T_val = convert(LLVMType, T; ctx)
26+
T_ptr = convert(LLVMType, ptr; ctx)
2727

2828
T_typed_ptr = LLVM.PointerType(T_val, A)
2929

3030
llvm_f, _ = create_function(T_val, [T_ptr, T_val])
3131

3232
Builder(ctx) do builder
33-
entry = BasicBlock(llvm_f, "entry", ctx)
33+
entry = BasicBlock(llvm_f, "entry"; ctx)
3434
position!(builder, entry)
3535

3636
typed_ptr = bitcast!(builder, parameters(llvm_f)[1], T_typed_ptr)
@@ -42,7 +42,7 @@
4242
ret!(builder, rv)
4343
end
4444

45-
call_function(llvm_f, T, Tuple{LLVMPtr{T,A}, T}, :((ptr,val)))
45+
call_function(llvm_f, T, Tuple{LLVMPtr{T,A}, T}, :ptr, :val)
4646
end
4747
end
4848

@@ -89,16 +89,16 @@ for T in (Int32, Int64, UInt32, UInt64)
8989
end
9090

9191
@generated function llvm_atomic_cas(ptr::LLVMPtr{T,A}, cmp::T, val::T) where {T, A}
92-
JuliaContext() do ctx
93-
T_val = convert(LLVMType, T, ctx)
94-
T_ptr = convert(LLVMType, ptr, ctx)
92+
Context() do ctx
93+
T_val = convert(LLVMType, T; ctx)
94+
T_ptr = convert(LLVMType, ptr; ctx)
9595

9696
T_typed_ptr = LLVM.PointerType(T_val, A)
9797

9898
llvm_f, _ = create_function(T_val, [T_ptr, T_val, T_val])
9999

100100
Builder(ctx) do builder
101-
entry = BasicBlock(llvm_f, "entry", ctx)
101+
entry = BasicBlock(llvm_f, "entry"; ctx)
102102
position!(builder, entry)
103103

104104
typed_ptr = bitcast!(builder, parameters(llvm_f)[1], T_typed_ptr)
@@ -112,7 +112,7 @@ end
112112
ret!(builder, rv)
113113
end
114114

115-
call_function(llvm_f, T, Tuple{LLVMPtr{T,A}, T, T}, :((ptr,cmp,val)))
115+
call_function(llvm_f, T, Tuple{LLVMPtr{T,A}, T, T}, :ptr, :cmp, :val)
116116
end
117117
end
118118

src/device/gcn/execution_control.jl

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
const completion_signal_base = _packet_offsets[findfirst(x->x==:completion_signal,_packet_names)]
44

55
@generated function _completion_signal()
6-
JuliaContext() do ctx
6+
Context() do ctx
77
T_int8 = LLVM.Int8Type(ctx)
88
T_int64 = LLVM.Int64Type(ctx)
99
_as = convert(Int, AS.Constant)
@@ -16,7 +16,7 @@ const completion_signal_base = _packet_offsets[findfirst(x->x==:completion_signa
1616

1717
# generate IR
1818
Builder(ctx) do builder
19-
entry = BasicBlock(llvm_f, "entry", ctx)
19+
entry = BasicBlock(llvm_f, "entry"; ctx)
2020
position!(builder, entry)
2121

2222
# get the kernel dispatch pointer
@@ -25,7 +25,7 @@ const completion_signal_base = _packet_offsets[findfirst(x->x==:completion_signa
2525
ptr = call!(builder, intr)
2626

2727
# load the index
28-
signal_ptr_i8 = inbounds_gep!(builder, ptr, [ConstantInt(completion_signal_base, ctx)])
28+
signal_ptr_i8 = inbounds_gep!(builder, ptr, [ConstantInt(completion_signal_base; ctx)])
2929
signal_ptr = bitcast!(builder, signal_ptr_i8, T_ptr_i64)
3030
signal = load!(builder, signal_ptr)
3131
ret!(builder, signal)

src/device/gcn/helpers.jl

+7-7
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,21 @@ _packet_names = fieldnames(HSA.KernelDispatchPacket)
33
_packet_offsets = fieldoffset.(HSA.KernelDispatchPacket, 1:length(_packet_names))
44

55
@generated function _intr(::Val{fname}, out_arg, inp_args...) where {fname,}
6-
JuliaContext() do ctx
6+
Context() do ctx
77
inp_exprs = [:( inp_args[$i] ) for i in 1:length(inp_args)]
88
inp_types = [inp_args...]
9-
out_type = convert(LLVMType, out_arg.parameters[1], ctx)
9+
out_type = convert(LLVMType, out_arg.parameters[1]; ctx)
1010

1111
# create function
1212
bool_types = map(x->x===Bool, inp_types)
1313
T_bool = LLVM.Int1Type(ctx)
14-
param_types = LLVMType[convert.(LLVMType, inp_types, Ref(ctx))...]
14+
param_types = LLVMType[convert.(LLVMType, inp_types; ctx=ctx)...]
1515
llvm_f, _ = create_function(out_type, param_types)
1616
mod = LLVM.parent(llvm_f)
1717

1818
# generate IR
1919
Builder(ctx) do builder
20-
entry = BasicBlock(llvm_f, "entry", ctx)
20+
entry = BasicBlock(llvm_f, "entry"; ctx)
2121
position!(builder, entry)
2222

2323
# call the intrinsic
@@ -28,19 +28,19 @@ _packet_offsets = fieldoffset.(HSA.KernelDispatchPacket, 1:length(_packet_names)
2828
for idx in 1:length(param_types)
2929
if bool_types[idx]
3030
attrs = parameter_attributes(intr, idx)
31-
push!(attrs, EnumAttribute("zeroext", 0, ctx))
31+
push!(attrs, EnumAttribute("zeroext", 0; ctx))
3232
end
3333
end
3434
params = map(x->bool_types[x[1]] ? trunc!(builder, x[2], T_bool) : x[2], enumerate(parameters(llvm_f)))
3535
value = call!(builder, intr, [params...])
3636
if out_arg === Type{Bool}
37-
ret!(builder, zext!(builder, value, convert(LLVMType, Bool, ctx)))
37+
ret!(builder, zext!(builder, value, convert(LLVMType, Bool; ctx)))
3838
else
3939
ret!(builder, value)
4040
end
4141
end
4242

43-
call_function(llvm_f, out_arg.parameters[1], Tuple{inp_args...}, Expr(:tuple, inp_exprs...))
43+
call_function(llvm_f, out_arg.parameters[1], Tuple{inp_args...}, inp_exprs...)
4444
end
4545
end
4646

0 commit comments

Comments
 (0)