Skip to content

Switch POCL backend to CompilerCaching.jl#728

Open
vchuravy wants to merge 2 commits into
mainfrom
vc/compilercaching
Open

Switch POCL backend to CompilerCaching.jl#728
vchuravy wants to merge 2 commits into
mainfrom
vc/compilercaching

Conversation

@vchuravy

@vchuravy vchuravy commented Jul 10, 2026

Copy link
Copy Markdown
Member

Adopts the new GPUCompiler 2.0 caching API for the POCL backend, x-ref JuliaGPU/GPUCompiler.jl#794, following the same approach as JuliaGPU/OpenCL.jl#431:

  • Compilation artifacts (SPIR-V bytes, entry name, device_rng flag) now live in an OpenCLResults struct managed by GPUCompiler.cached_results, i.e. attached to the CodeInstance in Julia's integrated code cache on 1.11+ (persisting through precompilation) instead of the legacy per-context cached_compilation dictionaries.
  • Linked cl.Kernel handles are session-local and kept in a small per-context linear cache on the results struct; they are not populated while precompiling, so no dangling handles end up in package images.
  • GPUCompiler.reset_runtime() is gone (the runtime library is cached through the same mechanism now).
  • Adds a compilation-cache regression test mirroring the one from the OpenCL.jl PR.

GPUCompiler 2.0 is now registered, so the [sources] branch pin is dropped and the compat bound is "2". compile_or_lookup is adapted to the released cached_results API, which returns nothing until code exists for the job and is re-fetched after compiling — matching the final form merged in JuliaGPU/OpenCL.jl#431.

🤖 Generated with Claude Code

