Skip to content

Commit

Permalink
Fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
maleadt committed Apr 16, 2024
1 parent 4511f85 commit 3f9cde3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
7 changes: 5 additions & 2 deletions src/compiler/compilation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -530,20 +530,23 @@ function generate_opaque_closure(config::CompilerConfig, src::CodeInfo,
mi = ccall(:jl_specializations_get_linfo, Ref{MethodInstance},
(Any, Any, Any), meth, full_sig, Core.svec())
job = CompilerJob(mi, config) # this captures the current world age
Base.@atomic meth.primary_world = job.world
Base.@atomic meth.deleted_world = typemax(UInt)

# create a code instance and store it in the cache
interp = GPUCompiler.get_interpreter(job)
owner = Core.Compiler.cache_owner(interp)
exctype = Any
inferred_const = C_NULL
inferred = src
const_flags = Int32(0)
min_world = meth.primary_world
max_world = typemax(UInt)
max_world = meth.deleted_world
ipo_effects = UInt32(0)
effects = UInt32(0)
analysis_results = nothing
relocatability = UInt8(0)
ci = CodeInstance(mi, owner, rt, exctype, inferred_const, const_flags,
ci = CodeInstance(mi, owner, rt, exctype, inferred_const, inferred,
const_flags, min_world, max_world, ipo_effects, effects,
analysis_results, relocatability, src.debuginfo)
Core.Compiler.setindex!(GPUCompiler.ci_cache(job), ci, mi)
Expand Down
6 changes: 3 additions & 3 deletions test/core/execution.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1094,7 +1094,7 @@ end

############################################################################################

if VERSION >= v"1.10-"
if VERSION >= v"1.12-"
@testset "opaque closures" begin

# basic closure, constructed from IRCode
Expand All @@ -1118,8 +1118,8 @@ end

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

d = CuArray([1])
a = CuArray([2])
Expand Down

0 comments on commit 3f9cde3

Please sign in to comment.