Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
7ff9757
Switch to CompilerCaching for in-memory CI caching.
maleadt May 10, 2026
371e841
Widen cache_owner to include the target+params instances.
maleadt May 10, 2026
e1624d4
Cache runtime library bitcode on the per-function CodeInstance.
maleadt May 10, 2026
f13c6ef
Remove 1.10 from CI.
maleadt May 12, 2026
d27e692
Fix tests.
maleadt May 12, 2026
c47751b
Restore 1.10 compat.
maleadt May 14, 2026
816551c
Restore per-CI bitcode caching for the GPU runtime library.
maleadt May 14, 2026
8012295
Don't cache relocated GVs.
maleadt May 14, 2026
1f58202
Null-out GV initializers on 1.12 to mirror 1.13+ behavior.
maleadt May 14, 2026
fef4b87
Inline the CompilerCaching extension; delegate inference to it on 1.11+.
maleadt May 14, 2026
c704048
Reword GPUInterpreter docstring after extension removal.
maleadt May 14, 2026
097957d
Migrate to CompilerCaching's @setup_results + interp-form typeinf!.
maleadt May 14, 2026
d478acf
Replace bitcode/bitcode! traits with a generic cache_get/cache_put! p…
maleadt May 14, 2026
44df638
Rework the caching interface around per-job results structs.
maleadt Jun 10, 2026
4a0fff0
Fix version.
maleadt Jun 11, 2026
196cbe3
Specialize cache_owner and cached_results for the launch hot path.
maleadt Jun 11, 2026
d0b34d0
Store SPIR-V extensions as a feature string.
maleadt Jun 11, 2026
8577d7f
Wipe session-dependent results before image serialization.
maleadt Jun 11, 2026
3965ce7
Clear the 1.10 CodeCache registry on load.
maleadt Jun 11, 2026
f8e169e
Don't key runtime library jobs on the kernel's entry-point name.
maleadt Jun 11, 2026
4712fe2
Fix stale comment about the removed 1.10 methodinstance generator.
maleadt Jun 11, 2026
ead1329
Remove irrelevant TODOs.
maleadt Jun 16, 2026
719ff4e
Fixes.
maleadt Jun 17, 2026
de70fb4
Remove stale runtime_slug test references
maleadt Jul 3, 2026
6530b99
Remove legacy link_libraries dispatch
maleadt Jul 3, 2026
28f3b88
Remove obsolete reset_runtime and fix the PTX runtime test.
maleadt Jul 3, 2026
0d6bbec
Link runtime library functions on demand.
maleadt Jul 3, 2026
cad3b68
Test runtime function caching across precompilation.
maleadt Jul 3, 2026
f1ca452
Cover more codegen-emitted runtime functions.
maleadt Jul 3, 2026
0c2261e
Remove redundant LLVM type overrides from runtime methods.
maleadt Jul 3, 2026
ee3bb71
Provide runtime functions through method overlays.
maleadt Jul 3, 2026
18f2a62
Document test brokenness.
maleadt Jul 3, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
name = "GPUCompiler"
uuid = "61eb1bfa-7361-4325-ad38-22787b887f55"
version = "1.22.7"
version = "2.0.0"
authors = ["Tim Besard <tim.besard@gmail.com>"]

[workspace]
projects = ["test"]

[deps]
CompilerCaching = "9db33cc3-5358-4881-8759-fa4194144afd"
ExprTools = "e2ba6199-217a-4e67-a87a-7c52f15ade04"
InteractiveUtils = "b77e0a4c-d291-57a0-90e8-8db25a27a240"
LLVM = "929cbde3-209d-540e-8aea-75f648917ca0"
Expand All @@ -15,8 +16,6 @@ Logging = "56ddb016-857b-54e1-b83d-db4d58db5568"
PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a"
Preferences = "21216c6a-2e73-6563-6e65-726566657250"
REPL = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb"
Scratch = "6c6a2e73-6563-6170-7368-637461726353"
Serialization = "9e88b42a-f829-5b0c-bbe9-9e923198166b"
TOML = "fa267f1f-6049-4f14-aa54-33bafae1ed76"
Tracy = "e689c965-62c8-4b79-b2c5-8359227902fd"
UUIDs = "cf7118a7-6976-5b1a-9a39-7adc72f591a4"
Expand All @@ -26,8 +25,10 @@ AMDGPU_LLVM_Backend_jll = "cc5c0156-bd05-5a77-8a68-bb0aafb29019"
LLVMDowngrader_jll = "f52de702-fb25-5922-94ba-81dd59b07444"
NVPTX_LLVM_Backend_jll = "ef6e0fe3-e6ef-59c0-bde6-4989574699e0"


[compat]
AMDGPU_LLVM_Backend_jll = "22"
CompilerCaching = "0.3"
ExprTools = "0.1"
InteractiveUtils = "1"
LLVM = "9.9"
Expand All @@ -38,8 +39,6 @@ NVPTX_LLVM_Backend_jll = "22"
PrecompileTools = "1"
Preferences = "1"
REPL = "1"
Scratch = "1"
Serialization = "1"
TOML = "1"
Tracy = "0.1.4"
UUIDs = "1"
Expand Down
19 changes: 9 additions & 10 deletions examples/jit.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,17 @@

using GPUCompiler

