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

Closed
philkd wants to merge 1 commit from upstream-pr/314 into main
philkd commented 2026-11-23 23:07:39 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by philkd on 2026-11-23T23:07:39Z.


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 title (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: 9cc6a39e
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: 9cc6a39e
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

Not tested

  • AMD CPUs (they run CLZERO natively), AMD GPUs, Windows 10, entering the game world

AI use

  • Claude Code with Claude Opus 5.5: found the cause, wrote the change, ran the tests and the regression runs
<!-- greyfinch-sync:ivall/xcl:issue:6570704202 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/314). Originally posted by [philkd](https://github.com/philkd) on 2026-11-23T23:07:39Z. --- 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 title (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: 9cc6a39e 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: 9cc6a39e 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 ``` **Not tested** - AMD CPUs (they run CLZERO natively), AMD GPUs, Windows 10, entering the game world **AI use** - Claude Code with Claude Opus 5.5: found the cause, wrote the change, ran the tests and the regression runs
nullmarsh commented 2026-11-24 07:04:47 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by nullmarsh on 2026-11-24T00:05:07Z.


This now conflicts with main (3516080), and main already has the same check: #306 (a99f64c, "no VirtualQuery at every emulated instruction") added if bytes > 0 && crate::gpu::uma::get().is_some_and(|u| u.in_committed_window(va, bytes)) { return true; } to is_writable in eh.rs. So this PR looks superseded, unless you meant to cover something #306 doesn't.

AI use

  • Claude Code (Claude Opus 5.5) checked the merge and wrote this note; I checked it before posting.
<!-- greyfinch-sync:ivall/xcl:comment:7117685543 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/314#issuecomment-7117685543). Originally posted by [nullmarsh](https://github.com/nullmarsh) on 2026-11-24T00:05:07Z. --- This now conflicts with `main` (`3516080`), and `main` already has the same check: #306 (`a99f64c`, "no VirtualQuery at every emulated instruction") added `if bytes > 0 && crate::gpu::uma::get().is_some_and(|u| u.in_committed_window(va, bytes)) { return true; }` to `is_writable` in `eh.rs`. So this PR looks superseded, unless you meant to cover something #306 doesn't. **AI use** - Claude Code (Claude Opus 5.5) checked the merge and wrote this note; I checked it before posting.
upstream-sync closed this pull request 2026-11-24 10:04:01 +00:00
philkd commented 2026-11-24 10:04:39 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by philkd on 2026-11-24T09:13:19Z.


Closing: #306 (merged) takes the same VirtualQuery out of the CLZERO path, and more.

<!-- greyfinch-sync:ivall/xcl:comment:7127118173 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/314#issuecomment-7127118173). Originally posted by [philkd](https://github.com/philkd) on 2026-11-24T09:13:19Z. --- Closing: #306 (merged) takes the same VirtualQuery out of the CLZERO path, and more.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
xcl-dev/xcl!311
No description provided.