Repository navigation
fix(agc): keep the user-data tables of a handed-off draw as they were at its draw packet - #17024
Conversation
|
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
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.
|
Superseabas
left a comment
There was a problem hiding this comment.
Windows check of head f9a3585a11, merged onto main 095ff72367 (clean merge), with the validation layer on an NVIDIA and an AMD GPU. The switch does what the description says in a real draw on both. Two notes below, neither blocking from me.
Setup: Windows 11 Home 10.0.26200, WinLibs GCC 16.2.0 (x86_64-ucrt-posix-seh, r3), Release, BUILD_TESTING=ON. Both GPUs, selected with ANYPS5_GPU: an RTX 5070 Ti (driver 621.01) and the Ryzen 7 7700X's integrated Radeon (AMD 26.10.2). ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1 and VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation.
Full ^agc suite (-j 8), passed / total:
| RTX 5070 Ti | Radeon (iGPU) | |
|---|---|---|
main |
1489 / 1490 | 1489 / 1490 |
| this PR, switch off | 1491 / 1492 | 1491 / 1492 |
this PR, APS5_DRAW_PIPELINE=1 |
1488 / 1492 | 1488 / 1492 |
this PR, APS5_DRAW_PIPELINE=1 and APS5_DRAW_TABLE_SNAPSHOT=1 |
1488 / 1492 | 1488 / 1492 |
- The one failure in the first two rows is the same with and without this PR:
agc_driver_quad_pixel_maskon the RTX (#14341) andagc_driver_sample_order_grid_referenceon the Radeon (#9503). - The last two rows add
agc_driver_draw_recapture_on_change,agc_driver_queued_constant_ram_dumpandagc_driver_draw_unsupported_buffer_type_skip_refused. All three also fail onmainwithAPS5_DRAW_PIPELINE=1, so turning the switch on adds no failures. - No
VUID-lines and no missing-layer lines in any run. agc_shader_table_keep,agc_shader_table_keep_compareand the switch tests pass in 3 of 3 runs on each GPU.tools/check_conventions.py --base upstream/mainpasses.
A real draw, with a temporary test. No test here turns the switch on for a draw, so I ran one locally in the DrawDataHitUserWords fixture with APS5_DRAW_PIPELINE=1. It holds the finisher with a blocker job, submits a draw whose table holds a V# for 0.25, waits for the packet to be read, rewrites the table to a V# for 1.0, then releases the finisher. The value is the brightest byte the draw wrote, with the same results on both GPUs from one run of each case:
| Table | Switch off | Switch on |
|---|---|---|
| Page aligned | 255 (the table the game wrote later) | 64 (the table at the packet) |
| 16 bytes into a block | not run | 64 |
| Keep crosses a page | not run | 64 |
The next draw over the rewritten table wrote 255 in every case, so the draw cache didn't reuse the kept words.
1. The commit-time comparison isn't reached on today's main. Keeps are only taken on the hand-off path, and tail.queue is only set on the other path (Draw.cpp:786). Each of the four keptTables calls sits behind tail.queue != nullptr, so a comparison never sees a keep. I logged this: tail.queue wasn't set on any finisher job in the runs above or in the 68 from agc_driver_draw_cache_reuse_draw_pipeline and _plan_verify, where 8 tables were kept, and no comparison ran with a keep. So the second commit does nothing until #15455 drops that condition, and the description's "the check the finisher runs at commit time" describes main with #15455 rather than main today. It might help to say so there. I didn't build the two together.
2. Two parts of the switch have no test.
- The wiring: besides
RuntimeSwitches, which only checks the name, no test refers to the switch, so as far as I can see nothing would fail ifKeepUserDataTablesstopped being called. The temporary test above could become one. I setPending::unknown = falseon the blocker job, becausePendingOverlapstreats an unknown job as overlapping everything. Mine waits a fixed 300 ms after the lookup counter moves, which you'd probably want to replace. - Word-by-word pages: with
!page.kept.Test(index)removed fromShaderMemory::read, both new tests still pass. They pass nopendingWrite, so their pages are never read word by word.
One small thing: the description says a game run needs APS5_DRAW_TABLE_SNAPSHOT=1. From handOff in Draw.cpp it also needs APS5_DRAW_PIPELINE, since without it no draw reaches the finisher. The ENVIRONMENT.md entry could name it too.
Not run: any title, or this PR merged with #15455.
|
Thank you for the review, and for the real-draw check on both GPUs.
AI-assisted: yes |
|
Pushed
AI-assisted: yes |
|
@muhmuhkuh this needs a rebase onto main (the PR is conflicting), and the windows check failed on this head (https://github.com/boykopovar/AnyPS5/actions/runs/42526828359/job/128876338013). Please say whether that failure comes from this change, and rerun on the rebased head. One more thing to settle: the commit-time compare commit does nothing on current main, because all four calls sit behind tail.queue != nullptr, and it only takes effect together with #15455, which conflicts on that line. Either say which of the two lands first and how, or drop that commit from this PR. The table snapshot itself looks sound to me, and the 64 vs 255 measurement on a real draw is useful evidence. |
|
@oneandonlydean Thanks. The failed Windows job has one failing test: I prepared an unapplied revert of Next are the main conflict resolution and paired focused validation before any push. No updated branch or new test result is claimed here. AI-assisted: yes |
a6e8916 to
434da34
Compare
|
Rebased to On Windows, I requested one Windows rerun for the failed job. GitHub CLI returned AI-assisted: yes |
434da34 to
04b58e0
Compare
|
Rebased onto current Tested on Windows 11, NVIDIA GeForce RTX 3080 Ti, Release, with
AI-assisted: yes |
04b58e0 to
b817023
Compare
|
Rebased again onto current main (a221a74), since main moved past the previous base. Head is now b817023 (was 04b58e0). Tested on Windows 11, NVIDIA GeForce RTX 3080 Ti, Release, with ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1 and VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation:
AI-assisted: yes |
|
Linux run of this head on an NVIDIA and an Intel GPU, with the validation layer; the runs here so far are Windows. AI-assisted run and report.
Tests: every
No |
Validation report — item 6 of queue10 (AGC handed-off draw user-data tables)Verdict: PASS — frozen head validated as-is on Linux/AMD; no new validation IDs; pushed to Environment
SHAs
Build (PR tree)Configure: exit 0, wall 11 s (log Focused test pattern (identical matched set in both trees, verified via
|
A draw handed to the draw finisher reads the 256 bytes behind each user-data pointer from the kept copy taken when the packet is read, behind APS5_DRAW_TABLE_SNAPSHOT. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ages A draw handed to the finisher keeps its user-data tables with APS5_DRAW_TABLE_SNAPSHOT set and keeps none without it, counted by ShaderMemory::TablesKept. A kept word on a page read word by word survives a GPU write recorded over the table. ENVIRONMENT.md names APS5_DRAW_PIPELINE as the switch's prerequisite. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
b817023 to
edea654
Compare
|
Rebased onto Tested on Windows 11 Pro, NVIDIA GeForce RTX 3080 Ti, driver 610.88, MinGW GCC 15.2, Release, with
AI-assisted: yes. |
What
A draw handed to the finisher builds its stages after reading the packet. A later guest write can therefore change a pointed-to user-data table before the stage reads it.
With
APS5_DRAW_TABLE_SNAPSHOT=1, the driver keeps 256 bytes behind each user-data pointer at the draw packet. Shader memory reads those kept words when building the stages. The switch stays off by default and requiresAPS5_DRAW_PIPELINE; phase B ofAPS5_ABcan enable it. A block is kept only when the pending-write checks before and after copying accept it. Overlapping, unmapped, unaligned and otherwise unsupported blocks retain the existing path. The debt entry records the remaining limits.The inactive commit-time comparison commit and its specific test have been dropped. This PR now contains the snapshot and its wiring/word-by-word tests. Commit-time comparison integration with #15455 remains separate and is not claimed as tested here.
Tested
Windows 11, MinGW-w64 GCC 15.2.0, Release. Local rebased head:
434da344030ecfb4f30716908c25f26f3cc4b4e0; tested main:808a902ea17ccff6cab2d013fd5e702217d47f50.guest_standard_streamspasses solo on both main and this head, rc0. These runs use isolated, hash-bound executable/libc copies.agc_runtime_switches,agc_runtime_switches_refused,agc_shader_table_snapshot_reuse,agc_shader_table_snapshot_reuse_unmasked, andagc_shader_table_keep. Main passes the four existing cases. Their executables compile the relevant sources directly and do not importlibSceAgcDriver.prx.CheckGetdelimAndGetline: the secondungetcreturns -1. The precedingfscanfreturns 2 and the expected data. Main already removed that fixture throughff82682151b5f85c319f8fd109cff34052b15ce7; no libc diagnostic or unrelated libc fix is included in this PR.tools/check_conventions.py --base origin/mainandgit merge-tree --write-tree origin/main HEADpass.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)