Skip to content

Commit

Permalink
Remove dead code
Browse files Browse the repository at this point in the history
  • Loading branch information
Collin R Warner committed Apr 23, 2023
1 parent a6bd41a commit cc34d21
Showing 1 changed file with 0 additions and 66 deletions.
66 changes: 0 additions & 66 deletions src/precompilation_cache.jl
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,6 @@ function ci_cache_delta(previous_snapshot)
return delta_snapshot
end

#=function ci_cache_insert(caches)
empty!(GPUCompiler.GLOBAL_CI_CACHES)
for (key, cache) in caches
GPUCompiler.GLOBAL_CI_CACHES[key] = GPUCompiler.CodeCache(cache)
end
end=#

function ci_cache_insert(cache)
if !is_precompiling()
#first clean the cache
Expand Down Expand Up @@ -125,62 +118,3 @@ function precompile_gpucompiler(job)
GPUCompiler.ci_cache_populate(interp, cache, mt, job.source, job.world, typemax(Cint))
end
end

"""
Reloads Global Cache from global variable which stores the previous
cached results
"""
function reinit_cache(LOCAL_CACHE)
if !is_precompiling()
# need to merge caches at the code instance level
for key in keys(LOCAL_CACHE)
if haskey(GPUCompiler.GLOBAL_CI_CACHES, key)
global_cache = GPUCompiler.GLOBAL_CI_CACHES[key]
local_cache = LOCAL_CACHE[key]
for (mi, civ) in (local_cache.dict)
# this should be one since there is only one range that is infinite
@assert length(civ) == 1
# add all code instances to global cache
# could move truncating code to set index
ci = civ[1]
if haskey(global_cache.dict, mi)
gciv = global_cache.dict[mi]
# truncation cod3
# sort by min world age, then make sure no age ranges overlap // this part is uneeded
sort(gciv, by=x->x.min_world)
if ci.min_world > gciv[length(gciv)].min_world
invalidate_code_cache(global_cache, mi, ci.min_world - 1)
Core.Compiler.setindex!(global_cache, ci, mi)
else
println("Should not get here?")
@assert false
end
else
# occurs if we kill everything in the parent and then need to store in child
Core.Compiler.setindex!(global_cache, ci, mi)
end
end
else
# no conflict at cache level
GPUCompiler.GLOBAL_CI_CACHES[key] = LOCAL_CACHE[key]
end
end
end
end

"""
Takes a snapshot of the current status of the cache
The cache returned is a deep copy with finite world age endings removed
"""
function snapshot_cache(LOCAL_CACHE)
cleaned_cache_to_save = IdDict()
for key in keys(GPUCompiler.GLOBAL_CI_CACHES)
# Will only keep those elements with infinite ranges
cleaned_cache_to_save[key] = GPUCompiler.CodeCache(GPUCompiler.GLOBAL_CI_CACHES[key])
end
global MY_CACHE #technically don't need the global
#empty insert
empty!(LOCAL_CACHE)
merge!(LOCAL_CACHE, cleaned_cache_to_save)
end

0 comments on commit cc34d21

Please sign in to comment.