Skip to content

Commit ac051f3

Browse files
authored
Merge pull request #541 from JuliaGPU/vc/get_inference_world
Adjust for upstream JuliaLang/julia#53088
2 parents 78dcad1 + 31c6591 commit ac051f3

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/jlgen.jl

+13-1
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,11 @@ function (callback::CodeCacheCallback)(replaced::MethodInstance, max_world::UInt
204204
for ci in cis
205205
if ci.max_world == ~0 % Csize_t
206206
@assert ci.min_world - 1 <= max_world "attempting to set illogical constraints"
207+
@static if VERSION >= v"1.11.0-DEV.1390"
208+
@atomic ci.max_world = max_world
209+
else
207210
ci.max_world = max_world
211+
end
208212
end
209213
@assert ci.max_world <= max_world
210214
end
@@ -268,6 +272,13 @@ Base.Experimental.@MethodTable(GLOBAL_METHOD_TABLE)
268272

269273
## interpreter
270274

275+
@static if VERSION v"1.11.0-DEV.1498"
276+
import Core.Compiler: get_inference_world
277+
using Base: get_world_counter
278+
else
279+
import Core.Compiler: get_world_counter, get_world_counter as get_inference_world
280+
end
281+
271282
using Core.Compiler: OverlayMethodTable
272283
const MTType = Core.MethodTable
273284
if isdefined(Core.Compiler, :CachedMethodTable)
@@ -320,7 +331,7 @@ end
320331

321332
CC.InferenceParams(interp::GPUInterpreter) = interp.inf_params
322333
CC.OptimizationParams(interp::GPUInterpreter) = interp.opt_params
323-
CC.get_world_counter(interp::GPUInterpreter) = interp.world
334+
#=CC.=#get_inference_world(interp::GPUInterpreter) = interp.world
324335
CC.get_inference_cache(interp::GPUInterpreter) = interp.inf_cache
325336
CC.code_cache(interp::GPUInterpreter) = WorldView(interp.code_cache, interp.world)
326337

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

0 commit comments

Comments
 (0)