Skip to content

Commit

Permalink
Drop <1.10.
Browse files Browse the repository at this point in the history
  • Loading branch information
maleadt committed Jul 13, 2024
1 parent 85316c7 commit e1c9f4a
Show file tree
Hide file tree
Showing 15 changed files with 99 additions and 337 deletions.
52 changes: 26 additions & 26 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ steps:
- label: "CUDA.jl"
plugins:
- JuliaCI/julia#v1:
version: 1.8
version: "1.10"
- JuliaCI/julia-coverage#v1:
codecov: true
command: |
Expand All @@ -25,7 +25,7 @@ steps:
- label: "oneAPI.jl"
plugins:
- JuliaCI/julia#v1:
version: 1.8
version: "1.10"
- JuliaCI/julia-coverage#v1:
codecov: true
command: |
Expand All @@ -52,7 +52,7 @@ steps:
- label: "Metal.jl"
plugins:
- JuliaCI/julia#v1:
version: 1.8
version: "1.10"
- JuliaCI/julia-coverage#v1:
codecov: true
command: |
Expand All @@ -73,33 +73,33 @@ steps:
soft_fail:
- exit_status: 3

# - label: "AMDGPU.jl"
# plugins:
# - JuliaCI/julia#v1:
# version: 1.8
# - JuliaCI/julia-coverage#v1:
# codecov: true
# command: |
# julia -e 'println("--- :julia: Instantiating project")
# using Pkg
# Pkg.develop(; path=pwd())
# Pkg.develop(; name="AMDGPU")' || exit 3
#
# julia -e 'println("+++ :julia: Running tests")
# using Pkg
# Pkg.test("AMDGPU"; coverage=true)'
# agents:
# queue: "juliagpu"
# rocm: "*"
# if: build.message !~ /\[skip tests\]/ && !build.pull_request.draft
# timeout_in_minutes: 120
# soft_fail:
# - exit_status: 3
- label: "AMDGPU.jl"
plugins:
- JuliaCI/julia#v1:
version: "1.10"
- JuliaCI/julia-coverage#v1:
codecov: true
command: |
julia -e 'println("--- :julia: Instantiating project")
using Pkg
Pkg.develop(; path=pwd())
Pkg.develop(; name="AMDGPU")' || exit 3
julia -e 'println("+++ :julia: Running tests")
using Pkg
Pkg.test("AMDGPU"; coverage=true)'
agents:
queue: "juliagpu"
rocm: "*"
if: build.message !~ /\[skip tests\]/ && !build.pull_request.draft
timeout_in_minutes: 120
soft_fail:
- exit_status: 3

- label: "Enzyme.jl"
plugins:
- JuliaCI/julia#v1:
version: 1.8
version: "1.10"
- JuliaCI/julia-coverage#v1:
codecov: true
command: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
strategy:
fail-fast: false
matrix:
version: ['1.8', '1.9', '1.10', 'pre'] # 'nightly'
version: ['1.10', 'pre'] # 'nightly'
os: [ubuntu-latest, macOS-latest, windows-latest]
arch: [x64]
llvm_args: ['']
Expand Down
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "GPUCompiler"
uuid = "61eb1bfa-7361-4325-ad38-22787b887f55"
authors = ["Tim Besard <[email protected]>"]
version = "0.26.7"
version = "0.27.0"

[deps]
ExprTools = "e2ba6199-217a-4e67-a87a-7c52f15ade04"
Expand All @@ -28,4 +28,4 @@ Scratch = "1"
Serialization = "1"
TOML = "1"
TimerOutputs = "0.5"
julia = "1.8"
julia = "1.10"
2 changes: 1 addition & 1 deletion src/GPUCompiler.jl
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ _precompile_()


compile_cache = "" # defined in __init__()
const pkgver = @static VERSION > v"1.9" ? Base.pkgversion(GPUCompiler) : nothing
const pkgver = Base.pkgversion(GPUCompiler)

function __init__()
STDERR_HAS_COLOR[] = get(stderr, :color, false)
Expand Down
61 changes: 14 additions & 47 deletions src/driver.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,52 +19,22 @@ export JuliaContext
# unique context on all other versions. Once we only support Julia 1.9, we'll deprecate
# this helper to a regular `Context()` call.
function JuliaContext(; opaque_pointers=nothing)
if VERSION >= v"1.9.0-DEV.516"
# Julia 1.9 knows how to deal with arbitrary contexts,
# and uses ORC's thread safe versions.
ctx = ThreadSafeContext(; opaque_pointers)
elseif VERSION >= v"1.9.0-DEV.115"
# Julia 1.9 knows how to deal with arbitrary contexts
ctx = Context(; opaque_pointers)
else
# earlier versions of Julia claim so, but actually use a global context
isboxed_ref = Ref{Bool}()
typ = LLVMType(ccall(:jl_type_to_llvm, LLVM.API.LLVMTypeRef,
(Any, Ptr{Bool}), Any, isboxed_ref))
ctx = context(typ)
if opaque_pointers !== nothing && supports_typed_pointers(ctx) !== !opaque_pointers
error("Cannot use $(opaque_pointers ? "opaque" : "typed") pointers, as the context has already been configured to use $(supports_typed_pointers(ctx) ? "typed" : "opaque") pointers, and this version of Julia does not support changing that.")
end
end

