Helper threads: KLBF_WIDE_THREADS and KLBF_WIDE_MIN for A/B runs (both off) #403
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/403"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from PastiiJay/klbf-lab. Originally posted by Zensura6427 on 2026-12-01T03:57:19Z.
As asked in #402: the helper-thread split as two switches, so it can be measured per CPU. Both are off by default: unset, nothing changes.
What it does
KLBF_WIDE_THREADS=1..16: the number of threads kept forwide()/wide_each(). Unset, it staysavailable_parallelism()/4clamped to 2..6 (3 on a 12-thread Ryzen 5 5600X). Read once (OnceLock) and logged at start (threads kept for work spread over threads).KLBF_WIDE_MIN=n: spreads of fewer thannpieces run on the calling thread, without waking the kept threads. Unset or invalid, it is 0, as before.work the preparing thread spread over the kept threadssplits that thread's time into its own jobs and waiting for the helpers' last jobs, and counts spreads run on the calling thread. It is also written when every spread ran there (first_lines_due).Only
crates/victory-gpu/src/shadow.rschanges. There are two unit tests (wide_threads_tests,wide_min_tests).Measured (RX 9070 XT + Ryzen 5 5600X, BM-v1 5:00, the same save, all CERTIFIED; details in #402)
KLBF_WIDE_THREADS=5KLBF_WIDE_THREADS=8KLBF_WIDE_MIN=8KLBF_WIDE_MIN=64With the default, the preparing thread stood about 30 ms a frame in spreads: 26.2 ms of its own jobs and 5.9 ms waiting. On this machine the frame rate stays within run-to-run noise (about ±0.7 fps). It is offered as a tool for measuring other CPUs, not as a speed-up.
Checked
v21(v26.11.24,92aa6f4); the patch applies cleanly.cargo test -p victory-gpu --lib shadow::: 46 passed.cargo clippy -p victory-gpu --all-targets --all-features --locked -- -D warnings: clean.b7f96e4). The shader fingerprint is unchanged (737ade6b88ac8104).Refs #402
🤖 Generated with Claude Code
Imported from PastiiJay/klbf-lab. Originally posted by PastiiJay on 2026-12-01T03:59:44Z.
thanks a lot @Zensura6427, that was quick! the team will review it and run it through the checks.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.