Skip to content

Commit 426495f

Browse files
authored
Inactive boxed cache (#1667)
* Inactive boxed cache * noroot
1 parent 73abcf1 commit 426495f

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

src/compiler.jl

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,13 @@ const activefns = Set{String}((
314314
"jl_",
315315
))
316316

317+
const inactiveglobs = Set{String}((
318+
"ijl_boxed_uint8_cache",
319+
"jl_boxed_uint8_cache",
320+
"ijl_boxed_int8_cache",
321+
"jl_boxed_int8_cache",
322+
))
323+
317324
@enum ActivityState begin
318325
AnyState = 0
319326
ActiveState = 1
@@ -3270,6 +3277,16 @@ function annotate!(mod, mode)
32703277
for f in fns
32713278
API.EnzymeAttributeKnownFunctions(f.ref)
32723279
end
3280+
3281+
@static if VERSION >= v"1.8-"
3282+
for gname in inactiveglobs
3283+
globs = LLVM.globals(mod)
3284+
if haskey(globs, gname)
3285+
glob = globs[gname]
3286+
metadata(glob)["enzyme_inactive"] = MDNode(LLVM.Metadata[])
3287+
end
3288+
end
3289+
end
32733290

32743291
for fname in inactivefns
32753292
if haskey(fns, fname)
@@ -4823,9 +4840,6 @@ function lower_convention(functy::Type, mod::LLVM.Module, entry_f::LLVM.Function
48234840
ops = collect(operands(ci))[1:end-1]
48244841
position!(builder, ci)
48254842
nops = LLVM.Value[]
4826-
if returnRoots
4827-
push!(nops, ops[1+sret])
4828-
end
48294843
if swiftself
48304844
push!(nops, ops[1+sret+returnRoots])
48314845
end

0 commit comments

Comments
 (0)