Skip to content

Commit a82c3d8

Browse files
authored
Change the GCN triple at the start of optimization. (#313)
Otherwise the saved runtime has the wrong one, causing warnings.
1 parent 8dba144 commit a82c3d8

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

src/gcn.jl

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,6 @@ end
5252

5353
function finish_module!(@nospecialize(job::CompilerJob{GCNCompilerTarget}),
5454
mod::LLVM.Module, entry::LLVM.Function)
55-
# we have to fake our target early in the pipeline because Julia's optimization passes
56-
# weren't designed for a non-0 stack addrspace, and the AMDGPU target is very strict
57-
# about which addrspaces are permitted for various code patterns
58-
triple!(mod, llvm_triple(NativeCompilerTarget()))
59-
datalayout!(mod, julia_datalayout(NativeCompilerTarget()))
60-
6155
entry = invoke(finish_module!, Tuple{CompilerJob, LLVM.Module, LLVM.Function}, job, mod, entry)
6256

6357
if job.source.kernel
@@ -68,6 +62,17 @@ function finish_module!(@nospecialize(job::CompilerJob{GCNCompilerTarget}),
6862
return entry
6963
end
7064

65+
function optimize!(job::CompilerJob{GCNCompilerTarget}, mod::LLVM.Module)
66+
# we have to fake our target early in the pipeline because Julia's
67+
# optimization passes weren't designed for a non-0 stack addrspace, and the
68+
# AMDGPU target is very strict about which addrspaces are permitted for
69+
# various code patterns
70+
triple!(mod, llvm_triple(NativeCompilerTarget()))
71+
datalayout!(mod, julia_datalayout(NativeCompilerTarget()))
72+
73+
invoke(optimize!, Tuple{CompilerJob, LLVM.Module}, job, mod)
74+
end
75+
7176
# We need to do alloca rewriting (from 0 to 5) after Julia's optimization
7277
# passes because of two reasons:
7378
# 1. Debug builds call the target verifier first, which would trip if AMDGPU

0 commit comments

Comments
 (0)