From e110b67acbe4fc67236c3bcbb6b47a5f2ecdc710 Mon Sep 17 00:00:00 2001 From: Valentin Churavy Date: Fri, 28 Jun 2024 13:37:23 -0400 Subject: [PATCH] Add API for external GPUCompiler uses to opt-out of disk cache --- src/execution.jl | 11 ++++++----- src/interface.jl | 2 ++ 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/execution.jl b/src/execution.jl index 6dfaaa49..4c636c92 100644 --- a/src/execution.jl +++ b/src/execution.jl @@ -206,10 +206,9 @@ end ondisk_hit = false @static if VERSION >= v"1.11.0-" # Don't try to hit the disk cache if we are for a *compile* hook - # TODO: - # - Sould we hit disk cache if Base.generating_output() - # - Should we allow backend to opt out? - if ci !== nothing && obj === nothing && disk_cache_enabled() + if ci !== nothing && obj === nothing && + disk_cache_enabled() && supports_disk_cache(cfg.params) + path = cache_file(ci, cfg) @debug "Looking for on-disk cache" job path if path !== nothing && isfile(path) @@ -242,7 +241,9 @@ end end @static if VERSION >= v"1.11.0-" - if !ondisk_hit && path !== nothing && disk_cache_enabled() + if !ondisk_hit && path !== nothing && + disk_cache_enabled() && supports_disk_cache(cfg.params) + @debug "Writing out on-disk cache" job path tmppath, io = mktemp(;cleanup=false) entry = DiskCacheEntry(src.specTypes, cfg, asm) diff --git a/src/interface.jl b/src/interface.jl index be4a65b8..7e9596ff 100644 --- a/src/interface.jl +++ b/src/interface.jl @@ -55,6 +55,8 @@ export AbstractCompilerParams abstract type AbstractCompilerParams end +# whether the external user supports the disk cache +supports_disk_cache(@nospecialize(::AbstractCompilerParams)) = true ## config