Skip to content

feat(gpu): 64-bit atomic-lock rounds on by default under Wine - #307

Merged
pragyaangaur merged 4 commits into
pragyaangaur:mainfrom
hackgods:feat/atomic-lock-rounds-default
Nov 26, 2026
Merged

pragyaangaur merged 4 commits into
pragyaangaur:mainfrom
hackgods:feat/atomic-lock-rounds-default

Conversation

@hackgods

Copy link
Copy Markdown
Contributor

Makes the 64-bit atomic-lock rounds from #257 the default wherever the atomic locks are on (under Wine, or with VICTORY_ATOMIC_LOCKS=1), as asked on #240. VICTORY_ATOMIC_LOCK_ROUNDS=0 goes back to the turns alone. It is one change of its own, so a regression bisects to it.

In-game results from #240

Mac Comparison Frame median GPU median GPU resets / queue recoveries
M2 Max (sys-skye) turns → rounds (different builds) 7.9 s → 2.5 s 7.5 s → 2.0 s 5 (then WindowServer's watchdog) → 0
M4 Pro (evan-kolberg) same binary, only VICTORY_ATOMIC_LOCK_ROUNDS changed 5.29 s → 0.71 s 5.20 s → 0.29 s 32+ → 0
M4, 16 GB (Stefa008) same build, only the switch changed 2.9 s → 0.88 s 1.3 s → 0.30 s 8 → 0

sys-skye reports characters and hair drawn correctly with rounds on, and Stefa008 saw nothing broken. The synthetic timing is 4.5–6.0× faster per wave-wide 64-bit umax on two M5 Pros (macOS 26.6.2 by Nick233x, and 27.2.1) and an M2 Max.

The lost adds on #240 are not the rounds. patcliftongc's lost 64-bit adds happen in the turns too, under heavy contention. A lane that waits out the spin bound goes on without the lock. #306 fixes that and is independent of this PR.

What changed

  • shader_cache.rs: atomic_lock_rounds() is on with the locks unless VICTORY_ATOMIC_LOCK_ROUNDS=0 (the decision is in rounds_on). The option keys the shader cache, and so do this file's bytes, so translations are made again once.
  • docs/macos.md: the rounds are described as the default, with the in-game numbers above.

How tested

  • On an M5 Pro (64 GB, macOS 27.2.1, CrossOver 26.3 Wine, D3DMetal 4.0 beta 3), before and after: cargo test --workspace 541 passed, 0 failed both times. tools/macos/test-wine.sh --workspace --no-fail-fast 1,093 → 1,094 passed, 0 failed (the new test).
  • New test: lock_rounds_are_on_with_the_locks_unless_turned_off.
  • cargo clippy -p victory-gpu --all-targets --target x86_64-pc-windows-gnullvm -- -D warnings and cargo xtask policy pass. Only changed lines are formatted.

Thanks to sys-skye, evan-kolberg, Stefa008, Nick233x and cocobailey for the runs and measurements.

🤖 Generated with Claude Code

The rounds from pragyaangaur#257 are now on wherever the atomic locks are, and
VICTORY_ATOMIC_LOCK_ROUNDS=0 goes back to the turns alone, as asked on
pragyaangaur#240. In the game they took a world frame from 7.9 to 2.5 s on an M2 Max
(sys-skye), from 5.29 to 0.71 s on an M4 Pro (evan-kolberg, same binary)
and from 2.9 to 0.88 s on a 16 GB M4 (Stefa008), and the GPU resets and
queue recoveries of the turns stopped.

Test: lock_rounds_are_on_with_the_locks_unless_turned_off. docs/macos.md
describes the rounds as the default, with those numbers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@hackgods

Copy link
Copy Markdown
Contributor Author

In-game pair on an M5 Pro, as a no-regression check. It does not measure the gain: the scene does not run the 64-bit atomics.

Setup: M5 Pro, 64 GB, macOS 27.2.1, CrossOver 26.3 Wine, D3DMetal 4.0 beta 3, Series X. Both legs ran the same diagnostics binary of main 31c5047, from the same save, with the same key script. The switches were VICTORY_PATCH_MASKED=all VICTORY_FAULT_TRACKING=1 VICTORY_D3D12_DRED=1 VICTORY_GPU_TIMING=1 VICTORY_NO_HANG_WATCHDOG=1 VICTORY_STEP_OVER=pool, and only VICTORY_ATOMIC_LOCK_ROUNDS changed. Each leg ran 12 minutes, both from a cold shader cache. The numbers are medians of the 5 s renderer summaries with 500+ draws, from one minute after the last pipeline was built (102 and 104 summaries).

Turns (=0) Rounds (=1)
Frame median 665 ms 649 ms
Frame p90 754 ms 723 ms
GPU median 298 ms 299 ms
Preparing median 246 ms 242 ms
Draws median 4,693 4,719
Ended submissions, queue moves, GPU waits, Metal errors, crash reports 0 0

Both legs sat in the same indoor prologue shot. The pipeline log shows the alpha-prepass pixel shader 8ba01719b71d1d35 from evan-kolberg's yard runs created but never used in either leg. So this pair only shows that rounds cost nothing and broke nothing here. The yard's movement tutorial is where the gain shows on the other Macs.

Prepared with Claude Code. Text only, no game data.

@pragyaangaur
pragyaangaur merged commit 3ca7065 into pragyaangaur:main Nov 26, 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