Skip to content

fix(agc): check a rejected submission's packets on its own queue in the report - #20236

Merged
oneandonlydean merged 1 commit into
boykopovar:mainfrom
adam25136:fix/agc-rejection-report-queue
Nov 22, 2026
Merged

oneandonlydean merged 1 commit into
boykopovar:mainfrom
adam25136:fix/agc-rejection-report-queue

Conversation

@adam25136

Copy link
Copy Markdown
Contributor

What

When AGC rejects a submission, Driver::dumpPackets prints a report that lists each packet type with the reason the packet check gives for its first packet of that type. It checked them as if they were on the graphics queue (Pm4::Validate(..., 0)), so the report for a compute queue's submission could give reasons that do not apply on that queue and leave out ones that do. For example, a COND_EXEC whose control word sets its cache policy is valid on a compute queue, but the report listed it with COND_EXEC reserved control fields are not implemented, and it listed a graphics-only CLEAR_STATE with no reason.

dumpPackets now takes the submission's queue from Driver::validate, checks each packet on it, and names it in the report's first line: [gpu] rejected submission of <n> dwords on queue 0x<queue> at guest <address>:. Nothing else in the repository parses that line.

testRejectionReportUsesTheSubmissionQueue in tests/Pm4.cpp submits to queue 0x20 a COND_EXEC with cache-policy bits, a WRITE_DATA, a typed user-data NOP that the check refuses and a CLEAR_STATE. It captures stderr and checks that the report names the queue, lists the COND_EXEC without the graphics-queue reason, and gives graphics packet in compute queue. The test file's CapturedStderr redirected only the process's standard error handle on Windows, which the report's fprintf does not write to: with that alone the test fails, as the report never reaches the capture. It now also points the C runtime's descriptor 2 at the capture file, as its Linux branch already does with dup2, and on its way out sets the standard error handle from the restored descriptor, as libc's RestoreStandard does. On Windows, the test then checks that the two agree.

Found while reading the rejection reports of a PS4 title's compute queue for #20127.

