test(agc): reserve the direct write completion surfaces as one aligned block #15547

Merged
dantdmdarealguy merged 1 commit from upstream-pr/15547 into main 2026-11-07 08:38:38 +00:00
dantdmdarealguy commented 2026-11-03 18:35:52 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by dantdmdarealguy on 2026-11-03T18:35:52Z.


What

agc_driver_direct_write_completion fails on every run on NVIDIA under Windows. On main 1e658521a0 with an RTX 5080 it stops at DirectWriteCompletion.cpp:246:

[direct write completion] 15 of 15 runs held the image results pending, 12 dropped them
AGC graphics: direct write completion: the completion of a buffer write dropped image results recorded after it

A first-parent bisect puts the start at #13159 (8009be68d7, GDS on the GPU). Its first parent f01a601be2 passes 3/3. This is not a driver bug; the test depended on where its memory landed. Since #13159 the VulkanDevice constructor calls Pm4::GdsImportable(), which runs GdsAddress(). That maps the 64 KiB GDS at the guest arena base when the device is created, on every GPU. Before, it was mapped on first GDS use, which this test never reaches. The test took each 256 KiB surface from the arena separately and expected them to start at the arena base. Now they start at 0x200010000. importRunBounds only joins neighbouring ranges into a power-of-two block whose edges match range edges, so no run forms. Each surface is imported alone (host import of 0x200010000+0x40000, 16 imports of 0.25 MiB), below the 1 MiB settle floor. As d3b2d56b20 notes, a device that settles Windows imports and keeps them watched drops the results of such an import by design. The Intel UHD 770 has no second queue to settle on, uses comparisons, and passes either way. Linux never takes this path.

The test now carves its 32 surfaces out of one 8 MiB reservation aligned to its own size. They form one settled import (host import of 0x200800000+0x800000) whatever else the arena holds. The test still guards the behaviour it was written for: with StorageTexture::StampKeepingNewerResults reduced to return stamp();, the changed test fails with 15 of 15 dropped.

Tested

Windows 11 Pro, Intel Core i9-14900K, 128 GB RAM, NVIDIA GeForce RTX 5080 (driver 32.0.16.1742) and Intel UHD Graphics 770 (ANYPS5_GPU), WinLibs GCC 15.2.0, Release.

  • ctest -R '^agc_driver_direct_write_completion$' on the RTX 5080: main failed 3/3 (9, 10 and 12 of 15 dropped). The change passed 16/16.
  • On the UHD 770 both main and the change pass.
  • With VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, ANYPS5_NO_SHADER_CACHE=1 and ANYPS5_REQUIRE_VULKAN=1 (ctest -V, non-elevated), on both GPUs, for main and the change:
    • The layer was inserted in every log, and no log contains was not found but was requested by env var VK_INSTANCE_LAYERS.
    • There were no VUID- errors on main or with the change.
    • RTX 5080: main failed (12 dropped) and the change passed. UHD 770: both passed.
  • Linux (Arch WSL2, GCC 16.1, lavapipe / Mesa llvmpipe): the changed test passes 3/3.
  • cmake --build (all and libs), ctest -R "^agc_driver_direct_write_completion$|patched_libraries", tools/check_test_registration.py and tools/check_conventions.py all pass.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: NVIDIA GeForce RTX 5080, driver 32.0.16.1742, Windows 11 Pro; Intel UHD Graphics 770, Windows 11 Pro; llvmpipe (lavapipe, Mesa, LLVM 22.1.6), Arch Linux on WSL2
  • AI-assisted: yes, some AI assistance was used
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5142578884 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/15547). Originally posted by [dantdmdarealguy](https://github.com/dantdmdarealguy) on 2026-11-03T18:35:52Z. --- ### What `agc_driver_direct_write_completion` fails on every run on NVIDIA under Windows. On `main` `1e658521a0` with an RTX 5080 it stops at `DirectWriteCompletion.cpp:246`: ``` [direct write completion] 15 of 15 runs held the image results pending, 12 dropped them AGC graphics: direct write completion: the completion of a buffer write dropped image results recorded after it ``` A first-parent bisect puts the start at #13159 (`8009be68d7`, GDS on the GPU). Its first parent `f01a601be2` passes 3/3. This is not a driver bug; the test depended on where its memory landed. Since #13159 the `VulkanDevice` constructor calls `Pm4::GdsImportable()`, which runs `GdsAddress()`. That maps the 64 KiB GDS at the guest arena base when the device is created, on every GPU. Before, it was mapped on first GDS use, which this test never reaches. The test took each 256 KiB surface from the arena separately and expected them to start at the arena base. Now they start at `0x200010000`. `importRunBounds` only joins neighbouring ranges into a power-of-two block whose edges match range edges, so no run forms. Each surface is imported alone (`host import of 0x200010000+0x40000`, 16 imports of 0.25 MiB), below the 1 MiB settle floor. As d3b2d56b20 notes, a device that settles Windows imports and keeps them watched drops the results of such an import by design. The Intel UHD 770 has no second queue to settle on, uses comparisons, and passes either way. Linux never takes this path. The test now carves its 32 surfaces out of one 8 MiB reservation aligned to its own size. They form one settled import (`host import of 0x200800000+0x800000`) whatever else the arena holds. The test still guards the behaviour it was written for: with `StorageTexture::StampKeepingNewerResults` reduced to `return stamp();`, the changed test fails with 15 of 15 dropped. ### Tested Windows 11 Pro, Intel Core i9-14900K, 128 GB RAM, NVIDIA GeForce RTX 5080 (driver 32.0.16.1742) and Intel UHD Graphics 770 (`ANYPS5_GPU`), WinLibs GCC 15.2.0, Release. - `ctest -R '^agc_driver_direct_write_completion$'` on the RTX 5080: `main` failed 3/3 (9, 10 and 12 of 15 dropped). The change passed 16/16. - On the UHD 770 both `main` and the change pass. - With `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation`, `ANYPS5_NO_SHADER_CACHE=1` and `ANYPS5_REQUIRE_VULKAN=1` (`ctest -V`, non-elevated), on both GPUs, for `main` and the change: - The layer was inserted in every log, and no log contains `was not found but was requested by env var VK_INSTANCE_LAYERS`. - There were no `VUID-` errors on `main` or with the change. - RTX 5080: `main` failed (12 dropped) and the change passed. UHD 770: both passed. - Linux (Arch WSL2, GCC 16.1, lavapipe / Mesa llvmpipe): the changed test passes 3/3. - `cmake --build` (all and `libs`), `ctest -R "^agc_driver_direct_write_completion$|patched_libraries"`, `tools/check_test_registration.py` and `tools/check_conventions.py` all pass. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: NVIDIA GeForce RTX 5080, driver 32.0.16.1742, Windows 11 Pro; Intel UHD Graphics 770, Windows 11 Pro; llvmpipe (lavapipe, Mesa, LLVM 22.1.6), Arch Linux on WSL2 - [x] AI-assisted: yes, some AI assistance was used
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
boykopovar/AnyPS5!15547
No description provided.