module TestRuntime
# dummy methods
signal_exception() = return
malloc(sz) = C_NULL
report_oom(sz) = return
report_exception(ex) = return
report_exception_name(ex) = return
report_exception_frame(idx, func, file, line) = return
end
# dummy GPU runtime implementations, provided as overlay methods
Base.Experimental.@MethodTable(method_table)
Base.Experimental.@overlay method_table GPUCompiler.Runtime.signal_exception() = return
Base.Experimental.@overlay method_table GPUCompiler.Runtime.malloc(sz) = C_NULL
Base.Experimental.@overlay method_table GPUCompiler.Runtime.report_oom(sz) = return
Base.Experimental.@overlay method_table GPUCompiler.Runtime.report_exception(ex) = return
Base.Experimental.@overlay method_table GPUCompiler.Runtime.report_exception_name(ex) = return
Base.Experimental.@overlay method_table GPUCompiler.Runtime.report_exception_frame(idx, func, file, line) = return

struct TestCompilerParams <: AbstractCompilerParams end
GPUCompiler.runtime_module(::CompilerJob{<:Any,TestCompilerParams}) = TestRuntime
GPUCompiler.method_table(::CompilerJob{<:Any,TestCompilerParams}) = method_table


## JIT integration
Expand Down
19 changes: 9 additions & 10 deletions examples/kernel.jl
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
using GPUCompiler

module TestRuntime
# dummy methods
signal_exception() = return
malloc(sz) = C_NULL
report_oom(sz) = return
report_exception(ex) = return
report_exception_name(ex) = return
report_exception_frame(idx, func, file, line) = return
end
# dummy GPU runtime implementations, provided as overlay methods
Base.Experimental.@MethodTable(method_table)
Base.Experimental.@overlay method_table GPUCompiler.Runtime.signal_exception() = return
Base.Experimental.@overlay method_table GPUCompiler.Runtime.malloc(sz) = C_NULL
Base.Experimental.@overlay method_table GPUCompiler.Runtime.report_oom(sz) = return
Base.Experimental.@overlay method_table GPUCompiler.Runtime.report_exception(ex) = return
Base.Experimental.@overlay method_table GPUCompiler.Runtime.report_exception_name(ex) = return
Base.Experimental.@overlay method_table GPUCompiler.Runtime.report_exception_frame(idx, func, file, line) = return

struct TestCompilerParams <: AbstractCompilerParams end
GPUCompiler.runtime_module(::CompilerJob{<:Any,TestCompilerParams}) = TestRuntime
GPUCompiler.method_table(::CompilerJob{<:Any,TestCompilerParams}) = method_table

kernel() = nothing

Expand Down
39 changes: 23 additions & 16 deletions src/GPUCompiler.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ using ExprTools: splitdef, combinedef

using Libdl

using Serialization
using Scratch: @get_scratch!
using Preferences

const ENABLE_TRACY = parse(Bool, @load_preference("tracy", "false"))
Expand All @@ -35,8 +33,21 @@ end
const CC = Core.Compiler
using Core: MethodInstance, CodeInstance, CodeInfo

compile_cache = nothing # set during __init__()
const pkgver = Base.pkgversion(GPUCompiler)
# `HAS_INTEGRATED_CACHE` distinguishes 1.11+ (owner-keyed `Core.Compiler.InternalCodeCache`)
# from 1.10 (per-interpreter `CodeCache` IdDict + invalidation callbacks). The two have
# disjoint shapes; everything cache-related fans on this flag.
const HAS_INTEGRATED_CACHE = VERSION >= v"1.11.0-DEV.1552"

# Loads as an empty shell on 1.10; on 1.11+ provides `CacheView`, `typeinf!`,
# `get_codeinfos`, `lookup`, `results`, etc. We `import` the module name (not its
# exports) to avoid clashing with `LLVM.lookup`; internal call sites qualify with
# `CompilerCaching.`.
import CompilerCaching

# Optional callback invoked from `compile(...)` / `cached_compilation(...)` before
# compilation runs. Set by `@device_code_*` reflection macros. Defined here (early)
# so the legacy `cached_compilation` in deprecated.jl can reference it.
const compile_hook = Ref{Union{Nothing,Function}}(nothing)

include("utils.jl")
include("mangling.jl")
Expand All @@ -54,6 +65,7 @@ include("metal.jl")
include("runtime.jl")

# compiler implementation
include("deprecated.jl")
include("jlgen.jl")
include("irgen.jl")
include("optim.jl")
Expand All @@ -67,24 +79,19 @@ include("driver.jl")
include("execution.jl")
include("reflection.jl")

include("deprecated.jl")

include("precompile.jl")

function __init__()
STDERR_HAS_COLOR[] = get(stderr, :color, false)

dir = @get_scratch!("compiled")
## add the Julia version
dir = joinpath(dir, "v$(VERSION.major).$(VERSION.minor)")
## also add the package version
if pkgver !== nothing
# XXX: `Base.pkgversion` is buggy and sometimes returns `nothing`, see e.g.
# JuliaLang/PackageCompiler.jl#896 and JuliaGPU/GPUCompiler.jl#593
dir = joinpath(dir, "v$(pkgver.major).$(pkgver.minor)")
@static if !HAS_INTEGRATED_CACHE
# session-local results keyed by objectid+world; entries serialized during
# GPUCompiler's own precompilation can never be valid in a later session
empty!(job_results)
# ditto for the in-process CodeCaches: CIs deposited by our own precompile
# workload carry world ages from the precompilation process
empty!(GLOBAL_CI_CACHES)
end
mkpath(dir)
global compile_cache = dir

@static if ENABLE_TRACY
Tracy.@register_tracepoints()
Expand Down
2 changes: 0 additions & 2 deletions src/bpf.jl
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ end

## job

runtime_slug(job::CompilerJob{BPFCompilerTarget}) = "bpf"

const bpf_intrinsics = () # TODO
isintrinsic(::CompilerJob{BPFCompilerTarget}, fn::String) = in(fn, bpf_intrinsics)

Expand Down
Loading
Loading