AGC (NVIDIA RTX 4060, Windows): agc_driver_graphics intermittently copies a sparse block's newly committed tail as zeros when the block lands inside the guest arena range #24860

Open
opened 2026-11-21 07:39:32 +00:00 by ShootanoJumper · 0 comments
ShootanoJumper commented 2026-11-21 07:39:32 +00:00 (Migrated from github.com)
Contributor

Imported from boykopovar/AnyPS5. Originally posted by ShootanoJumper on 2026-11-21T07:39:32Z.


agc_driver_graphics (and agc_graphics_profile_draw, same binary) fails intermittently on Windows in spaceCommittedPagesTests (added in #6955):

AGC graphics: a cached address space served another commit state of its pages: first build after the commit

Hardware: Windows 11 Education 23H2 (10.0.22631), AMD Ryzen 7 5700X, NVIDIA RTX 4060. Main at b9526c7424.

How often: it failed in both full ctest --parallel 6 runs I made while 16 spinning threads loaded the CPU, and in none of 3 idle full runs. Running six copies of agc_driver_graphics_tests.exe at once under the same load reproduced it 23 times. Failures came in whole rounds: all six runs in a round failed, or none did. Alone, the test passed every time, idle or loaded.

What differs in failing runs: where reserveSparse's VirtualAlloc(nullptr, 3 * 64 KiB, MEM_RESERVE, ...) places the block.

block base runs result
inside the guest arena range (0x10000 + 0xfbffff0000 here), e.g. 0x1510000, 0x10a0000, 0xb70000 23 all failed
above it, 0xfc0... 34 all passed

The low addresses are gaps in host regions the arena left alone at startup, which become free once whatever owned them is released.

Local diagnostics at the failing check (not part of any PR):

  • The cache was rebuilt for the generation change (rebuiltGeneration +1, no hit), so it was not served stale.
  • No mirror was made for the block (acquireMirror returned null), so it was copied.
  • The copied region's backed held only the head piece (backed=1, buffer 2 * 64 KiB + 256 bytes), even though the tail was committed and filled with 0x72 before the build.
  • The byte read at the tail was 0.

In passing runs the same build had backed=2 and a 3 * 64 KiB buffer.

So the commit made by VirtualAlloc(block + 2 * unit, unit, MEM_COMMIT, ...) inside the test's Mutation was not seen by DescribeCommitted when the block sat inside the arena range. That points at the page-state cache in GuestMemory.cpp (describePages / PageSpan), whose arena span covers these host gaps. Commits there come from the host, not the arena, so the arena's access observer never reports them, and the empty Mutation records no changed range.

I have not confirmed this. A direct probe (commit a stack page in a host region after DescribeCommitted has seen it uncommitted) read back correctly on main. I also have no deterministic reproduction, because I can't create a free gap inside the arena range on demand. Skipping pages.record for runs that overlap GuestArenaHostRegionOverlaps_nid_postfix is a candidate fix. I could not verify it: no gap came up in the 48 runs after I made the change.

AI-assisted: yes

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:6526117054 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/24860). Originally posted by [ShootanoJumper](https://github.com/ShootanoJumper) on 2026-11-21T07:39:32Z. --- `agc_driver_graphics` (and `agc_graphics_profile_draw`, same binary) fails intermittently on Windows in `spaceCommittedPagesTests` (added in #6955): ``` AGC graphics: a cached address space served another commit state of its pages: first build after the commit ``` **Hardware:** Windows 11 Education 23H2 (10.0.22631), AMD Ryzen 7 5700X, NVIDIA RTX 4060. Main at `b9526c7424`. **How often:** it failed in both full `ctest --parallel 6` runs I made while 16 spinning threads loaded the CPU, and in none of 3 idle full runs. Running six copies of `agc_driver_graphics_tests.exe` at once under the same load reproduced it 23 times. Failures came in whole rounds: all six runs in a round failed, or none did. Alone, the test passed every time, idle or loaded. **What differs in failing runs:** where `reserveSparse`'s `VirtualAlloc(nullptr, 3 * 64 KiB, MEM_RESERVE, ...)` places the block. | block base | runs | result | |---|---|---| | inside the guest arena range (`0x10000 + 0xfbffff0000` here), e.g. `0x1510000`, `0x10a0000`, `0xb70000` | 23 | all failed | | above it, `0xfc0...` | 34 | all passed | The low addresses are gaps in host regions the arena left alone at startup, which become free once whatever owned them is released. Local diagnostics at the failing check (not part of any PR): - The cache was rebuilt for the generation change (`rebuiltGeneration` +1, no hit), so it was not served stale. - No mirror was made for the block (`acquireMirror` returned null), so it was copied. - The copied region's `backed` held only the head piece (`backed=1`, buffer `2 * 64 KiB + 256` bytes), even though the tail was committed and filled with `0x72` before the build. - The byte read at the tail was `0`. In passing runs the same build had `backed=2` and a `3 * 64 KiB` buffer. So the commit made by `VirtualAlloc(block + 2 * unit, unit, MEM_COMMIT, ...)` inside the test's `Mutation` was not seen by `DescribeCommitted` when the block sat inside the arena range. That points at the page-state cache in `GuestMemory.cpp` (`describePages` / `PageSpan`), whose arena span covers these host gaps. Commits there come from the host, not the arena, so the arena's access observer never reports them, and the empty `Mutation` records no changed range. I have not confirmed this. A direct probe (commit a stack page in a host region after `DescribeCommitted` has seen it uncommitted) read back correctly on main. I also have no deterministic reproduction, because I can't create a free gap inside the arena range on demand. Skipping `pages.record` for runs that overlap `GuestArenaHostRegionOverlaps_nid_postfix` is a candidate fix. I could not verify it: no gap came up in the 48 runs after I made the change. AI-assisted: yes
Sign in to join this conversation.
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
boykopovar/AnyPS5#24860
No description provided.