Skip to content

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

Open
dantdmdarealguy wants to merge 1 commit into
boykopovar:mainfrom
dantdmdarealguy:agent/nvdirectwrite
Open

dantdmdarealguy wants to merge 1 commit into
boykopovar:mainfrom
dantdmdarealguy:agent/nvdirectwrite

Conversation

@dantdmdarealguy

Copy link
Copy Markdown
Contributor

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 d3b2d56 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

…d block

The test took each surface from the guest arena separately and relied on
them starting at the arena's first free address on a settled host import
block boundary. Since boykopovar#13159 the device maps the 64 KiB GDS at the arena
base when it is created, so every surface starts 64 KiB later, no
aligned run of surfaces forms, and each surface is imported alone below
the 1 MiB settle floor. On a device that settles Windows imports and
keeps them watched (NVIDIA) the results of such an import are dropped by
design, and the test failed with 9 to 13 of 15 runs dropped.

The surfaces are now carved out of one reservation aligned to its own
size, so they form one settled import whatever else the arena holds.
@dantdmdarealguy dantdmdarealguy changed the title test(agc): carve the direct-write completion surfaces from one aligned reservation test(agc): reserve the direct write completion surfaces as one aligned block Nov 3, 2026
@github-actions github-actions Bot added the agc libSceAgc* label Nov 3, 2026
@TechLevelZero

Copy link
Copy Markdown
Contributor

✅ NVIDIA GPU test: passed

PR head 113a4e0 merged onto main 1e65852 · tested 2026-11-03 19:10 UTC · 16 min

GPU NVIDIA RTX 2000 Ada Generation, driver 595.99.02, Vulkan 1.4.329
Host Ubuntu 26.04.1 LTS, kernel 7.0.0-38-generic, container ubuntu:24.04
Logs build and test logs for this run
Build ✅ passed (Release, -DANYPS5_ENABLE_SPIRV_TOOLS=ON)
Tests ✅ 1,077 passed · 2 failed (0 new, 1 also fail on main, 1 unstable on main) · 4 skipped (ANYPS5_REQUIRE_VULKAN=1)
Test setup CPU-only tests without a GPU; GPU tests (and any CPU-only test that failed or skipped without one) once on the GPU with VK_LAYER_KHRONOS_validation and ANYPS5_NO_SHADER_CACHE=1; main ran the same way
Test selection 1,083 of 3,818 tests run: the ones this change can reach, chosen by tools/select_tests.py from main's build graph
Vulkan validation ✅ no new validation IDs vs main (524 tests run on the GPU)
Slow tests (>30 s, GPU tests timed with validation layers) ⚠️ agc_driver_pipeline_journal 120.3 s, ⚠️ agc_driver_native_multisample_depth 30.0 s
Unstable on main (1, these also failed in recent main runs on this machine; not counted against this PR)
agc_driver_pipeline_journal: failed in 4 of the last 10 main runs
Failing on main too (1, not counted against this PR)
agc_driver_image_table
Passed on retry (1, failed in the parallel run, passed when re-run with a 360 s timeout; not counted against this PR)
agc_driver_native_multisample_depth: Timeout in the parallel run; also passed only on retry in 12 other runs in the last 7 days
Validation IDs already present on main (4 IDs in 447 tests)
VUID-VkDeviceCreateInfo-pNext-pNext (447 tests): agc_driver_address_passes, agc_driver_alias_copy_label, agc_driver_alpha_to_coverage, agc_driver_array_layer_target, agc_driver_bc_block_copy, agc_driver_bda_anchor_reads, agc_driver_bda_span_reads, agc_driver_bindless_images, and 439 more
VUID-vkCmdCopyImage-srcImage-01548 (7 tests): agc_driver_depth_clear_hle, agc_driver_depth_plane_buffer_memory, agc_driver_depth_plane_partial_store, agc_driver_depth_plane_sampling, agc_driver_depth_storage_dispatch, agc_driver_depth_surface_from_storage, agc_driver_dispatch_move_depth
VUID-vkCmdCopyImage-srcImage-01551 (7 tests): agc_driver_depth_clear_hle, agc_driver_depth_plane_buffer_memory, agc_driver_depth_plane_partial_store, agc_driver_depth_plane_sampling, agc_driver_depth_storage_dispatch, agc_driver_depth_surface_from_storage, agc_driver_dispatch_move_depth
VUID-VkPipelineColorBlendStateCreateInfo-pAttachments-00605 (1 test): agc_driver_srgb8_color_target
Skipped (4)
agc_driver_sample_order_grid_reference: skipped, the device does not keep depth drawn at custom sample locations at those locations, even after a transition that names them: the composite of uniform renders holds the guest's depth in 0 of 3005 sloped samples, so no path can be compared with it bit for bit
agc_driver_scattered_runs: skipped, host imports are unavailable: /dev/udmabuf is not accessible
agc_driver_sparse_dma_buf_import: skipped, host imports are unavailable: /dev/udmabuf is not accessible
agc_driver_stencil_ref_export: skipped, the device lacks VK_EXT_shader_stencil_export
Reproduce
git fetch origin 113a4e078b9b08492c1bd4937d344939cbd1624b 1e658521a0a599872612bb91949311e2956b5283
git checkout 1e658521a0a599872612bb91949311e2956b5283 && git merge --no-ff 113a4e078b9b08492c1bd4937d344939cbd1624b
git submodule update --init --recursive
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON -DANYPS5_ENABLE_SPIRV_TOOLS=ON
cmake --build build && cmake --build build --target libs
VK_DRIVER_FILES=/nonexistent/icd.json ctest --test-dir build -E '^(agc|shader|recompiler|videoout|video_out|guest_video_out|vulkan)|gpu' --timeout 120 --parallel 32 --output-on-failure
ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation \
  ctest --test-dir build -R '^(agc|shader|recompiler|videoout|video_out|guest_video_out|vulkan)|gpu' --timeout 120 --parallel 4 --output-on-failure
# failures are then re-run alone: --timeout 360 --parallel 2; new validation IDs: the test alone, twice, --parallel 1

Automated build and test on a contributor's NVIDIA machine; it does not replace upstream CI. A new comment is posted for each new push. Full logs.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agc libSceAgc*

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants