Repository navigation
POCL: cheaper launches and less compilation per kernel - #923
Merged
Merged
Conversation
Contributor
Benchmark ResultsShow table
Benchmark PlotsA plot of the benchmark results have been uploaded as an artifact to the workflow run for this PR. |
This was referenced Oct 25, 2026
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #923 +/- ##
==========================================
- Coverage 82.91% 82.50% -0.41%
==========================================
Files 31 31
Lines 2499 2510 +11
==========================================
- Hits 2072 2071 -1
- Misses 427 439 +12 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
maleadt
marked this pull request as draft
October 25, 2026 21:25
maleadt
marked this pull request as ready for review
October 26, 2026 05:44
maleadt
marked this pull request as draft
October 26, 2026 05:45
Every launch called `clfunction`, which takes a global lock, builds a compiler job and queries GPUCompiler's cache: about 2700 of the 9800 instructions of a small launch on the queue. Wrap the lookup in `GPUCompiler.cached_lookup`, which remembers the compiled kernel per callable and argument types and reuses it while the task's world age, the session's context and the compiler options are unchanged. Only the compiled kernel is kept, not the callable.
Each new kernel, or new closure type launched through the same `@kernel`, inferred and compiled the POCL launch path anew, although most of it doesn't depend on the kernel's types: looking up the compiled kernel (the lock, compiler configuration, GPUCompiler's cache and the link), waiting for the kernel, and the work-group size queries. Move those into functions that are compiled once, leaving only the argument conversion and the construction of the kernel object specialized. This cuts the first launch of a new kernel by about a third: from 749M to 474M instructions (104 to 73 ms) for a trivial kernel, and from 886M to 654M (110 to 84 ms) for a reduction with a new closure, which puts it below KernelAbstractions 0.10.1.
Every launch queried the kernel's maximum work-group size and preferred work-group size multiple from PoCL, three times in all: twice to choose a work-group size and once to check it. They don't change for a kernel, so query them when creating it. This saves about 570 instructions per launch.
maleadt
force-pushed
the
tb/pocl-launch-cache
branch
from
October 26, 2026 07:40
71ef0ea to
35c64db
Compare
maleadt
marked this pull request as ready for review
October 26, 2026 07:48
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Split out of #906, where it was reviewed as part of the host-kernel work. It helps the queue path on its own.
clfunction, which takes a global lock, builds a compiler job and queries GPUCompiler's cache. The lookup is now wrapped inGPUCompiler.cached_lookup(Addcached_lookupto cache kernel lookups per signature GPUCompiler.jl#1061, hence the bump to GPUCompiler 2.18), keyed on the session's context and the compiler options. Only the compiled kernel is cached, not the callable. A hit goes from 2797 to 56 instructions.First launch of a new kernel (ms, median, empty PoCL kernel cache, 9950X,
-t 8,0):