Overlap: tools/pr_overlap.py --branch (in a full clone, this head merged onto main 6667ad1664): 39 of 1,510 open pull requests share a file with this branch, and none of the 15 it could compare shares lines. It could not compare 24 that conflict with main (20 share Driver.hpp, 4 share tests/Pm4.cpp, one of them, #18914, also CommandValidation.cpp). In GitHub's patches of these, none edits the dumpPackets or validate declarations, dumpPackets itself, the dumpPackets calls in validate, CapturedStderr, or the test spot.

Tested

Windows 10 Pro 22H2 (19045), i9-12900KF, NVIDIA GeForce RTX 5080 (10de:2c02, driver 621.14), WinLibs GCC 15.2.0 r7, Release, BUILD_TESTING=ON, ANYPS5_ENABLE_SPIRV_TOOLS=OFF unless stated. Head 4ff4d22b17 on main 27578d8a54, rebased from 2797787010 on 0d2f004881 with the same changed lines; on it, agc_driver_pm4 passes 3 of 3 runs and all 29 agc_driver_pm4* tests pass. The results below are from 2797787010, except the selected tests, the validation runs and the layer check, which ran on a6c34de712 (the same driver change and an earlier version of the test) merged onto main 6b7f28803e.

  • agc_driver_pm4 passes in 3 of 3 runs, and all 29 agc_driver_pm4* tests pass. The 29 also pass in one run in a build with ANYPS5_ENABLE_SPIRV_TOOLS=ON (as the Linux CI job builds).
  • With CommandValidation.cpp and Driver.hpp from main (the test kept), agc_driver_pm4 fails with the rejection report does not name the submission's queue. With each part of the change reverted on its own (restored afterwards):
Reverted Fails with
the report checks on the submission's queue the rejection report checked a compute queue's COND_EXEC as a graphics-queue packet
the queue in the report's first line the rejection report does not name the submission's queue
CapturedStderr's C-runtime redirect on Windows the rejection report does not name the submission's queue (the report is not captured)

Setting the standard error handle back to the one saved at the start, as before, still passes here: the test does not tell that restore from the new one.

  • Selected tests: tools/select_tests.py picks 2,893 tests for the changed files. With a6c34de712 merged onto main (select_tests.py ctest build --parallel 4 --timeout 120, ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1), 2,873 run: 2,872 pass, and agc_driver_unregistered_label_on_gpu failed once (the label held 0x00000000 when a later label had landed), then passed 3 of 3 reruns. It fails now and then (AGC: agc_driver_unregistered_label_on_gpu fails now and then: two stores of one label run have no barrier between them #17937); its output has no rejection report, so this change's code did not run in it. The other 20 do not run, and all 20 also do not run in main's full suite on this machine (5,593 tests). One of them, agc_driver_upload_cache_read_only_flush, has a test program that does not build on Windows (setenv, open fix(tests): set the upload cache test's environment with _putenv_s on Windows #19899); both sides were built with ninja's -k 0, and it was the only target that failed.
  • Validation: the tests matching ^(agc|shader|recompiler|videoout|video_out|guest_video_out|vulkan)|gpu, 1,747 of the selection and 1,832 in main's run, through ctest -V --parallel 4 with VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation (1.4.367) and VK_LOADER_LAYERS_DISABLE=~implicit~: all pass, and both logs have the same 61 messages in the same 14 tests, with no new VUID- ID and no "was not found but was requested by env var VK_INSTANCE_LAYERS" line. With VK_LOADER_DEBUG=layer added, on that main and with a6c34de712 merged: agc_driver_alpha_to_coverage shows the loader inserting the layer on both sides, and the 29 agc_driver_pm4* tests pass on both sides with no loader line, since they do not open Vulkan.
  • python tools/check_conventions.py --base origin/main with this title and description: "All conventions checks passed."

Not covered: AMD and Intel GPUs, Linux, a PS5 or PS4.

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 (10de:2c02), driver 621.14, Windows 10 Pro 22H2
  • AI-assisted: yes. Claude Code found the cause, wrote the change and the test, ran the builds and tests, and drafted this description; separate review agents checked it.

🤖 Generated with Claude Code

…he report

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added the agc libSceAgc* label Nov 14, 2026
@github-actions

github-actions Bot commented Nov 14, 2026 •

Copy link
Copy Markdown

Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 5609 core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp
PR 5925 core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp
PR 6186 core/libs/prx/libSceAgcDriver/tests/Pm4.cpp
PR 6188 core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp
PR 6804 core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp
PR 7275 core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp
PR 7642 core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp
PR 9508 core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp
PR 10193 core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp
PR 10359 core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp
PR 11435 core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp
PR 11436 core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp
PR 12944 core/libs/prx/libSceAgcDriver/tests/Pm4.cpp
PR 13928 core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp
PR 13929 core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp
PR 15136 core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp
PR 15845 core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp
PR 20130 core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp
PR 20132 core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp
PR 20315 core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp
PR 22025 core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp
PR 22434 core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp
core/libs/prx/libSceAgcDriver/tests/Pm4.cpp
PR 22647 core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp
core/libs/prx/libSceAgcDriver/tests/Pm4.cpp
PR 23886 core/libs/prx/libSceAgcDriver/tests/Pm4.cpp

@ghost

ghost commented Nov 15, 2026

Copy link
Copy Markdown

Windows + NVIDIA (Blackwell) run of head 4ff4d22b17, merged with git merge --no-ff onto main ef4b9389b6 (clean merge).

Setup: Windows 11 Pro, NVIDIA GeForce RTX 5070 Ti, driver 621.01, Ryzen 7 5800X3D, WinLibs GCC 15.2.0 r7 UCRT, Release, BUILD_TESTING=ON, ANYPS5_REQUIRE_VULKAN=1. Both sides carry the diff of #19899, without which main does not compile on MinGW.

main ef4b9389b6 this PR
build completes completes
agc_driver_pm4 (built from the changed tests/Pm4.cpp), agc_driver_alpha_to_coverage, agc_driver_unregistered_label_on_gpu, agc_driver_upload_cache_read_only_flush pass 4 of 4 pass in 3 of 3 serial runs
same tests with ANYPS5_NO_SHADER_CACHE=1, VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation (1.4.363), VK_LOADER_DEBUG=layer, ctest -V pass, layer inserted, 0 VUID- lines pass, layer inserted, 0 VUID- lines
ctest -R '^(agc|shader|video_out|guest_video_out)' -j 12 0 failed 1850 tests, 0 failed, 20 skipped (the same skips as main)

AI-assisted: yes

@MarcZX10 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed — looks good

The change reports packet validation results using the rejected submission’s queue, and the inspected diff and source support merging.

What I ran

Reviewed head 4ff4d22b1761c524d076d3aaa9a73706f6c318fb. Read the prepared description, commit summary, manifest, diff, and all three changed files at the pinned head. Searched for dumpPackets callers. No commands or tests were run.

Results

Check Result Note
Diff and changed code passed All three changed files read
Tests not run Author-reported results only
Caller search passed Both report call sites pass the submission queue

Findings

Blocking

None.

Non-blocking

None.

Not verified

Tests and runtime behavior were not independently verified. The description reports Windows 10 testing and notes Linux, AMD and Intel GPUs, and PS4/PS5 behavior were not covered. The listed changed files were all read; files.json was unavailable in the prepared review folder, so exclusions by rule were not independently inspected.

To get this to a good state

Nothing is required.

@oneandonlydean
oneandonlydean merged commit c880e0e into boykopovar:main Nov 22, 2026
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.

3 participants