Repository navigation
Intel: mwaitx waits sleep on the fence value (VICTORY_MWAITX_SLEEP=1) - #1029
alexis27yt wants to merge 1 commit into
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
5019f04 to
3f6878c
Compare
|
Side note, not part of this PR: copies and compares on a 6-core part are bound by memory, not by thread count. While looking at the submit thread I measured
From 4 threads on, all settings sit at 25-27 GB/s, inside run-to-run noise: the default ( What it does say: 80 MB of copy + compare costs ~6 ms of raw memory time here, against the ~80 ms a frame your README measures for those stages in game. If that holds, most of that time goes to per-range work (thousands of small ranges, locks, title reads, guard faults) rather than to moving bytes. I can't profile that without game files, but I hope the number helps. |
|
Tested in-game on Windows 10 Pro (22H2), Intel i5-13600K (6P+8E), RTX 4080 16 GB (driver 621.01, Series X profile), 420 s run in the prison cell scene (ca8829f + #1014 + #1015 + #1016 + #1029 + #1032 stacked, compared against our 600 s 465b94f run with the same base switches VICTORY_ASYNC_SUBMIT=1 VICTORY_QUEUE2=1 VICTORY_COPY_PLAIN=1 VICTORY_INDIRECT_WINDOW=1 VICTORY_JOIN_PARTS=1 VICTORY_BACK_OWN_VIEW=1 VICTORY_INDIRECT_GATHER=1 plus VICTORY_RELAY=2 VICTORY_LATE_WAIT=3 VICTORY_GROUP_SYNC=2 VICTORY_WIDE_BACK=1 VICTORY_CARD_BUFFERS_MIN_MB=1 VICTORY_CARD_BUFFERS_MB=1024). Real-game Intel i5-13600K A/B (VICTORY_MWAITX_SLEEP=1 on vs off in the same cell scene):
AI-assisted (Gemini 4 Hydrogen). |
On an Intel processor every
monitorxandmwaitxof the title's fence wait is an illegal-instruction exception (README: ~280,000 a second in game), so one hardware thread is kept busy in Windows' exception dispatch for the whole wait. On a 6-core part that thread may share a core with the layer's submit thread.Two switches, both off by default:
VICTORY_MWAITX_SLEEP=1: once a wait has spunVICTORY_MWAITX_SPIN_US(50 by default),mwaitxsleeps withWaitOnAddresson the monitored 8 bytes (up to 1 ms);fence::setcallsWakeByAddressAllon the fence value when it moves. Any other writer is seen within 1 ms (timeBeginPeriod(1)). The 5-second line now counts sleeps woken and timed out.VICTORY_MWAITX_PATCH=1:monitorx/mwaitxpatched in place at their first exception (nop dword [rax];pause+ nop), asclwbalready is.Measured on an i5-12400F + RTX 4070 SUPER with a new hand-run test that runs the title's loop shape (
monitorx, check,mwaitx, again) through the same emulation, 5 waits of 1 s each (cargo test --release -p victory-loader the_fence_wait_loop_costs -- --ignored --nocapture):Not measured in game yet (frame rate effect unknown); the tester's machine has no game files. Unit tests added for the stand-in bytes, a patched page running, and a wake on a moving word; all pass on the i5-12400F. Builds clean with clippy, no new warnings.