From c5f3e58f7ad722e04f3bcbdc11c8d68de6befc29 Mon Sep 17 00:00:00 2001 From: Avik Pal Date: Sun, 19 Oct 2025 11:13:26 -0400 Subject: [PATCH 1/9] test: version 1.12 Comment out older Go versions in CI matrix --- .github/workflows/CI.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index b60f801cbc..4fc5387a97 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -34,8 +34,8 @@ jobs: fail-fast: false matrix: version: - - "1.10" - - "1.11" + # - "1.10" + - "1.12" # - 'nightly' os: - ubuntu-24.04 From 959902e75ccc7c52d137694535817a2002db1492 Mon Sep 17 00:00:00 2001 From: Avik Pal Date: Sun, 19 Oct 2025 11:13:59 -0400 Subject: [PATCH 2/9] test: v1.12 --- .buildkite/pipeline.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index 44f8b50dd7..4091416652 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -5,7 +5,7 @@ steps: matrix: setup: version: - - "1.10" + - "1.12" group: - core - neural_networks From 02003faad290b281490bb3486e10acf608275072 Mon Sep 17 00:00:00 2001 From: Avik Pal Date: Fri, 24 Oct 2025 17:24:19 -0400 Subject: [PATCH 3/9] ci: disable downgrade --- .github/workflows/CI.yml | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 4fc5387a97..5ccd8ce0bf 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -86,21 +86,21 @@ jobs: # assertions: true # test_group: ${{ matrix.test_group }} - downgrade: - strategy: - fail-fast: false - matrix: - test_group: - - core - - neural_networks - - integration - runtime: - - "pjrt" - - "ifrt" - uses: ./.github/workflows/CommonCI.yml - with: - julia_version: "1.10" - os: "ubuntu-24.04" - runtime: ${{ matrix.runtime }} - test_group: ${{ matrix.test_group }} - downgrade_testing: true + # downgrade: + # strategy: + # fail-fast: false + # matrix: + # test_group: + # - core + # - neural_networks + # - integration + # runtime: + # - "pjrt" + # - "ifrt" + # uses: ./.github/workflows/CommonCI.yml + # with: + # julia_version: "1.10" + # os: "ubuntu-24.04" + # runtime: ${{ matrix.runtime }} + # test_group: ${{ matrix.test_group }} + # downgrade_testing: true From 8346a31356848e9761d73e27d71f853b43b3b89c Mon Sep 17 00:00:00 2001 From: Avik Pal Date: Sun, 26 Oct 2025 16:23:42 -0400 Subject: [PATCH 4/9] fix: get 1.12 KAExt loading to work --- ext/ReactantKernelAbstractionsExt.jl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ext/ReactantKernelAbstractionsExt.jl b/ext/ReactantKernelAbstractionsExt.jl index 1e38b81b9a..592a280c8d 100644 --- a/ext/ReactantKernelAbstractionsExt.jl +++ b/ext/ReactantKernelAbstractionsExt.jl @@ -109,11 +109,11 @@ function (obj::KA.Kernel{ReactantBackend})(args...; ndrange=nothing, workgroupsi return nothing end -Reactant.@reactant_overlay Base.@nospecializeinfer @noinline function ( - obj::KA.Kernel{ReactantBackend} -)( - @nospecialize args...; ndrange=nothing, workgroupsize=nothing +Reactant.@reactant_overlay function (obj::KA.Kernel{ReactantBackend})( + args...; ndrange=nothing, workgroupsize=nothing ) + Base.@_noinline_meta + Base.@_nospecializeinfer_meta return Reactant.call_with_reactant( Reactant.ka_with_reactant, ndrange, workgroupsize, obj, args... ) From 4c55386400ae0d9beebaaf27b7c0bbf50a9682ea Mon Sep 17 00:00:00 2001 From: "William S. Moses" Date: Mon, 27 Oct 2025 19:41:12 -0500 Subject: [PATCH 5/9] Mildly functioning on 1.12 --- src/Interpreter.jl | 10 +++- src/utils.jl | 96 +++++++++++++++++++++++--------- src/xla/PJRT/LoadedExecutable.jl | 6 +- 3 files changed, 84 insertions(+), 28 deletions(-) diff --git a/src/Interpreter.jl b/src/Interpreter.jl index 6ffcec0ab3..3bc821c901 100644 --- a/src/Interpreter.jl +++ b/src/Interpreter.jl @@ -41,18 +41,24 @@ function set_reactant_abi( if length(argtypes) != 1 @static if VERSION < v"1.11.0-" return CallMeta(Union{}, Effects(), NoCallInfo()) - else + elseif VERSION < v"1.12.0-" return CallMeta(Union{}, Union{}, Effects(), NoCallInfo()) + else + return Core.Compiler.Future{Core.Compiler.CallMeta}(CallMeta(Union{}, Union{}, Effects(), NoCallInfo())) end end @static if VERSION < v"1.11.0-" return CallMeta( Core.Const(true), Core.Compiler.EFFECTS_TOTAL, MethodResultPure() ) - else + elseif VERSION < v"1.12.0-" return CallMeta( Core.Const(true), Union{}, Core.Compiler.EFFECTS_TOTAL, MethodResultPure() ) + else + return Core.Compiler.Future{Core.Compiler.CallMeta}(CallMeta( + Core.Const(true), Union{}, Core.Compiler.EFFECTS_TOTAL, MethodResultPure() + )) end end diff --git a/src/utils.jl b/src/utils.jl index eb8e2b3701..94e51e37db 100644 --- a/src/utils.jl +++ b/src/utils.jl @@ -369,7 +369,11 @@ function rewrite_inst(inst, ir, interp, RT, guaranteed_error) end end if Meta.isexpr(inst, :invoke) - omi = inst.args[1]::Core.MethodInstance + omi = if inst.args[1] isa Core.MethodInstance + inst.args[1] + else + (inst.args[1]::Core.CodeInstance).def + end sig = omi.specTypes ft = sig.parameters[1] argsig = sig.parameters[2:end] @@ -518,22 +522,40 @@ function make_oc_ref( if Base.isassigned(oc_captures) return oc_captures[] else - ores = ccall( - :jl_new_opaque_closure_from_code_info, - Any, - (Any, Any, Any, Any, Any, Cint, Any, Cint, Cint, Any, Cint), - sig, - rt, - rt, - @__MODULE__, - src, - 0, - nothing, - nargs, - isva, - f, - true, - )::Core.OpaqueClosure + ores = @static if VERSION < v"1.11" + ccall(:jl_new_opaque_closure_from_code_info, + Any, + (Any, Any, Any, Any, Any, Cint, Any, Cint, Cint, Any, Cint), + sig, + rt, + rt, + @__MODULE__, + src, + 0, + nothing, + nargs, + isva, + f, + true, + )::Core.OpaqueClosure + else + ccall(:jl_new_opaque_closure_from_code_info, + Any, + (Any, Any, Any, Any, Any, Cint, Any, Cint, Cint, Any, Cint, Cint), + sig, # jl_tupletype_t *argt + rt, # jl_value_t *rt_lb + rt, # jl_value_t *rt_ub + @__MODULE__, # jl_module_t *mod + src, # jl_code_info_t *ci + 0, # int lineno + nothing, # jl_value_t *file + nargs, # int nargs + isva, # int isva + f, # jl_value_t *env + true, # int do_compile + true, # int isinferred + )::Core.OpaqueClosure + end oc_captures[] = ores return ores end @@ -725,7 +747,9 @@ function call_with_reactant_generator( src.slotnames = fill(:none, length(ir.argtypes) + 1) src.slotflags = fill(zero(UInt8), length(ir.argtypes)) src.slottypes = copy(ir.argtypes) - src.rettype = rt + @static if VERSION < v"1.12.0-" + src.rettype = rt + end src = CC.ir_to_codeinf!(src, ir) if DEBUG_INTERP[] @@ -747,6 +771,12 @@ function call_with_reactant_generator( # and the REDUB_ARGUMENTS_NAME tuple of input arguments code_info.slotnames = Any[:call_with_reactant, REDUB_ARGUMENTS_NAME] code_info.slotflags = UInt8[0x00, 0x00] + + if VERSION >= v"1.12-" + code_info.nargs = length(code_info.slotnames) + code_info.isva = true + end + n_prepended_slots = 2 overdub_args_slot = Core.SlotNumber(n_prepended_slots) @@ -754,10 +784,18 @@ function call_with_reactant_generator( # into these overdubbed equivalents instead of updating `code_info` in-place. Then, at # the end of the pass, we'll reset `code_info` fields accordingly. overdubbed_code = Any[] - overdubbed_codelocs = Int32[] + + overdubbed_codelocs = @static if isdefined(Core, :DebugInfo) + nothing + else + Int32[] + end + function push_inst!(inst) push!(overdubbed_code, inst) - push!(overdubbed_codelocs, code_info.codelocs[1]) + @static if !isdefined(Core, :DebugInfo) + push!(overdubbed_codelocs, code_info.codelocs[1]) + end return Core.SSAValue(length(overdubbed_code)) end # Rewire the arguments from our tuple input of fn and args, to the corresponding calling convention @@ -781,6 +819,11 @@ function call_with_reactant_generator( iter_args = min(n_actual_args, n_method_args - 1) end + if VERSION >= v"1.12-" + src.nargs = length(src.slottypes) + src.isva = false + end + for i in 1:iter_args actual_argument = Expr( :call, Core.GlobalRef(Core, :getfield), overdub_args_slot, offset @@ -862,12 +905,9 @@ function call_with_reactant_generator( farg = nothing rep = Expr(:call, make_oc, dict, octup, rt, src, ocnargs, ocva, farg) push_inst!(rep) - Core.SSAValue(length(overdubbed_code)) end - push_inst!(Expr(:call, oc, fn_args[1:end]...)) - - ocres = Core.SSAValue(length(overdubbed_code)) + ocres = push_inst!(Expr(:call, oc, fn_args[1:end]...)) if DEBUG_INTERP[] push_inst!(Expr(:call, safe_print, "ocres", ocres)) @@ -882,7 +922,13 @@ function call_with_reactant_generator( end code_info.code = overdubbed_code - code_info.codelocs = overdubbed_codelocs + + @static if isdefined(Core, :DebugInfo) + code_info.debuginfo = Core.DebugInfo(:none) # Core.DebugInfoStream(overdubbed_codelocs), length(overdubbed_codelocs)) + else + code_info.codelocs = overdubbed_codelocs + end + code_info.ssavaluetypes = length(overdubbed_code) code_info.ssaflags = [0x00 for _ in 1:length(overdubbed_code)] # XXX we need to copy flags that are set for the original code diff --git a/src/xla/PJRT/LoadedExecutable.jl b/src/xla/PJRT/LoadedExecutable.jl index 65aedbf6d9..02e884f6ae 100644 --- a/src/xla/PJRT/LoadedExecutable.jl +++ b/src/xla/PJRT/LoadedExecutable.jl @@ -105,7 +105,11 @@ function XLA.compile( end function execute_ir(N, M, n_outs, with_device::Bool, nmesh_ids::Int64) - ptr = sizeof(Int) == sizeof(Int64) ? "i64" : "i32" + ptr = @static if VERSION < v"1.12" + sizeof(Int) == sizeof(Int64) ? "i64" : "i32" + else + "ptr" + end cint = sizeof(Cint) == sizeof(Int64) ? "i64" : "i32" args = N > 0 ? ", [$N x $ptr] %inps, [$M x i8] %donated" : "" if with_device From f7abeecedf0588d7638f1168e26d60410748ff6a Mon Sep 17 00:00:00 2001 From: "William S. Moses" Date: Mon, 27 Oct 2025 21:55:17 -0400 Subject: [PATCH 6/9] ci --- .github/workflows/CI.yml | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 5ccd8ce0bf..b60f801cbc 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -34,8 +34,8 @@ jobs: fail-fast: false matrix: version: - # - "1.10" - - "1.12" + - "1.10" + - "1.11" # - 'nightly' os: - ubuntu-24.04 @@ -86,21 +86,21 @@ jobs: # assertions: true # test_group: ${{ matrix.test_group }} - # downgrade: - # strategy: - # fail-fast: false - # matrix: - # test_group: - # - core - # - neural_networks - # - integration - # runtime: - # - "pjrt" - # - "ifrt" - # uses: ./.github/workflows/CommonCI.yml - # with: - # julia_version: "1.10" - # os: "ubuntu-24.04" - # runtime: ${{ matrix.runtime }} - # test_group: ${{ matrix.test_group }} - # downgrade_testing: true + downgrade: + strategy: + fail-fast: false + matrix: + test_group: + - core + - neural_networks + - integration + runtime: + - "pjrt" + - "ifrt" + uses: ./.github/workflows/CommonCI.yml + with: + julia_version: "1.10" + os: "ubuntu-24.04" + runtime: ${{ matrix.runtime }} + test_group: ${{ matrix.test_group }} + downgrade_testing: true From 6da11e951b00b728b072107d7d5d2962613aac9c Mon Sep 17 00:00:00 2001 From: "William S. Moses" Date: Mon, 27 Oct 2025 21:46:53 -0500 Subject: [PATCH 7/9] fix 1.10 --- ext/ReactantKernelAbstractionsExt.jl | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/ext/ReactantKernelAbstractionsExt.jl b/ext/ReactantKernelAbstractionsExt.jl index 592a280c8d..2814ffd31e 100644 --- a/ext/ReactantKernelAbstractionsExt.jl +++ b/ext/ReactantKernelAbstractionsExt.jl @@ -109,6 +109,17 @@ function (obj::KA.Kernel{ReactantBackend})(args...; ndrange=nothing, workgroupsi return nothing end +@static if VERSION < v"1.12-" +Reactant.@reactant_overlay Base.@nospecializeinfer @noinline function ( + obj::KA.Kernel{ReactantBackend} +)( + @nospecialize args...; ndrange=nothing, workgroupsize=nothing +) + return Reactant.call_with_reactant( + Reactant.ka_with_reactant, ndrange, workgroupsize, obj, args... + ) +end +else Reactant.@reactant_overlay function (obj::KA.Kernel{ReactantBackend})( args...; ndrange=nothing, workgroupsize=nothing ) @@ -118,5 +129,6 @@ Reactant.@reactant_overlay function (obj::KA.Kernel{ReactantBackend})( Reactant.ka_with_reactant, ndrange, workgroupsize, obj, args... ) end +end end From 06e91d106b34d3e24e7e3704eca8b3c60b9e34f0 Mon Sep 17 00:00:00 2001 From: William Moses Date: Tue, 28 Oct 2025 01:04:51 -0500 Subject: [PATCH 8/9] Change Julia version from 1.12 to 1.10 --- .buildkite/pipeline.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index 4091416652..44f8b50dd7 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -5,7 +5,7 @@ steps: matrix: setup: version: - - "1.12" + - "1.10" group: - core - neural_networks From 4ea6303dbf168d34dc881d0e23e6e596d4047d11 Mon Sep 17 00:00:00 2001 From: Avik Pal Date: Tue, 28 Oct 2025 10:12:42 -0500 Subject: [PATCH 9/9] chore: run formatter --- benchmark/aggregate.jl | 2 +- benchmark/runbenchmarks.jl | 2 +- deps/build_local.jl | 2 +- ext/ReactantKernelAbstractionsExt.jl | 32 ++++++++++++++-------------- src/Interpreter.jl | 15 +++++++++---- src/utils.jl | 6 ++++-- 6 files changed, 34 insertions(+), 25 deletions(-) diff --git a/benchmark/aggregate.jl b/benchmark/aggregate.jl index aaf4e25fa5..7d71352255 100644 --- a/benchmark/aggregate.jl +++ b/benchmark/aggregate.jl @@ -15,5 +15,5 @@ for backend in BACKENDS end open(joinpath(dirname(@__FILE__), "results", "combinedbenchmarks.json"), "w") do io - JSON3.pretty(io, JSON3.write(all_results)) + return JSON3.pretty(io, JSON3.write(all_results)) end diff --git a/benchmark/runbenchmarks.jl b/benchmark/runbenchmarks.jl index 1a80c3a0d7..3c389e0ad2 100644 --- a/benchmark/runbenchmarks.jl +++ b/benchmark/runbenchmarks.jl @@ -44,7 +44,7 @@ for (i, (k, v)) in enumerate(results) end open(joinpath(filepath, filename), "w") do io - JSON3.pretty(io, JSON3.write(standardized_results)) + return JSON3.pretty(io, JSON3.write(standardized_results)) end @info "Saved results to $(joinpath(filepath, filename))" diff --git a/deps/build_local.jl b/deps/build_local.jl index 1fa6955c58..8d1a43821e 100644 --- a/deps/build_local.jl +++ b/deps/build_local.jl @@ -252,7 +252,7 @@ run(Cmd(Cmd(build_cmd_list); dir=source_dir)) # Discover built libraries built_libs = filter(readdir(joinpath(source_dir, "bazel-bin"))) do file - endswith(file, "Extra.so") && startswith(file, "lib") + return endswith(file, "Extra.so") && startswith(file, "lib") end lib_path = joinpath(source_dir, "bazel-bin", only(built_libs)) diff --git a/ext/ReactantKernelAbstractionsExt.jl b/ext/ReactantKernelAbstractionsExt.jl index 2814ffd31e..617075b086 100644 --- a/ext/ReactantKernelAbstractionsExt.jl +++ b/ext/ReactantKernelAbstractionsExt.jl @@ -110,25 +110,25 @@ function (obj::KA.Kernel{ReactantBackend})(args...; ndrange=nothing, workgroupsi end @static if VERSION < v"1.12-" -Reactant.@reactant_overlay Base.@nospecializeinfer @noinline function ( - obj::KA.Kernel{ReactantBackend} -)( - @nospecialize args...; ndrange=nothing, workgroupsize=nothing -) - return Reactant.call_with_reactant( - Reactant.ka_with_reactant, ndrange, workgroupsize, obj, args... + Reactant.@reactant_overlay Base.@nospecializeinfer @noinline function ( + obj::KA.Kernel{ReactantBackend} + )( + @nospecialize args...; ndrange=nothing, workgroupsize=nothing ) -end + return Reactant.call_with_reactant( + Reactant.ka_with_reactant, ndrange, workgroupsize, obj, args... + ) + end else -Reactant.@reactant_overlay function (obj::KA.Kernel{ReactantBackend})( - args...; ndrange=nothing, workgroupsize=nothing -) - Base.@_noinline_meta - Base.@_nospecializeinfer_meta - return Reactant.call_with_reactant( - Reactant.ka_with_reactant, ndrange, workgroupsize, obj, args... + Reactant.@reactant_overlay function (obj::KA.Kernel{ReactantBackend})( + args...; ndrange=nothing, workgroupsize=nothing ) -end + Base.@_noinline_meta + Base.@_nospecializeinfer_meta + return Reactant.call_with_reactant( + Reactant.ka_with_reactant, ndrange, workgroupsize, obj, args... + ) + end end end diff --git a/src/Interpreter.jl b/src/Interpreter.jl index 3bc821c901..0e73cff527 100644 --- a/src/Interpreter.jl +++ b/src/Interpreter.jl @@ -44,7 +44,9 @@ function set_reactant_abi( elseif VERSION < v"1.12.0-" return CallMeta(Union{}, Union{}, Effects(), NoCallInfo()) else - return Core.Compiler.Future{Core.Compiler.CallMeta}(CallMeta(Union{}, Union{}, Effects(), NoCallInfo())) + return Core.Compiler.Future{Core.Compiler.CallMeta}( + CallMeta(Union{}, Union{}, Effects(), NoCallInfo()) + ) end end @static if VERSION < v"1.11.0-" @@ -56,9 +58,14 @@ function set_reactant_abi( Core.Const(true), Union{}, Core.Compiler.EFFECTS_TOTAL, MethodResultPure() ) else - return Core.Compiler.Future{Core.Compiler.CallMeta}(CallMeta( - Core.Const(true), Union{}, Core.Compiler.EFFECTS_TOTAL, MethodResultPure() - )) + return Core.Compiler.Future{Core.Compiler.CallMeta}( + CallMeta( + Core.Const(true), + Union{}, + Core.Compiler.EFFECTS_TOTAL, + MethodResultPure(), + ), + ) end end diff --git a/src/utils.jl b/src/utils.jl index 94e51e37db..8688603ff1 100644 --- a/src/utils.jl +++ b/src/utils.jl @@ -523,7 +523,8 @@ function make_oc_ref( return oc_captures[] else ores = @static if VERSION < v"1.11" - ccall(:jl_new_opaque_closure_from_code_info, + ccall( + :jl_new_opaque_closure_from_code_info, Any, (Any, Any, Any, Any, Any, Cint, Any, Cint, Cint, Any, Cint), sig, @@ -539,7 +540,8 @@ function make_oc_ref( true, )::Core.OpaqueClosure else - ccall(:jl_new_opaque_closure_from_code_info, + ccall( + :jl_new_opaque_closure_from_code_info, Any, (Any, Any, Any, Any, Any, Cint, Any, Cint, Cint, Any, Cint, Cint), sig, # jl_tupletype_t *argt