fix(agc): keep a pointer's upper half out of the relocated V# value words #19398
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/19398"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by muhmuhkuh on 2026-11-13T08:08:05Z.
What
The draw relocation lets a user-data word change between draws without a rebuild when the word is the base of a read-only V# held in user data.
tagUserValueWordsfinds such a word by value: it equals the base word of exactly one bound guest buffer descriptor and the two words after it match that descriptor. A move of such a word is accepted inrelocateDrawEntry, and only the bound descriptor is patched.A 64-bit pointer takes two consecutive user words. Its lower word is tagged as relocatable (a base of the SRT walk) or as a callee word (a fetch subroutine pointer, where the code already takes
userData[index + 1]as the upper half). Its upper word carries no tag of its own. When the value of that upper word also passed the V# match, it was tagged as a V# value word. A draw whose pointer changed only in its upper half then passed the move check. The copied variant kept its runs at the address under the old upper half, and a callee was keyed by the code under the old upper half. The reused draw was then validated against memory the shader does not read.tagUserValueWordsnow leaves the word directly after a relocatable or callee word untagged, as a V# base and as a record count. A move of that word is refused by the existing check and the draw is built again.This was found by reading the code. No real shader is known to reach it: the upper half of a pointer has to equal the base word of one bound read-only buffer, and the following words have to match that descriptor. The test shows it at the level of the tagging function only, not with a draw.
Limits:
Overlap with open PRs: #10193, #13928 and #13929 also change
Driver::tagUserValueWords(signature and body). Their tag loop has the same condition without this guard. Whichever PR merges second rebases, and the guard belongs in the function as it stands after the first merge. #5609 changes the relocation runs, not the tags.Tested
Windows 11 Pro (10.0.26200), NVIDIA GeForce RTX 3080 Ti, driver 610.88, MinGW GCC 15.2 (UCRT, POSIX threads, SEH), Release, validation layer on (
ANYPS5_REQUIRE_VULKAN=1,ANYPS5_NO_SHADER_CACHE=1,VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation). Built on the same machine on upstream main8f9fbf6c8c3with the test change only (red), and with the fix on top (green). The files this change touches are the same on8f9fbf6c8c3and on the current base96b9b4cd641; the tests were not repeated on the current base.agc_driver_draw_relocate_user_values: with only the test change it fails with "the user word after a relocated pointer word, the pointer's upper half, was tagged as a V# value (mask 80)". With the fix it passes.^agc_driver_(draw_relocate_user_values|draw_cache_relocation|draw_cache_reuse|mesh_draw_relocation)with the fix: 18 tests (the test above plusagc_driver_draw_cache_relocation,agc_driver_draw_cache_reuse,agc_driver_mesh_draw_relocationand their variants): 18 of 18 pass.VUID-lines in the logs of the green run. The phrasewas not found but was requested by env var VK_INSTANCE_LAYERS: 0 occurrences.Checklist
main(96b9b4cd64at posting time)NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-21T04:25:30Z.
Review: APPROVED
Reviewed — looks good
The reviewed change at
257f280d19146bd9e86eeee38565b0fbdff75dd4prevents pointer upper halves from being tagged as relocatable V# value words, and the inspected code supports merging.What I ran
Read the prepared diff and both changed files at the pinned head using
repo_read.py; no commands or tests were run. The author reports targeted tests passing on an earlier upstream revision, not on this head.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
No tests were run on this head, and the author reports the test suite was not repeated on the current base.
files.jsonwas not available in the prepared review documents; the file listing identifies two changed files, both of which were read. No other files were excluded from review according to the manifest.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by Plyxen on 2026-12-03T14:03:12Z.
Review: APPROVED
I read the diff at
257f280d19. Windows 11, GCC 15.2, merged intomainat6c6b29320fetogether with other open PRs (so not an isolated build), withANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1andVK_LAYER_KHRONOS_validationon an RTX 5080 (621.24) and a Radeon iGPU (26.11.2).agc_driver_draw_relocate_user_values: pass on both GPUs. The loader log shows the layer inserted and no "was not found" line, and neither run has aVUID-orSYNC-HAZARDline.Not checked: a title.
AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T22:31:13Z.
Review: COMMENTED
The trial merge onto
c1601e56d5was clean. The new test checks both relocatable pointer and callee pointer upper halves, and separately checks that a colliding record-count word is left out while the descriptor base stays relocatable. Please keep that last assertion when integrating this with #20130, since a fix that drops the entire descriptor from relocation would otherwise look correct on the two upper-word cases. Paired draw controls are pending.AI-assisted: yes.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.