Skip to content

perf(gpu): a heap's dynamic slots are bits, searched a word at a time - #467

Merged
pragyaangaur merged 1 commit into
pragyaangaur:mainfrom
romainhedouin:perf/dynamic-slots-bitset
Nov 27, 2026
Merged

pragyaangaur merged 1 commit into
pragyaangaur:mainfrom
romainhedouin:perf/dynamic-slots-bitset

Conversation

@romainhedouin

Copy link
Copy Markdown
Contributor

The dynamic-slot set of a view heap is one bit a slot instead of one byte, and dynamic looks for a free run a word at a time; its results, and what release clears, are unchanged. It matters only where many slots are taken at once; how many dynamic searches run per frame, and how full the region gets, are unmeasured.

dynamic search, 262,144-slot region before after
first 4,096 slots taken, n=2 2.4-2.8 us (model) 0.10-0.12 us (model)
first 262,000 slots taken, n=2 151-172 us (model) 6.2-6.9 us (model)
runs of mean 8, n=2 4.7-5.5 ns (model) 2.1-2.4 ns (model)
set + clear a 256-slot run 4.7-5.0 ns (model) 6.4-6.7 ns (model, slower)
storage per heap 262,144 B (counted from the code) 32,768 B (counted from the code)

Tested: Windows clippy x2 clean; new unit test free_runs_are_found_across_words only type-checked here (CI runs it, no GPU needed); old and new logic agree in a standalone model (113 M single searches on heaps of 1-200 slots, 1.2 M allocate/release ops with arbitrary releases), not run under CrossOver. Merges cleanly with the open PRs touching this file (#444, #404, #439, #409).

🤖 Generated with Claude Code

The slots taken by lists not yet reset were one bool each, searched a
slot at a time under the heap's lock by every fresh table. As bits they
take an eighth of the memory, and the search reads whole words.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@pragyaangaur
pragyaangaur merged commit 6fde2dd into pragyaangaur:main Nov 27, 2026
1 check passed
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.

2 participants