Skip to content

Commit

Permalink
Merge pull request #541 from JuliaGPU/vc/get_inference_world
Browse files Browse the repository at this point in the history
Adjust for upstream JuliaLang/julia#53088
  • Loading branch information
vchuravy authored Feb 8, 2024
2 parents 78dcad1 + 31c6591 commit ac051f3
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/jlgen.jl
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,11 @@ function (callback::CodeCacheCallback)(replaced::MethodInstance, max_world::UInt
for ci in cis
if ci.max_world == ~0 % Csize_t
@assert ci.min_world - 1 <= max_world "attempting to set illogical constraints"
@static if VERSION >= v"1.11.0-DEV.1390"
@atomic ci.max_world = max_world
else
ci.max_world = max_world
end
end
@assert ci.max_world <= max_world
end
Expand Down Expand Up @@ -268,6 +272,13 @@ Base.Experimental.@MethodTable(GLOBAL_METHOD_TABLE)

## interpreter

@static if VERSION v"1.11.0-DEV.1498"
import Core.Compiler: get_inference_world
using Base: get_world_counter
else
import Core.Compiler: get_world_counter, get_world_counter as get_inference_world
end

using Core.Compiler: OverlayMethodTable
const MTType = Core.MethodTable
if isdefined(Core.Compiler, :CachedMethodTable)
Expand Down Expand Up @@ -320,7 +331,7 @@ end

CC.InferenceParams(interp::GPUInterpreter) = interp.inf_params
CC.OptimizationParams(interp::GPUInterpreter) = interp.opt_params
CC.get_world_counter(interp::GPUInterpreter) = interp.world
#=CC.=#get_inference_world(interp::GPUInterpreter) = interp.world
CC.get_inference_cache(interp::GPUInterpreter) = interp.inf_cache
CC.code_cache(interp::GPUInterpreter) = WorldView(interp.code_cache, interp.world)

Expand Down Expand Up @@ -471,6 +482,7 @@ end
# HACK: in older versions of Julia, `jl_create_native` doesn't take a world argument
# but instead always generates code for the current world. note that this doesn't
# actually change the world age, but just spoofs the counter `jl_create_native` reads.
# XXX: Base.get_world_counter is supposed to be monotonically increasing and is runtime global.
macro in_world(world, ex)
quote
actual_world = Base.get_world_counter()
Expand Down

0 comments on commit ac051f3

Please sign in to comment.