Skip to content

test(agc): cover the graphics and compute COPY_DATA packets and the compute EVENT_WRITE - #11682

Merged
oneandonlydean merged 3 commits into
boykopovar:mainfrom
milescoviello:test/agc-copy-data-event-write
Nov 2, 2026
Merged

oneandonlydean merged 3 commits into
boykopovar:mainfrom
milescoviello:test/agc-copy-data-event-write

Conversation

@milescoviello

@milescoviello milescoviello commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

What

tests/Commands.cpp gets a testCopyDataAndComputeEvents case after testDebugRaiseException. sceAgcDcbCopyData writes a six-word COPY_DATA: a control word, then the source immediate or address and the destination address, two words each. In the control word the source and destination selects come from bits 1-4 of their arguments; the source cache policy is at bit 13, the item size at 16, write confirm at 20, the destination cache policy at 25, and the source argument's bit 0 is the engine at 30. With a 64-bit item size the immediate keeps its high word. sceAgcAcbCopyData takes the selects from bits 0-3 with engine 0. Cache policies, item sizes or write confirms out of range are refused with the whole buffer and cursor left unchanged, and both size getters report 24 bytes. A 64-bit immediate with a 32-bit item size is refused by the library too, but the console's behaviour there is not measured, so the test leaves it unpinned. sceAgcAcbEventWrite writes a two-word EVENT_WRITE (0x407 for event 7, which adds 0x400, and 0x16 as is); it refuses an event above 0x3f, and its size getter reports 8 bytes. A non-null address is refused only because that form is not implemented, so the test leaves it unpinned.

It is called by all eight titles run here for sceAgcAcbEventWrite; PPSA18194, PPSA21564, PPSA30839, PPSA31162, PPSA34502 and PPSA36591 for sceAgcDcbCopyData and sceAgcAcbCopyData (call sites found through the import's PLT stub in each title's relinked eboot.bin), and until now no test called it.

Changed: core/libs/prx/libSceAgc/tests/Commands.cpp. Test only, no change to the library.

Tested

Linux (Ubuntu 26.04, GCC 15.2), Release: cmake --build build --target agc_command_tests and ctest -R '^agc_commands$' --repeat until-fail:3 pass on this branch, which is current main plus the test. tools/check_conventions.py --base upstream/main passes.

