Skip to content

Commit 43cc242

Browse files
authored
Add CI jobs for AMDGPU (#612)
1 parent ae993ba commit 43cc242

File tree

2 files changed

+46
-66
lines changed

2 files changed

+46
-66
lines changed

.buildkite/pipeline.yml

Lines changed: 46 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -73,28 +73,53 @@ steps:
7373
soft_fail:
7474
- exit_status: 3
7575

76-
# - label: "AMDGPU.jl"
77-
# plugins:
78-
# - JuliaCI/julia#v1:
79-
# version: "1.10"
80-
# - JuliaCI/julia-coverage#v1:
81-
# codecov: true
82-
# command: |
83-
# julia -e 'println("--- :julia: Instantiating project")
84-
# using Pkg
85-
# Pkg.develop(; path=pwd())
86-
# Pkg.develop(; name="AMDGPU")' || exit 3
76+
- label: "AMDGPU.jl"
77+
plugins:
78+
- JuliaCI/julia#v1:
79+
version: "1.10"
80+
- JuliaCI/julia-coverage#v1:
81+
codecov: true
82+
command: |
83+
julia -e 'println("--- :julia: Instantiating project")
84+
using Pkg
85+
Pkg.develop(; path=pwd())
86+
Pkg.develop(; name="AMDGPU")' || exit 3
87+
88+
julia -e 'println("+++ :julia: Running tests")
89+
using Pkg
90+
Pkg.test("AMDGPU"; coverage=true)'
91+
agents:
92+
queue: "juliagpu"
93+
rocm: "*"
94+
if: build.message !~ /\[skip tests\]/ && !build.pull_request.draft
95+
timeout_in_minutes: 120
96+
soft_fail:
97+
- exit_status: 3
8798

88-
# julia -e 'println("+++ :julia: Running tests")
89-
# using Pkg
90-
# Pkg.test("AMDGPU"; coverage=true)'
91-
# agents:
92-
# queue: "juliagpu"
93-
# rocm: "*"
94-
# if: build.message !~ /\[skip tests\]/ && !build.pull_request.draft
95-
# timeout_in_minutes: 120
96-
# soft_fail:
97-
# - exit_status: 3
99+
- label: "AMDGPU.jl 1.11 opaque pointers"
100+
plugins:
101+
- JuliaCI/julia#v1:
102+
version: "1.11"
103+
- JuliaCI/julia-coverage#v1:
104+
codecov: true
105+
command: |
106+
julia -e 'println("--- :julia: Instantiating project")
107+
using Pkg
108+
Pkg.develop(; path=pwd())
109+
Pkg.develop(; name="AMDGPU")' || exit 3
110+
111+
julia -e 'println("+++ :julia: Running tests")
112+
using Pkg
113+
Pkg.test("AMDGPU"; coverage=true)'
114+
agents:
115+
queue: "juliagpu"
116+
rocm: "*"
117+
if: build.message !~ /\[skip tests\]/ && !build.pull_request.draft
118+
timeout_in_minutes: 120
119+
soft_fail:
120+
- exit_status: 3
121+
env:
122+
JULIA_LLVM_ARGS: "-opaque-pointers"
98123

99124
- label: "Enzyme.jl"
100125
plugins:

src/gcn.jl

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -110,57 +110,12 @@ function lower_throw_extra!(mod::LLVM.Module)
110110
return changed
111111
end
112112

113-
function fix_alloca_addrspace!(fn::LLVM.Function)
114-
changed = false
115-
alloca_as = 5
116-
117-
for bb in blocks(fn)
118-
for insn in instructions(bb)
119-
if isa(insn, LLVM.AllocaInst)
120-
ty = value_type(insn)
121-
ety = eltype(ty)
122-
addrspace(ty) == alloca_as && continue
123-
124-
new_insn = nothing
125-
@dispose builder=IRBuilder() begin
126-
position!(builder, insn)
127-
_alloca = alloca!(builder, ety, name(insn))
128-
new_insn = addrspacecast!(builder, _alloca, ty)
129-
end
130-
replace_uses!(insn, new_insn)
131-
unsafe_delete!(LLVM.parent(insn), insn)
132-
end
133-
end
134-
end
135-
136-
return changed
137-
end
138-
139113
function emit_trap!(job::CompilerJob{GCNCompilerTarget}, builder, mod, inst)
140114
trap_ft = LLVM.FunctionType(LLVM.VoidType())
141115
trap = if haskey(functions(mod), "llvm.trap")
142116
functions(mod)["llvm.trap"]
143117
else
144118
LLVM.Function(mod, "llvm.trap", trap_ft)
145119
end
146-
if Base.libllvm_version < v"9"
147-
rl_ft = LLVM.FunctionType(LLVM.Int32Type(),
148-
[LLVM.Int32Type()])
149-
rl = if haskey(functions(mod), "llvm.amdgcn.readfirstlane")
150-
functions(mod)["llvm.amdgcn.readfirstlane"]
151-
else
152-
LLVM.Function(mod, "llvm.amdgcn.readfirstlane", rl_ft)
153-
end
154-
# FIXME: Early versions of the AMDGPU target fail to skip machine
155-
# blocks with certain side effects when EXEC==0, except when certain
156-
# criteria are met within said block. We emit a v_readfirstlane_b32
157-
# instruction here, as that is sufficient to trigger a skip. Without
158-
# this, the target will only attempt to do a "masked branch", which
159-
# only works on vector instructions (trap is a scalar instruction, and
160-
# therefore it is executed even when EXEC==0).
161-
rl_val = call!(builder, rl_ft, rl, [ConstantInt(Int32(32))])
162-
rl_bc = inttoptr!(builder, rl_val, LLVM.PointerType(LLVM.Int32Type()))
163-
store!(builder, rl_val, rl_bc)
164-
end
165120
call!(builder, trap_ft, trap)
166121
end

0 commit comments

Comments
 (0)