Skip to content

Commit 3f9cde3

Browse files
committed
Fixes.
1 parent 4511f85 commit 3f9cde3

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

src/compiler/compilation.jl

+5-2
Original file line numberDiff line numberDiff line change
@@ -530,20 +530,23 @@ function generate_opaque_closure(config::CompilerConfig, src::CodeInfo,
530530
mi = ccall(:jl_specializations_get_linfo, Ref{MethodInstance},
531531
(Any, Any, Any), meth, full_sig, Core.svec())
532532
job = CompilerJob(mi, config) # this captures the current world age
533+
Base.@atomic meth.primary_world = job.world
534+
Base.@atomic meth.deleted_world = typemax(UInt)
533535

534536
# create a code instance and store it in the cache
535537
interp = GPUCompiler.get_interpreter(job)
536538
owner = Core.Compiler.cache_owner(interp)
537539
exctype = Any
538540
inferred_const = C_NULL
541+
inferred = src
539542
const_flags = Int32(0)
540543
min_world = meth.primary_world
541-
max_world = typemax(UInt)
544+
max_world = meth.deleted_world
542545
ipo_effects = UInt32(0)
543546
effects = UInt32(0)
544547
analysis_results = nothing
545548
relocatability = UInt8(0)
546-
ci = CodeInstance(mi, owner, rt, exctype, inferred_const, const_flags,
549+
ci = CodeInstance(mi, owner, rt, exctype, inferred_const, inferred,
547550
const_flags, min_world, max_world, ipo_effects, effects,
548551
analysis_results, relocatability, src.debuginfo)
549552
Core.Compiler.setindex!(GPUCompiler.ci_cache(job), ci, mi)

test/core/execution.jl

+3-3
Original file line numberDiff line numberDiff line change
@@ -1094,7 +1094,7 @@ end
10941094

10951095
############################################################################################
10961096

1097-
if VERSION >= v"1.10-"
1097+
if VERSION >= v"1.12-"
10981098
@testset "opaque closures" begin
10991099

11001100
# basic closure, constructed from IRCode
@@ -1118,8 +1118,8 @@ end
11181118

11191119
# basic closure, constructed from CodeInfo
11201120
let
1121-
ir, rettyp = only(Base.code_typed(*, (Int, Int, Int)))
1122-
oc = CUDA.OpaqueClosure(ir)
1121+
ir, rettype = only(Base.code_typed(*, (Int, Int, Int)))
1122+
oc = CUDA.OpaqueClosure(ir; sig=Tuple{Int,Int,Int}, rettype, nargs=3)
11231123

11241124
d = CuArray([1])
11251125
a = CuArray([2])

0 commit comments

Comments
 (0)