Skip to content

Commit

Permalink
Merge pull request #1549 from mcabbott/drop16
Browse files Browse the repository at this point in the history
Drop support for Julia 1.6
  • Loading branch information
pxl-th authored Mar 6, 2025
2 parents 12cd77d + 3c67a83 commit 1502341
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 80 deletions.
4 changes: 2 additions & 2 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
steps:
- label: "GPU integration - julia v1.6"
- label: "GPU integration - julia v1.10"
plugins:
- JuliaCI/julia#v1:
version: "1.6"
version: "1.10"
- JuliaCI/julia-test#v1: ~
command:
- mkdir -p "$${JULIA_DEPOT_PATH}/conda/3/x86_64"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/Downstream.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

name: IntegrationTest
on:
push:
Expand Down
15 changes: 3 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
fail-fast: false
matrix:
version:
- '1.6' # Replace this with the minimum Julia version that your package supports.
- 'min' # Minimum Julia version that Zygote supports.
- '1' # automatically expands to the latest stable 1.x release of Julia
- 'nightly'
os:
Expand All @@ -33,20 +33,11 @@ jobs:
# arch: x64
steps:
- uses: actions/checkout@v3
- uses: julia-actions/setup-julia@v1
- uses: julia-actions/setup-julia@v2
with:
version: ${{ matrix.version }}
arch: ${{ matrix.arch }}
- uses: actions/cache@v3
env:
cache-name: cache-artifacts
with:
path: ~/.julia/artifacts
key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }}
restore-keys: |
${{ runner.os }}-test-${{ env.cache-name }}-
${{ runner.os }}-test-
${{ runner.os }}-
- uses: julia-actions/cache@v2
- uses: julia-actions/julia-buildpkg@v1
env:
JULIA_PKG_SERVER: ""
Expand Down
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ SpecialFunctions = "1.6, 2"
Statistics = "1"
Tracker = "0.2"
ZygoteRules = "0.2.7"
julia = "1.6"
julia = "1.10"

[extras]
CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba"
Expand Down
4 changes: 0 additions & 4 deletions src/Zygote.jl
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,6 @@ macro profile(ex)
end

using PrecompileTools
# This caused freezes on early 1.8 patch versions,
# see https://github.com/SciML/DiffEqFlux.jl/issues/783
@static if VERSION < v"1.8" || VERSION >= v"1.8.5"
@compile_workload precompile()
end

end # module
8 changes: 0 additions & 8 deletions src/compiler/interface2.jl
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,6 @@ function _generate_pullback(ctx, world, f, args...)
g = try
_generate_pullback_via_decomposition(T, world)
catch e
if VERSION < v"1.8"
# work around Julia bug
rethrow(CompileError(T,e))
end
return :(throw($(CompileError(T,e))))
end
g === nothing && return :(f(args...), Pullback{$T}((f,)))
Expand All @@ -53,10 +49,6 @@ function _generate_callable_pullback(j::Type{<:Pullback{T}}, world, Δ) where T
g = try
_generate_pullback_via_decomposition(T, world)
catch e
if VERSION < v"1.8"
# work around Julia bug
rethrow(CompileError(T,e))
end
return :(throw($(CompileError(T,e))))
end
if g === nothing
Expand Down
15 changes: 1 addition & 14 deletions src/lib/lib.jl
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
using Base: RefValue

if VERSION > v"1.7.0-DEV.204"
using Base: ismutabletype
else
function ismutabletype(@nospecialize(t::Type))
t = Base.unwrap_unionall(t)
return isa(t, DataType) && t.mutable
end
end
using Base: ismutabletype

# Interfaces

Expand Down Expand Up @@ -90,12 +82,7 @@ unwrap(ref, x) = x
end

function global_set(ref, val)
@static if VERSION < v"1.9.0-DEV.265"
ccall(:jl_set_global, Cvoid, (Any, Any, Any),
ref.mod, ref.name, val)
else
setglobal!(ref.mod, ref.name, val)
end
end