Windows 11 (maskym's run, i7-12700K, WinLibs GCC 15.2, Release, Ninja): agc_commands passes at head d60b128671 merged into main f759e165d9, in a joint tree with other open PRs.

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: n/a
  • AI-assisted: yes

🤖 Generated with Claude Code

milescoviello and others added 2 commits October 27, 2026 02:31
…ompute EVENT_WRITE

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…unchanged

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@oneandonlydean

Copy link
Copy Markdown
Collaborator

Thanks, the expected packets check out against the PM4 layout. Three things:

  1. The positive graphics COPY_DATA case uses a destination address that isn't aligned. Could you use an aligned destination and update the expected low address word to match?
  2. sceAgcDcbCopyData with a 64-bit immediate and a 32-bit item size: the library refuses it, but what the console does there isn't measured, so please drop that expectFailure.
  3. sceAgcAcbEventWrite with a non-null address is refused only because it isn't implemented yet, so please drop that expectFailure too.

The out-of-range field and width checks are good to keep.

…asured refusals

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@milescoviello

Copy link
Copy Markdown
Contributor Author

@oneandonlydean All three are done in d60b128:

  1. The graphics COPY_DATA destination is now 0x1122334450, and the expected low address word is 0x22334450.
  2. The expectFailure for a 64-bit immediate with a 32-bit item size is gone.
  3. The expectFailure for sceAgcAcbEventWrite with a non-null address is gone.

The out-of-range field and width checks stay. Each one also checks, as on #11674, that the sentinel-filled buffer and cursor_up are unchanged (a85fda2). agc_initialization and agc_commands pass on Linux. The description now says the test leaves those two refusals unpinned.

AI-assisted: yes (Claude Code)

@milescoviello

Copy link
Copy Markdown
Contributor Author

Windows 11 VM (GT 1030, NVIDIA 582.66, WinLibs GCC 15.2.0, Release, Ninja): this head d60b128671 and its base main abed035 each build agc_command_tests, and agc_initialization and agc_commands pass 3 of 3 on both.

AI-assisted: yes (Claude Code)

@maskym

maskym commented Oct 27, 2026

Copy link
Copy Markdown
Contributor

Windows result for head d60b128671, merged into main f759e165d9 (the PR's Tested section names no Windows run).

Host: Windows 11 26300, Intel i7-12700K, WinLibs GCC 15.2.0 (x86_64-ucrt-posix-seh, r6), Release, BUILD_TESTING=ON, Ninja. Build clean.

The tree also carried the open PRs #11724, #11644, #11639, #11636, #11635, #11630, #11353, #11347, #11221, #10925, #11706, #11693, #11686, all merged cleanly, so the run is a joint one; the tests of this PR are agc_commands (0.06 s), all passed (the batch's mapped tests: 16/16, plus 43/43 for the Ngs2 and host-import suites). Not run on a PS5.

AI-assisted: yes (Claude Code), the runs and the numbers above are from this machine.

@milescoviello

Copy link
Copy Markdown
Contributor Author

@maskym thanks for the Windows run. I've added it to Tested.

AI-assisted: yes (Claude Code)

@oneandonlydean oneandonlydean self-assigned this Oct 28, 2026
@TechLevelZero

Copy link
Copy Markdown
Contributor

✅ NVIDIA GPU test: passed

PR head d60b128 merged onto main f6fddd6 · tested 2026-10-30 09:31 UTC · 13 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 ✅ 776 passed · 2 failed (0 new, 0 also fail on main, 2 unstable on main) · 8 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 786 of 2,950 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 (382 tests run on the GPU)
Slow tests (>30 s, GPU tests timed with validation layers) ⚠️ agc_driver_bda_device 54.8 s
Unstable on main (2, these also failed in recent main runs on this machine; not counted against this PR)
agc_submit_progress: failed in 5 of the last 8 main runs
agc_submit_progress_no_timeline: failed in 6 of the last 8 main runs
Validation IDs already present on main (3 IDs in 108 tests)
VUID-VkDeviceCreateInfo-pNext-pNext (108 tests): agc_driver, agc_driver_address_passes_draw_transitions, agc_driver_address_passes_targets_split, agc_driver_cmask_fast_clear, agc_driver_constant_dword_fill, agc_driver_copied_writer_copy, agc_driver_copied_writer_label_order, agc_driver_copy_surface_bytes, and 100 more
VUID-vkCmdCopyImage-srcImage-01548 (6 tests): agc_driver_depth_clear_hle, agc_driver_depth_plane_buffer_memory, agc_driver_depth_plane_partial_store, agc_driver_depth_storage_dispatch, agc_driver_depth_surface_from_storage, agc_driver_dispatch_move_depth
VUID-vkCmdCopyImage-srcImage-01551 (6 tests): agc_driver_depth_clear_hle, agc_driver_depth_plane_buffer_memory, agc_driver_depth_plane_partial_store, agc_driver_depth_storage_dispatch, agc_driver_depth_surface_from_storage, agc_driver_dispatch_move_depth
Skipped (8)
agc_driver_bda_reads_shadowed_results: skipped, the device reports watched host memory written when it imports or reads it
agc_driver_bda_reads_shadowed_results_per_build: skipped, the device reports watched host memory written when it imports or reads it
agc_driver_msaa_dcc_compared_import_2: skipped, the device reports host imports that keep write protection, so the write-watch probe compares none of them
agc_driver_msaa_dcc_compared_import_4: skipped, the device reports host imports that keep write protection, so the write-watch probe compares none of them
agc_driver_msaa_dcc_compared_import_8: skipped, the device reports host imports that keep write protection, so the write-watch probe compares none of them
agc_host_import_sparse: skipped, host imports are unavailable: /dev/udmabuf is not accessible
agc_import_settle_initial_dcc: skipped, the device has no deferred settle of host imports: imports under 1 MiB wait for one only on Windows
agc_unit_shadow_completion_store: skipped, the device reports watched host memory written when it imports or reads it
Reproduce
git fetch origin d60b128671909b5175502d9d3cf4e7976f98bde0 f6fddd60d826831f70f7c62e25423610ee742bcc
git checkout f6fddd60d826831f70f7c62e25423610ee742bcc && git merge --no-ff d60b128671909b5175502d9d3cf4e7976f98bde0
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.

@oneandonlydean
oneandonlydean merged commit d9cf524 into boykopovar:main Nov 2, 2026
13 of 14 checks passed
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.

4 participants