Skip to content

Commit 1502341

Browse files
authored
Merge pull request #1549 from mcabbott/drop16
Drop support for Julia 1.6
2 parents 12cd77d + 3c67a83 commit 1502341

File tree

9 files changed

+13
-80
lines changed

9 files changed

+13
-80
lines changed

.buildkite/pipeline.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
steps:
2-
- label: "GPU integration - julia v1.6"
2+
- label: "GPU integration - julia v1.10"
33
plugins:
44
- JuliaCI/julia#v1:
5-
version: "1.6"
5+
version: "1.10"
66
- JuliaCI/julia-test#v1: ~
77
command:
88
- mkdir -p "$${JULIA_DEPOT_PATH}/conda/3/x86_64"

.github/workflows/Downstream.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
1+
22
name: IntegrationTest
33
on:
44
push:

.github/workflows/ci.yml

+3-12
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
fail-fast: false
1818
matrix:
1919
version:
20-
- '1.6' # Replace this with the minimum Julia version that your package supports.
20+
- 'min' # Minimum Julia version that Zygote supports.
2121
- '1' # automatically expands to the latest stable 1.x release of Julia
2222
- 'nightly'
2323
os:
@@ -33,20 +33,11 @@ jobs:
3333
# arch: x64
3434
steps:
3535
- uses: actions/checkout@v3
36-
- uses: julia-actions/setup-julia@v1
36+
- uses: julia-actions/setup-julia@v2
3737
with:
3838
version: ${{ matrix.version }}
3939
arch: ${{ matrix.arch }}
40-
- uses: actions/cache@v3
41-
env:
42-
cache-name: cache-artifacts
43-
with:
44-
path: ~/.julia/artifacts
45-
key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }}
46-
restore-keys: |
47-
${{ runner.os }}-test-${{ env.cache-name }}-
48-
${{ runner.os }}-test-
49-
${{ runner.os }}-
40+
- uses: julia-actions/cache@v2
5041
- uses: julia-actions/julia-buildpkg@v1
5142
env:
5243
JULIA_PKG_SERVER: ""

Project.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ SpecialFunctions = "1.6, 2"
5858
Statistics = "1"
5959
Tracker = "0.2"
6060
ZygoteRules = "0.2.7"
61-
julia = "1.6"
61+
julia = "1.10"
6262

6363
[extras]
6464
CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba"

src/Zygote.jl

-4
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,6 @@ macro profile(ex)
7979
end
8080

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

8884
end # module

src/compiler/interface2.jl

-8
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,6 @@ function _generate_pullback(ctx, world, f, args...)
3131
g = try
3232
_generate_pullback_via_decomposition(T, world)
3333
catch e
34-
if VERSION < v"1.8"
35-
# work around Julia bug
36-
rethrow(CompileError(T,e))
37-
end
3834
return :(throw($(CompileError(T,e))))
3935
end
4036
g === nothing && return :(f(args...), Pullback{$T}((f,)))
@@ -53,10 +49,6 @@ function _generate_callable_pullback(j::Type{<:Pullback{T}}, world, Δ) where T
5349
g = try
5450
_generate_pullback_via_decomposition(T, world)
5551
catch e
56-
if VERSION < v"1.8"
57-
# work around Julia bug
58-
rethrow(CompileError(T,e))
59-
end
6052
return :(throw($(CompileError(T,e))))
6153
end
6254
if g === nothing

src/lib/lib.jl

+1-14
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,5 @@
11
using Base: RefValue
2-
3-
if VERSION > v"1.7.0-DEV.204"
4-
using Base: ismutabletype
5-
else
6-
function ismutabletype(@nospecialize(t::Type))
7-
t = Base.unwrap_unionall(t)
8-
return isa(t, DataType) && t.mutable
9-
end
10-
end
2+
using Base: ismutabletype
113

124
# Interfaces
135

@@ -90,12 +82,7 @@ unwrap(ref, x) = x
9082
end
9183

9284
function global_set(ref, val)
93-
@static if VERSION < v"1.9.0-DEV.265"
94-
ccall(:jl_set_global, Cvoid, (Any, Any, Any),
95-
ref.mod, ref.name, val)
96-
else
9785
setglobal!(ref.mod, ref.name, val)
98-
end
9986
end
10087

10188
@_adjoint_keepthunks! function global_set(ref, x)

src/lib/literal_getproperty.jl

+3-24
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,7 @@ function reflect(@nospecialize(sigtypes::Tuple), world::UInt)
2929
end
3030
method_index === 0 && return nothing
3131
type_signature, raw_static_params, method = _methods[method_index]
32-
if VERSION < v"1.8-"
33-
method_instance = Core.Compiler.specialize_method(method, type_signature, raw_static_params, false)
34-
else
35-
method_instance = Core.Compiler.specialize_method(method, type_signature, raw_static_params; preexisting=false)
36-
end
32+
method_instance = Core.Compiler.specialize_method(method, type_signature, raw_static_params; preexisting=false)
3733
method_signature = method.sig
3834
static_params = Any[raw_static_params...]
3935
return method_instance, method_signature, static_params
@@ -47,11 +43,7 @@ function _generate_literal_getproperty(ctx, world, x, ::Type{Val{f}}) where f
4743
sig(x) = Tuple{x, typeof(f)}
4844
rrule_sig(x) = Tuple{typeof(getproperty), x, typeof(f)}
4945
pb_sig(x) = Tuple{ctx, typeof(getproperty), x, typeof(f)}
50-
@static if VERSION >= v"1.10.0-DEV.65"
51-
which(f, t) = Base._which(Base.signature_type(f, t); world).method
52-
else
53-
which(f, t) = Base.which(f, t)
54-
end
46+
which(f, t) = Base._which(Base.signature_type(f, t); world).method
5547

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

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

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

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

@@ -116,11 +103,3 @@ end
116103
$(Expr(:meta, :generated, _literal_getproperty_pullback_generator))
117104
$(Expr(:meta, :generated_only))
118105
end
119-
120-
else
121-
122-
@generated function _pullback(ctx::AContext, ::typeof(literal_getproperty), x, f)
123-
_generate_literal_getproperty(ctx, nothing, x, f)
124-
end
125-
126-
end

test/compiler.jl

+2-14
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,7 @@ y, back = pullback(badly, 2)
3333
bt = try back(1) catch e stacktrace(catch_backtrace()) end
3434

3535
@test trace_contains(bt, nothing, "compiler.jl", bad_def_line)
36-
if VERSION >= v"1.10-"
37-
@test trace_contains(bt, :badly, "compiler.jl", bad_call_line)
38-
else
39-
@test_broken trace_contains(bt, :badly, "compiler.jl", bad_call_line)
40-
end
36+
@test trace_contains(bt, :badly, "compiler.jl", bad_call_line)
4137

4238
# Type inference checks
4339

@@ -178,12 +174,11 @@ end
178174
@test y_explicit == y_implicit == getfield(g, :m)
179175

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

189184
Base.getproperty(g::Gaussian, s::Symbol) = 2getfield(g, s)
@@ -282,9 +277,6 @@ function try_catch_finally(cond, x)
282277
x
283278
end
284279

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

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

300292
x
301293
end
302-
"""))
303-
end
304294

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

325-
if VERSION >= v"1.8"
326315
@testset "try/catch/else" begin
327316
@test Zygote.gradient(try_catch_else, false, 1.0) == (nothing, 8.0)
328317
@test_throws ErrorException Zygote.gradient(try_catch_else, true, 1.0)
329318
end
330-
end
331319

332320
function foo_try(f)
333321
y = 1

0 commit comments

Comments
 (0)