From 199316c197779aa2bc0076051dd6de2b7a070343 Mon Sep 17 00:00:00 2001 From: Shuhei Kadowaki <40514306+aviatesk@users.noreply.github.com> Date: Wed, 29 Jan 2025 23:49:34 +0900 Subject: [PATCH] bump minimum compatibility to the current LTS (1.10) (#328) --- .github/workflows/CI.yml | 1 + Project.toml | 2 +- src/BaseBenchmarks.jl | 2 +- src/collection/CollectionBenchmarks.jl | 2 +- src/inference/InferenceBenchmarks.jl | 53 ++++++-------------------- src/linalg/LinAlgBenchmarks.jl | 8 ++-- 6 files changed, 19 insertions(+), 49 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 3bf950f8..865b13b3 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -16,6 +16,7 @@ jobs: matrix: version: - '1' # current stable + - '1.10' # minimum compat - 'nightly' os: - ubuntu-latest diff --git a/Project.toml b/Project.toml index fb622598..62266c12 100644 --- a/Project.toml +++ b/Project.toml @@ -18,7 +18,7 @@ Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2" [compat] BenchmarkTools = "1.4" StableRNGs = "1" -julia = "1.6" +julia = "1.10" [extras] Distributed = "8ba89e20-285c-5b6f-9357-94700520ee1b" diff --git a/src/BaseBenchmarks.jl b/src/BaseBenchmarks.jl index 0508ccca..cac67970 100644 --- a/src/BaseBenchmarks.jl +++ b/src/BaseBenchmarks.jl @@ -31,8 +31,8 @@ const MODULES = Dict("array" => :ArrayBenchmarks, "string" => :StringBenchmarks, "tuple" => :TupleBenchmarks, "frontend" => :FrontendBenchmarks, + "inference" => :InferenceBenchmarks, ) -@static VERSION ≥ v"1.8-DEV" && push!(MODULES, "inference" => :InferenceBenchmarks) load!(id::AbstractString; kwargs...) = load!(SUITE, id; kwargs...) diff --git a/src/collection/CollectionBenchmarks.jl b/src/collection/CollectionBenchmarks.jl index 2018304b..cbae8a87 100644 --- a/src/collection/CollectionBenchmarks.jl +++ b/src/collection/CollectionBenchmarks.jl @@ -271,7 +271,7 @@ for T in (Nothing, Bool, Int8, UInt16) if T === Nothing g["Vector", "abstract", tstr] = @benchmarkable Vector($v) g["Vector", "concrete", tstr] = @benchmarkable Vector{$T}($v) - elseif T !== Bool && (!(T <: Unsigned) || VERSION >= v"0.7.0-") + elseif T !== Bool && !(T <: Unsigned) # there is a bug on 0.6, will probably get fixed on v6.2, cf. #24365 g["BitSet", tstr] = @benchmarkable BitSet($v) end diff --git a/src/inference/InferenceBenchmarks.jl b/src/inference/InferenceBenchmarks.jl index 872b8dc1..c152d2ab 100644 --- a/src/inference/InferenceBenchmarks.jl +++ b/src/inference/InferenceBenchmarks.jl @@ -94,33 +94,10 @@ CC.cache_owner(wvc::InferenceBenchmarker) = wvc.code_cache end function inf_gf_by_type!(interp::InferenceBenchmarker, @nospecialize(tt::Type{<:Tuple}); kwargs...) - match = _which(tt; world=get_inference_world(interp)) + match = Base._which(tt; world=get_inference_world(interp)) return inf_method_signature!(interp, match.method, match.spec_types, match.sparams; kwargs...) end -@static if VERSION ≥ v"1.10.0-DEV.96" - using Base: _which -else - function _which(@nospecialize(tt::Type); - method_table::Union{Nothing,MethodTable,CC.MethodTableView}=nothing, - world::UInt=get_world_counter(), - raise::Bool=false) - if method_table === nothing - table = CC.InternalMethodTable(world) - elseif isa(method_table, MethodTable) - table = CC.OverlayMethodTable(world, method_table) - else - table = method_table - end - match, = CC.findsup(tt, table) - if match === nothing - raise && error("no unique matching method found for the specified argument types") - return nothing - end - return match - end -end - inf_method!(interp::InferenceBenchmarker, m::Method; kwargs...) = inf_method_signature!(interp, m, m.sig, method_sparams(m); kwargs...) function method_sparams(m::Method) @@ -178,23 +155,17 @@ function opt_call(@nospecialize(f), @nospecialize(types = Base.default_tt(f)); evals = 0 return function () @assert (evals += 1) <= 1 - ## `optimize` may modify these objects, so need to stash the pre-optimization states, if we want to allow multiple evals - #src, stmt_info, slottypes, ssavalue_uses = copy(frame.src), copy(frame.stmt_info), copy(frame.slottypes), copy(frame.ssavalue_uses) - #cfg = @static hasfield(InferenceState, :cfg) ? copy(frame.cfg) : nothing - #unreachable = @static hasfield(InferenceState, :unreachable) ? copy(frame.unreachable) : nothing - #bb_vartables = @static hasfield(InferenceState, :bb_vartables) ? copy(frame.bb_vartables) : nothing - @static if !hasfield(CC.InliningState, :params) - opt = OptimizationState(frame, interp) - CC.optimize(interp, opt, frame.result) - else - params = OptimizationParams(interp) - opt = OptimizationState(frame, params, interp) - CC.optimize(interp, opt, params, frame.result) - end - #frame.src, frame.stmt_info, frame.slottypes, frame.ssavalue_uses = src, stmt_info, slottypes, ssavalue_uses - #cfg === nothing || (frame.cfg = cfg) - #unreachable === nothing || (frame.unreachable = unreachable) - #bb_vartables === nothing || (frame.bb_vartables = bb_vartables) + # # `optimize` may modify these objects, so need to stash the pre-optimization states, if we want to allow multiple evals + # src, stmt_info, slottypes, ssavalue_uses = copy(frame.src), copy(frame.stmt_info), copy(frame.slottypes), copy(frame.ssavalue_uses) + # cfg = copy(frame.cfg) + # unreachable = @static hasfield(InferenceState, :unreachable) ? copy(frame.unreachable) : nothing + # bb_vartables = @static hasfield(InferenceState, :bb_vartables) ? copy(frame.bb_vartables) : nothing + opt = OptimizationState(frame, interp) + CC.optimize(interp, opt, frame.result) + # frame.src, frame.stmt_info, frame.slottypes, frame.ssavalue_uses = src, stmt_info, slottypes, ssavalue_uses + # cfg === nothing || (frame.cfg = cfg) + # unreachable === nothing || (frame.unreachable = unreachable) + # bb_vartables === nothing || (frame.bb_vartables = bb_vartables) end end diff --git a/src/linalg/LinAlgBenchmarks.jl b/src/linalg/LinAlgBenchmarks.jl index 4427ecd0..8061f925 100644 --- a/src/linalg/LinAlgBenchmarks.jl +++ b/src/linalg/LinAlgBenchmarks.jl @@ -121,11 +121,9 @@ for s in (2, 3) B = randmat(s) C = randmat(s) g["3-arg mul!", s] = @benchmarkable LinearAlgebra.mul!($C, $A, $B) - - if VERSION >= v"1.3" - (α, β) = rand(2) - g["5-arg mul!", s] = @benchmarkable LinearAlgebra.mul!($C, $A, $B, $α, $β) - end + + (α, β) = rand(2) + g["5-arg mul!", s] = @benchmarkable LinearAlgebra.mul!($C, $A, $B, $α, $β) end