vchuravy and others added 2 commits July 10, 2026 09:55
Adopts the GPUCompiler 2.0 caching API (JuliaGPU/GPUCompiler.jl#794):
compilation results are stored via `GPUCompiler.cached_results` on the
CodeInstance (Julia's integrated code cache on 1.11+, persisting through
precompilation) instead of the legacy per-context `cached_compilation`
dictionaries. Follows the same approach as JuliaGPU/OpenCL.jl#431.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Remove the `[sources]` pin to the `tb/compilercaching` branch; the caching
API it relied on shipped in the registered GPUCompiler 2.0 (compat is
already `"2"`).

Adapt `compile_or_lookup` to the released `cached_results` API: it now
returns `nothing` until code exists for the job (rather than always
materializing an empty results struct), so re-fetch after compiling —
which populates Julia's code cache — via `@something`. Matches the final
form merged in JuliaGPU/OpenCL.jl#431.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@vchuravy vchuravy marked this pull request as ready for review July 14, 2026 09:05
@github-actions

Copy link
Copy Markdown
Contributor

Benchmark Results

Show table
main 4de90e0... main / 4de90e0...
saxpy/default/Float32/1024 0.0844 ± 0.0082 ms 0.0844 ± 0.011 ms 1 ± 0.16
saxpy/default/Float32/1048576 0.492 ± 0.023 ms 0.496 ± 0.024 ms 0.993 ± 0.067
saxpy/default/Float32/16384 0.0661 ± 0.033 ms 0.0668 ± 0.033 ms 0.99 ± 0.7
saxpy/default/Float32/2048 0.082 ± 0.029 ms 0.0848 ± 0.024 ms 0.967 ± 0.44
saxpy/default/Float32/256 0.0846 ± 0.014 ms 0.0849 ± 0.013 ms 0.997 ± 0.22
saxpy/default/Float32/262144 0.172 ± 0.031 ms 0.176 ± 0.031 ms 0.975 ± 0.24
saxpy/default/Float32/32768 0.0729 ± 0.031 ms 0.0732 ± 0.031 ms 0.996 ± 0.59
saxpy/default/Float32/4096 0.0814 ± 0.031 ms 0.0807 ± 0.03 ms 1.01 ± 0.54
saxpy/default/Float32/512 0.0842 ± 0.01 ms 0.0844 ± 0.011 ms 0.998 ± 0.18
saxpy/default/Float32/64 0.084 ± 0.015 ms 0.0844 ± 0.013 ms 0.995 ± 0.24
saxpy/default/Float32/65536 0.0869 ± 0.03 ms 0.087 ± 0.031 ms 0.999 ± 0.5
saxpy/default/Float64/1024 0.0845 ± 0.013 ms 0.0845 ± 0.011 ms 1 ± 0.2
saxpy/default/Float64/1048576 0.578 ± 0.068 ms 0.575 ± 0.065 ms 1 ± 0.17
saxpy/default/Float64/16384 0.0673 ± 0.029 ms 0.0694 ± 0.03 ms 0.97 ± 0.6
saxpy/default/Float64/2048 0.0813 ± 0.031 ms 0.0832 ± 0.028 ms 0.978 ± 0.5
saxpy/default/Float64/256 0.0848 ± 0.012 ms 0.0846 ± 0.013 ms 1 ± 0.2
saxpy/default/Float64/262144 0.193 ± 0.036 ms 0.196 ± 0.036 ms 0.987 ± 0.26
saxpy/default/Float64/32768 0.0759 ± 0.029 ms 0.0761 ± 0.029 ms 0.997 ± 0.54
saxpy/default/Float64/4096 0.0762 ± 0.03 ms 0.0784 ± 0.029 ms 0.972 ± 0.52
saxpy/default/Float64/512 0.0843 ± 0.011 ms 0.0845 ± 0.012 ms 0.997 ± 0.19
saxpy/default/Float64/64 0.0837 ± 0.019 ms 0.0845 ± 0.013 ms 0.991 ± 0.27
saxpy/default/Float64/65536 0.0927 ± 0.03 ms 0.0935 ± 0.03 ms 0.991 ± 0.45
saxpy/static workgroup=(1024,)/Float32/1024 0.0817 ± 0.015 ms 0.0823 ± 0.012 ms 0.994 ± 0.23
saxpy/static workgroup=(1024,)/Float32/1048576 0.425 ± 0.033 ms 0.428 ± 0.033 ms 0.992 ± 0.11
saxpy/static workgroup=(1024,)/Float32/16384 0.0629 ± 0.031 ms 0.064 ± 0.031 ms 0.982 ± 0.68
saxpy/static workgroup=(1024,)/Float32/2048 0.0799 ± 0.029 ms 0.0825 ± 0.025 ms 0.968 ± 0.46
saxpy/static workgroup=(1024,)/Float32/256 0.0822 ± 0.01 ms 0.0829 ± 0.015 ms 0.991 ± 0.22
saxpy/static workgroup=(1024,)/Float32/262144 0.153 ± 0.031 ms 0.153 ± 0.031 ms 0.996 ± 0.29
saxpy/static workgroup=(1024,)/Float32/32768 0.0677 ± 0.028 ms 0.0687 ± 0.029 ms 0.985 ± 0.57
saxpy/static workgroup=(1024,)/Float32/4096 0.0768 ± 0.03 ms 0.0796 ± 0.029 ms 0.965 ± 0.52
saxpy/static workgroup=(1024,)/Float32/512 0.0821 ± 0.015 ms 0.0827 ± 0.011 ms 0.993 ± 0.22
saxpy/static workgroup=(1024,)/Float32/64 0.0822 ± 0.016 ms 0.0829 ± 0.014 ms 0.992 ± 0.25
saxpy/static workgroup=(1024,)/Float32/65536 0.0798 ± 0.029 ms 0.0809 ± 0.03 ms 0.986 ± 0.51
saxpy/static workgroup=(1024,)/Float64/1024 0.0813 ± 0.026 ms 0.0821 ± 0.012 ms 0.99 ± 0.35
saxpy/static workgroup=(1024,)/Float64/1048576 0.538 ± 0.081 ms 0.545 ± 0.081 ms 0.987 ± 0.21
saxpy/static workgroup=(1024,)/Float64/16384 0.064 ± 0.028 ms 0.0641 ± 0.028 ms 0.998 ± 0.61
saxpy/static workgroup=(1024,)/Float64/2048 0.0797 ± 0.032 ms 0.081 ± 0.029 ms 0.984 ± 0.52
saxpy/static workgroup=(1024,)/Float64/256 0.0822 ± 0.012 ms 0.0825 ± 0.011 ms 0.996 ± 0.2
saxpy/static workgroup=(1024,)/Float64/262144 0.189 ± 0.034 ms 0.19 ± 0.033 ms 0.995 ± 0.25
saxpy/static workgroup=(1024,)/Float64/32768 0.0731 ± 0.027 ms 0.073 ± 0.027 ms 1 ± 0.52
saxpy/static workgroup=(1024,)/Float64/4096 0.0728 ± 0.03 ms 0.0763 ± 0.029 ms 0.954 ± 0.53
saxpy/static workgroup=(1024,)/Float64/512 0.0824 ± 0.0085 ms 0.0822 ± 0.014 ms 1 ± 0.2
saxpy/static workgroup=(1024,)/Float64/64 0.0822 ± 0.017 ms 0.0822 ± 0.017 ms 1 ± 0.29
saxpy/static workgroup=(1024,)/Float64/65536 0.0902 ± 0.027 ms 0.0907 ± 0.027 ms 0.994 ± 0.42
time_to_load 1.05 ± 0.014 s 1.09 ± 0.019 s 0.968 ± 0.021

Benchmark Plots

A plot of the benchmark results have been uploaded as an artifact to the workflow run for this PR.
Go to "Actions"->"Benchmark a pull request"->[the most recent run]->"Artifacts" (at the bottom).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant