mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #2174] [CLOSED] pool: STRATA_POOL_UMWAIT - parked workers sleep with UMONITOR/UMWAIT instead of spinning (opt-in, -3.1% ms/window on a 12 GB laptop, bitwise) #3901
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#3901
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
📋 Pull Request Information
Original PR: https://github.com/Niko1221/Strata/pull/2174
Author: @zsariboga
Created: 10/12/2026
Status: ❌ Closed
Base:
main← Head:pr-pool-umwait📝 Commits (1)
b4f9112pool: STRATA_POOL_UMWAIT= - parked workers wait with UMONITOR/UMWAIT instead of spinning (opt-in, x86 WAITPKG, MSVC x64)📊 Changes
1 file changed (+57 additions, -2 deletions)
View changed files
📝
src/kernels/cpu/pool.cpp(+57 -2)📄 Description
What
STRATA_POOL_UMWAIT=<TSC cycles>(opt-in, x86 with WAITPKG, MSVC x64 builds): a parked CPU pool worker no longer spins on_mm_pause. It armsUMONITORon the epoch's cache line and sleeps inUMWAIT(C0.1) until the host publishes the nextphase (the write to that line wakes it in hardware) or the cycles run out; then it checks the clock and the sleep rule as
before.
STRATA_POOL_UMWAIT_C02=1: the deeper C0.2 state instead of C0.1.STRATA_POOL_UMWAIT_ESC=<cycles>: C0.1 for the first cycles of a park, C0.2 after (a long park is a GPU phase).0, a CPU without WAITPKG (CPUID.7.0:ECX[5], one line says so) or a non-MSVC build: the spin, unchanged.Why
On a laptop the CPU and the GPU share one power and thermal budget. During the GPU's part of a decode window the parked
workers spin, and that power is taken from the GPU (here
sw_power_capwas active in ~100% of the samples). Sleeping inUMWAIT gives it back; the wake on the publish is a hardware monitor, so a worker still starts the next phase at once.
Measured
RTX 5070 Ti Laptop 12 GB, Core Ultra 7 255HX (16 P+E cores, WAITPKG), 64 GB DDR5-5600, Windows 11, Swift 1.5 IQ3_XXS
(GSQ-RCO), the same config in every arm, mirrored order, engine ms per decode window, GPU power from
nvidia-smievery 500 ms:STRATA_POOL_UMWAIT=100000STRATA_POOL_UMWAIT=100000STRATA_POOL_UMWAIT=100000The sleep hands the GPU ~6 W, and it also lets more workers pay off (16 spinning workers had been slower than 13). C0.2
and the escalating wait were within the noise of C0.1 (28.57 / 28.68 vs 28.90 ms, inconsistent across mirrored pairs), so
C0.1 is the default state. Output is bitwise the same: only how a parked thread waits changes.
Running daily on this laptop since 10 October with
STRATA_POOL_UMWAIT=100000 --pool-workers 16. Built and smoke-testedon today's
main(a0116b27): the engine printsSTRATA_POOL_UMWAIT: parked workers wait with UMWAIT (100000 cycles),chat and tool calls answer as before.
Not done
GCC/Clang builds (they need
-mwaitpkgor a target attribute on the worker), andTPAUSEfor parks without a monitoredline. AMD CPUs have
MONITORX/MWAITXinstead; not tried.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.