@_adjoint_keepthunks! function global_set(ref, x)
Expand Down
27 changes: 3 additions & 24 deletions src/lib/literal_getproperty.jl
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,7 @@ function reflect(@nospecialize(sigtypes::Tuple), world::UInt)
end
method_index === 0 && return nothing
type_signature, raw_static_params, method = _methods[method_index]
if VERSION < v"1.8-"
method_instance = Core.Compiler.specialize_method(method, type_signature, raw_static_params, false)
else
method_instance = Core.Compiler.specialize_method(method, type_signature, raw_static_params; preexisting=false)
end
method_instance = Core.Compiler.specialize_method(method, type_signature, raw_static_params; preexisting=false)
method_signature = method.sig
static_params = Any[raw_static_params...]
return method_instance, method_signature, static_params
Expand All @@ -47,11 +43,7 @@ function _generate_literal_getproperty(ctx, world, x, ::Type{Val{f}}) where f
sig(x) = Tuple{x, typeof(f)}
rrule_sig(x) = Tuple{typeof(getproperty), x, typeof(f)}
pb_sig(x) = Tuple{ctx, typeof(getproperty), x, typeof(f)}
@static if VERSION >= v"1.10.0-DEV.65"
which(f, t) = Base._which(Base.signature_type(f, t); world).method
else
which(f, t) = Base.which(f, t)
end
which(f, t) = Base._which(Base.signature_type(f, t); world).method

# either `getproperty` has a custom implementation or `_pullback(ctx, getproperty, x, f)`
# / `rrule(getproperty, x, f) is overloaded directly
Expand All @@ -62,11 +54,7 @@ function _generate_literal_getproperty(ctx, world, x, ::Type{Val{f}}) where f
if is_getfield_fallback
# just copy pullback of `literal_getfield`
mi, _sig, sparams = reflect((typeof(_pullback), ctx, typeof(literal_getfield), x, Val{f}), world)
ci = if VERSION >= v"1.10.0-DEV.873"
copy(Core.Compiler.retrieve_code_info(mi, world))
else
copy(Core.Compiler.retrieve_code_info(mi))
end
ci = copy(Core.Compiler.retrieve_code_info(mi, world))

# we need to change the second arg to `_pullback` from `literal_getproperty` to
# `literal_getfield`
Expand Down Expand Up @@ -100,7 +88,6 @@ function _generate_literal_getproperty(ctx, world, x, ::Type{Val{f}}) where f
end
end

if VERSION >= v"1.10.0-DEV.873"

# on Julia 1.10, generated functions need to keep track of the world age

Expand All @@ -116,11 +103,3 @@ end
$(Expr(:meta, :generated, _literal_getproperty_pullback_generator))
$(Expr(:meta, :generated_only))
end

else

@generated function _pullback(ctx::AContext, ::typeof(literal_getproperty), x, f)
_generate_literal_getproperty(ctx, nothing, x, f)
end

end
16 changes: 2 additions & 14 deletions test/compiler.jl
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,7 @@ y, back = pullback(badly, 2)
bt = try back(1) catch e stacktrace(catch_backtrace()) end

@test trace_contains(bt, nothing, "compiler.jl", bad_def_line)
if VERSION >= v"1.10-"
@test trace_contains(bt, :badly, "compiler.jl", bad_call_line)
else
@test_broken trace_contains(bt, :badly, "compiler.jl", bad_call_line)
end
@test trace_contains(bt, :badly, "compiler.jl", bad_call_line)

# Type inference checks

Expand Down Expand Up @@ -178,12 +174,11 @@ end
@test y_explicit == y_implicit == getfield(g, :m)

∇args = ((m = [1.0, 0.0, 0.0], P = nothing),)
if VERSION > v"1.7-"
# This type instability is due to the handling of non-bitstypes in `accum_param`
@test Base.return_types(back_implicit, Tuple{Vector{Float64}}) == Any[Union{Tuple{Nothing}, typeof(∇args)}]
# But the same should infer if implicit parameters are disabled
@test Base.return_types(back_explicit, Tuple{Vector{Float64}}) == Any[typeof(∇args)]
end

@test back_explicit([1., 0, 0]) == back_implicit([1., 0, 0]) == ∇args

Base.getproperty(g::Gaussian, s::Symbol) = 2getfield(g, s)
Expand Down Expand Up @@ -282,9 +277,6 @@ function try_catch_finally(cond, x)
x
end

if VERSION >= v"1.8"
# try/catch/else is invalid syntax prior to v1.8
eval(Meta.parse("""
function try_catch_else(cond, x)
x = 2x

Expand All @@ -299,8 +291,6 @@ if VERSION >= v"1.8"

x
end
"""))
end

@testset "try/catch" begin
@testset "happy path (nothrow)" begin
Expand All @@ -322,12 +312,10 @@ end
@test occursin("Can't differentiate function execution in catch block", string(err))
end

if VERSION >= v"1.8"
@testset "try/catch/else" begin
@test Zygote.gradient(try_catch_else, false, 1.0) == (nothing, 8.0)
@test_throws ErrorException Zygote.gradient(try_catch_else, true, 1.0)
end
end

function foo_try(f)
y = 1
Expand Down

0 comments on commit 1502341

Please sign in to comment.