Skip to content

Console CPU instructions: no VirtualQuery for CLZERO into the coherent window - #308

Closed
philkd wants to merge 1 commit into
ivall:mainfrom
philkd:clzero-coherent-window
Closed

philkd wants to merge 1 commit into
ivall:mainfrom
philkd:clzero-coherent-window

Conversation

@philkd

@philkd philkd commented Nov 23, 2026 •

Copy link
Copy Markdown

Related to #278

What is in it

  • crates/xcl/src/eh.rs: is_writable returns early for a range inside the committed coherent window (+5 lines)

Tested

  • NVIDIA GeForce RTX 5080 (driver 621.01, 32-lane waves), Intel Core i5-12600K, Windows 11 22631, rustc 1.100.0, DXC from Windows SDK 10.0.26100.0; tests in debug, the game in release
  • cargo test --workspace -- --test-threads=4: 652 passed, 0 failed, 40 ignored (SKIPPED: gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask, gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware: no wave64)
  • No new test: the change only makes is_writable faster, its answer for the coherent window is the same as before, so a test that fails without it would have to time VirtualQuery
  • Retail GTA VI (Series package 1.0.2.1), XCL_NETWORK=0: ~1.5 fps → 30 fps (the title's frame clock) on the first-run and account screens, and it now reaches the Navigation menu. Before the fix, two thread dumps 5 s apart had the main thread in the exception handler under game_scarlett_master.exe+0x4e8aab0 (a CLZERO loop) both times
  • The smoke blocks say gpu: Virtual Desktop Monitor: smoke.ps1 takes the first display adapter, a virtual one on this machine; both runs were on the RTX 5080

Regression run

main:

xcl-smoke v1
commit: 4017f8ff8faaae6007fd83910d230a027dd85a33
gpu: Virtual Desktop Monitor
title: GTA6.Xbox.v1.0.2.1
seconds: 60
exit: 0x0
frames shown: 64 (PresentX 64)
presents per 2 s (last 3): 3 2 3
device removals: 0
crashes: 0
peak commit: 15015 MB

PR:

xcl-smoke v1
commit: df1efcd42b7a9f8bb98207b388b12f9eb72a9bcf
gpu: Virtual Desktop Monitor
title: GTA6.Xbox.v1.0.2.1
seconds: 60
exit: 0x0
frames shown: 1263 (PresentX 1263)
presents per 2 s (last 3): 60 40 7
device removals: 0
crashes: 0
peak commit: 18426 MB

…t window

On a CPU without CLZERO (Intel), every emulated CLZERO / CLZERO loop checked its target
with is_writable, which calls VirtualQuery. VirtualQuery sizes the region by walking it to
its end, and the coherent window is one committed region of up to 4 GiB: ~40 ms a call
(the cost uma::in_committed_window already notes for DirectStorage). The retail game runs
about 25 emulated instructions a second, nearly all of them CLZERO loops into that window,
and two thread dumps 5 s apart found its main thread in the exception handler both times:
1-2 presents a second.

The coherent window is committed and read-write as a whole, so a target inside it is
writable without asking; readable() and read_committed() already take this path.

Measured on the retail game (RTX 5080, i5-12600K): ~1.5 fps -> 30 fps (the title's frame
clock) on its first-run and account screens, and it reaches the Navigation menu.
@philkd philkd closed this Nov 23, 2026
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.

1 participant