ctx
# XXX: remove
ThreadSafeContext(; opaque_pointers)
end
function JuliaContext(f; kwargs...)
if VERSION >= v"1.9.0-DEV.516"
ts_ctx = JuliaContext(; kwargs...)
# for now, also activate the underlying context
# XXX: this is wrong; we can't expose the underlying LLVM context, but should
# instead always go through the callback in order to unlock it properly.
# rework this once we depend on Julia 1.9 or later.
ctx = context(ts_ctx)
activate(ctx)
try
f(ctx)
finally
deactivate(ctx)
dispose(ts_ctx)
end
elseif VERSION >= v"1.9.0-DEV.115"
Context(f)
else
ctx = JuliaContext()
activate(ctx)
try
f(ctx)
finally
deactivate(ctx)
# we cannot dispose of the global unique context
end
ts_ctx = JuliaContext(; kwargs...)
# for now, also activate the underlying context
# XXX: this is wrong; we can't expose the underlying LLVM context, but should
# instead always go through the callback in order to unlock it properly.
# rework this once we depend on Julia 1.9 or later.
ctx = context(ts_ctx)
activate(ctx)
try
f(ctx)
finally
deactivate(ctx)
dispose(ts_ctx)
end
end

Expand Down Expand Up @@ -118,9 +88,6 @@ function codegen(output::Symbol, @nospecialize(job::CompilerJob);
only_entry::Bool=false, parent_job::Union{Nothing, CompilerJob}=nothing)
if context(; throw_error=false) === nothing
error("No active LLVM context. Use `JuliaContext()` do-block syntax to create one.")
elseif VERSION < v"1.9.0-DEV.115" && context() != JuliaContext()
error("""Julia <1.9 does not suppport generating code in an arbitrary LLVM context.
Use `JuliaContext()` do-block syntax to get an appropriate one.""")
end

@timeit_debug to "Validation" begin
Expand Down
37 changes: 0 additions & 37 deletions src/gcn.jl
Original file line number Diff line number Diff line change
Expand Up @@ -50,43 +50,6 @@ function finish_module!(@nospecialize(job::CompilerJob{GCNCompilerTarget}),
return entry
end

function optimize!(job::CompilerJob{GCNCompilerTarget}, mod::LLVM.Module)
@static if VERSION < v"1.9.0-DEV.1018"
# we have to fake our target early in the pipeline because Julia's
# optimization passes weren't designed for a non-0 stack addrspace, and the
# AMDGPU target is very strict about which addrspaces are permitted for
# various code patterns
triple!(mod, llvm_triple(NativeCompilerTarget()))
datalayout!(mod, julia_datalayout(NativeCompilerTarget()))
end

invoke(optimize!, Tuple{CompilerJob, LLVM.Module}, job, mod)
end

# We need to do alloca rewriting (from 0 to 5) after Julia's optimization
# passes because of two reasons:
# 1. Debug builds call the target verifier first, which would trip if AMDGPU
# was the target at that time
# 2. We don't want any chance of messing with Julia's optimizations, since they
# eliminate target-unsafe IR patterns
function optimize_module!(job::CompilerJob{GCNCompilerTarget}, mod::LLVM.Module)
@static if VERSION < v"1.9.0-DEV.1018"
# revert back to the AMDGPU target
triple!(mod, llvm_triple(job.config.target))
datalayout!(mod, julia_datalayout(job.config.target))

tm = llvm_machine(job.config.target)
@dispose pm=ModulePassManager() begin
add_library_info!(pm, triple(mod))
add_transform_info!(pm, tm)

add!(pm, FunctionPass("FixAllocaAddrspace", fix_alloca_addrspace!))

run!(pm, mod)
end
end
end


## LLVM passes

Expand Down
2 changes: 1 addition & 1 deletion src/irgen.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function irgen(@nospecialize(job::CompilerJob))
# clean up incompatibilities
@timeit_debug to "clean-up" begin
for llvmf in functions(mod)
if VERSION < v"1.9" || Base.isdebugbuild()
if Base.isdebugbuild()
# only occurs in debug builds
delete!(function_attributes(llvmf),
EnumAttribute("sspstrong", 0))
Expand Down
Loading

0 comments on commit e1c9f4a

Please sign in to comment.