Repository navigation
POCL: size the RNG state's local memory in elements - #907
Merged
Merged
Conversation
maleadt
added this pull request to stack #908
October 19, 2026 17:54
vchuravy
approved these changes
Oct 19, 2026
Contributor
Benchmark ResultsShow table
Benchmark PlotsA plot of the benchmark results have been uploaded as an artifact to the workflow run for this PR. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #907 +/- ##
==========================================
- Coverage 82.73% 82.61% -0.13%
==========================================
Files 28 28
Lines 2462 2467 +5
==========================================
+ Hits 2037 2038 +1
- Misses 425 429 +4 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
maleadt
force-pushed
the
tb/pocl-rng-localmem
branch
2 times, most recently
from
October 20, 2026 16:06
e7f4a08 to
4799422
Compare
`LocalMem(T, len)` takes a number of elements, but was passed the number of bytes of the per-sub-group RNG keys and counters, so kernels using random numbers reserved four times the local memory they use, which counts against the device's limit. Also count the kernel's arguments with `clGetKernelInfo` where the caller doesn't pass their number; `Kernel` has no `num_args` property.
maleadt
force-pushed
the
tb/pocl-rng-localmem
branch
from
October 22, 2026 11:57
4799422 to
f02d6a8
Compare
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.
Kernels that use random numbers get two local-memory arguments for the per-sub-group RNG keys and counters, one
UInt32per sub-group each.callpassed their size in bytes toLocalMem(UInt32, len), which takes a number of elements, so these kernels reserved four times the local memory they use. That counts against the device's local memory limit, e.g. for kernels that also use@localmem.This also fixes the fallback for when the caller doesn't pass the number of arguments. It read
k.num_args, whichKerneldoesn't have. It now queriesCL_KERNEL_NUM_ARGS. All current callers pass the number, but #906 doesn't.The new test checks the kernel's local memory size after launching an RNG kernel: 32 bytes for one sub-group on main, 8 with this PR.