fix(shader): split descriptor webs whose paths fold or hold invalid arms #8077

Merged
0xcrstn merged 11 commits from upstream-pr/8077 into main 2026-10-27 01:56:48 +00:00
0xcrstn commented 2026-10-19 20:10:37 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by 0xcrstn on 2026-10-19T20:10:37Z.


What

A T# chosen at run time among SRT descriptors through a descriptor web (a jump table, loop-carried T# registers) failed to plan when one path's dwords depended on the program counter, EXEC or a lane mask, and failed at capture when an arm the run never takes held no valid T#. PPSA23566 compute shader 0x1163c84000 stops on main with GetImageResource dword 0 is not a valid runtime value, then with runtime image descriptor is invalid.

  • The descriptor web split names the reason it gave up, and the value that keeps an arm from being rebuilt, in the existing error.
  • A web path whose dwords depend on the program counter, EXEC or a lane mask selects the first descriptor instead of refusing the read; a lane that takes it records an InvalidDescriptor BDA fault (new IR DescriptorFault, gated by the image instruction's EXEC). APS5_STRICT_DESCRIPTOR_WEBS restores the refusal.
  • Arms of a read split through a descriptor web are optional: an arm whose words are not a T# (not a null descriptor, and TYPE 2-7 or a FORMAT outside the GFX10 image format table, Mesa gfx10-rsrc.json) is bound as a null image, and a lane that selects it records the same fault. Splits along incoming edges keep requiring a valid T#, as on main.
  • validImageDescriptor treats a FORMAT outside the GFX10 table as invalid.
  • The invalid-descriptor error names the image, its use and its eight T# words.

Both assumptions are recorded in docs/dev/debt/shader.md.

Related gaps not changed here (pre-existing on main):

  • ShaderAddressResources.cpp: a shader with an image table reads its fault buffer back only when a table record is poisoned, so a descriptor fault in such a shader is not reported.
  • WebSelector picks LaneSelector's first select in tuple order, not from the latest block.

Tested

Windows 11 Pro, NVIDIA RTX 5090 (driver 32.0.16.1742).

  • PPSA23566 (UFC 6) on main b6583dd86 + this PR reaches the tutorial fight; shader 0x1163c84000 is prepared and dispatched with no InvalidDescriptor fault in the session.
  • New tests: agc_driver_descriptor_web_faults (GPU: per-arm reads, faults at the read for a folded path and for a selected undefined arm, none with EXEC empty), plus agc_shader_memory and agc_shader_disk_cache additions.
  • Full ctest on b6583dd86 + this PR (excluding windows_icon, optional_plt, empty_tls, windows_address_space, dynamic_segment): all pass except agc_driver_pass_input_hazard and agc_driver_pixel_lds, which fail identically on main.
  • After rebasing onto 252cbc29b: agc_shader_memory, agc_shader_disk_cache, agc_shader_disk_cache_large_file and agc_driver_descriptor_web_faults pass; tools/check_conventions.py passes.

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: PPSA23566 #5996
  • GPUs tested: NVIDIA RTX 5090, driver 32.0.16.1742, Windows 11
  • AI-assisted: yes

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4926761224 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8077). Originally posted by [0xcrstn](https://github.com/0xcrstn) on 2026-10-19T20:10:37Z. --- ### What A T# chosen at run time among SRT descriptors through a descriptor web (a jump table, loop-carried T# registers) failed to plan when one path's dwords depended on the program counter, EXEC or a lane mask, and failed at capture when an arm the run never takes held no valid T#. PPSA23566 compute shader 0x1163c84000 stops on main with `GetImageResource dword 0 is not a valid runtime value`, then with `runtime image descriptor is invalid`. - The descriptor web split names the reason it gave up, and the value that keeps an arm from being rebuilt, in the existing error. - A web path whose dwords depend on the program counter, EXEC or a lane mask selects the first descriptor instead of refusing the read; a lane that takes it records an `InvalidDescriptor` BDA fault (new IR `DescriptorFault`, gated by the image instruction's EXEC). `APS5_STRICT_DESCRIPTOR_WEBS` restores the refusal. - Arms of a read split through a descriptor web are optional: an arm whose words are not a T# (not a null descriptor, and TYPE 2-7 or a FORMAT outside the GFX10 image format table, Mesa `gfx10-rsrc.json`) is bound as a null image, and a lane that selects it records the same fault. Splits along incoming edges keep requiring a valid T#, as on main. - `validImageDescriptor` treats a FORMAT outside the GFX10 table as invalid. - The invalid-descriptor error names the image, its use and its eight T# words. Both assumptions are recorded in `docs/dev/debt/shader.md`. Related gaps not changed here (pre-existing on main): - `ShaderAddressResources.cpp`: a shader with an image table reads its fault buffer back only when a table record is poisoned, so a descriptor fault in such a shader is not reported. - `WebSelector` picks LaneSelector's first select in tuple order, not from the latest block. ### Tested Windows 11 Pro, NVIDIA RTX 5090 (driver 32.0.16.1742). - PPSA23566 (UFC 6) on main b6583dd86 + this PR reaches the tutorial fight; shader 0x1163c84000 is prepared and dispatched with no `InvalidDescriptor` fault in the session. - New tests: `agc_driver_descriptor_web_faults` (GPU: per-arm reads, faults at the read for a folded path and for a selected undefined arm, none with EXEC empty), plus `agc_shader_memory` and `agc_shader_disk_cache` additions. - Full ctest on b6583dd86 + this PR (excluding `windows_icon`, `optional_plt`, `empty_tls`, `windows_address_space`, `dynamic_segment`): all pass except `agc_driver_pass_input_hazard` and `agc_driver_pixel_lds`, which fail identically on main. - After rebasing onto 252cbc29b: `agc_shader_memory`, `agc_shader_disk_cache`, `agc_shader_disk_cache_large_file` and `agc_driver_descriptor_web_faults` pass; `tools/check_conventions.py` passes. ### Checklist - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: PPSA23566 #5996 - [x] GPUs tested: NVIDIA RTX 5090, driver 32.0.16.1742, Windows 11 - [x] AI-assisted: yes 🤖 Generated with [Claude Code](https://claude.com/claude-code)
0xcrstn commented 2026-10-19 20:27:03 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by 0xcrstn on 2026-10-19T20:27:03Z.


The overlaps with #6612, #6679, #6959, #7623, #7694 and #7803 are adjacent insertions (debt entries appended at the end of the same list, neighbouring test functions in ShaderMemory.cpp, a helper next to descriptorDimension), not the same functionality. No dependency in either direction; whichever merges first, I'll rebase this one.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6276586727 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8077#issuecomment-6276586727). Originally posted by [0xcrstn](https://github.com/0xcrstn) on 2026-10-19T20:27:03Z. --- The overlaps with #6612, #6679, #6959, #7623, #7694 and #7803 are adjacent insertions (debt entries appended at the end of the same list, neighbouring test functions in ShaderMemory.cpp, a helper next to `descriptorDimension`), not the same functionality. No dependency in either direction; whichever merges first, I'll rebase this one.
wachi35676 commented 2026-10-20 01:56:34 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by wachi35676 on 2026-10-20T01:56:34Z.


Windows runs on an NVIDIA card and an AMD iGPU (the PR lists only an RTX 5090), plus a check of the format table.

Setup: Windows 11 26300, MinGW GCC 15.2 Release, main eb7500680 + this PR (7517b4484, merges cleanly). GPUs: RTX 5070 Ti (NVIDIA 617.42) and Ryzen 5 9600X Radeon iGPU (ANYPS5_GPU=AMD, 32.0.21042.62), both with ANYPS5_REQUIRE_VULKAN=1.

  • agc_driver_descriptor_web_faults, agc_shader_memory and agc_shader_disk_cache passed 3 of 3 on each GPU.
  • Negative control: I put the 11 non-test sources back to main and rebuilt agc_driver_descriptor_web_faults_tests. It fails on both GPUs with GetImageResource dword 0 is not a valid runtime value; chain: Phi(ReadConst(GetSrtResource, Immediate), Phi(...)). ShaderMemory.cpp doesn't compile against main's headers (optionalDescriptor, IsDefinedImageFormat), so that test has no separate negative control.
  • APS5_STRICT_DESCRIPTOR_WEBS=1: the new test fails as the switch intends, and the error now names the reason: ...; descriptor web: a descriptor dword depends on the program counter, EXEC or a lane mask. No test covers this switch. Note that the code treats APS5_STRICT_DESCRIPTOR_WEBS=0 as off, while ENVIRONMENT.md lists the variable as presence.
  • DefinedImageFormats ({1-77, 128-154, 156-182, 265-292}) matches the GFX10_FORMAT enum in Mesa's current src/amd/registers/gfx10-rsrc.json exactly: 160 values from 0 to 292, in the ranges 0-77, 128-154, 156-182 and 265-292, with 0 being INVALID. The IR check (UndefinedImageWords) and the CPU check (undefinedImageWords) agree on what counts as null: base address dword 0 and the low 8 bits of dword 1 are zero, as in nullImageDescriptor.
  • ctest -R "agc|shader|spirv|recomp" (824 tests): on NVIDIA 3 failed (msaa_dcc_clear_4, pass_input_hazard, sgpr_pattern_fill_keys); on AMD 4 failed (msaa_dcc_clear_4, layered_volume_vertex_no_gpl, draw_cache_reuse_off, stencil_replay_no_gpl). All of these also fail on main on this machine. No new failures.
  • check_conventions.py --base origin/main passes.

AI-assisted: yes (Claude Code); results above were run on this machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6281520158 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8077#issuecomment-6281520158). Originally posted by [wachi35676](https://github.com/wachi35676) on 2026-10-20T01:56:34Z. --- Windows runs on an NVIDIA card and an AMD iGPU (the PR lists only an RTX 5090), plus a check of the format table. Setup: Windows 11 26300, MinGW GCC 15.2 Release, `main` eb7500680 + this PR (7517b4484, merges cleanly). GPUs: RTX 5070 Ti (NVIDIA 617.42) and Ryzen 5 9600X Radeon iGPU (`ANYPS5_GPU=AMD`, 32.0.21042.62), both with `ANYPS5_REQUIRE_VULKAN=1`. - `agc_driver_descriptor_web_faults`, `agc_shader_memory` and `agc_shader_disk_cache` passed 3 of 3 on each GPU. - Negative control: I put the 11 non-test sources back to main and rebuilt `agc_driver_descriptor_web_faults_tests`. It fails on both GPUs with `GetImageResource dword 0 is not a valid runtime value; chain: Phi(ReadConst(GetSrtResource, Immediate), Phi(...))`. `ShaderMemory.cpp` doesn't compile against main's headers (`optionalDescriptor`, `IsDefinedImageFormat`), so that test has no separate negative control. - `APS5_STRICT_DESCRIPTOR_WEBS=1`: the new test fails as the switch intends, and the error now names the reason: `...; descriptor web: a descriptor dword depends on the program counter, EXEC or a lane mask`. No test covers this switch. Note that the code treats `APS5_STRICT_DESCRIPTOR_WEBS=0` as off, while `ENVIRONMENT.md` lists the variable as `presence`. - `DefinedImageFormats` (`{1-77, 128-154, 156-182, 265-292}`) matches the `GFX10_FORMAT` enum in Mesa's current `src/amd/registers/gfx10-rsrc.json` exactly: 160 values from 0 to 292, in the ranges 0-77, 128-154, 156-182 and 265-292, with 0 being `INVALID`. The IR check (`UndefinedImageWords`) and the CPU check (`undefinedImageWords`) agree on what counts as null: base address dword 0 and the low 8 bits of dword 1 are zero, as in `nullImageDescriptor`. - `ctest -R "agc|shader|spirv|recomp"` (824 tests): on NVIDIA 3 failed (`msaa_dcc_clear_4`, `pass_input_hazard`, `sgpr_pattern_fill_keys`); on AMD 4 failed (`msaa_dcc_clear_4`, `layered_volume_vertex_no_gpl`, `draw_cache_reuse_off`, `stencil_replay_no_gpl`). All of these also fail on main on this machine. No new failures. - `check_conventions.py --base origin/main` passes. AI-assisted: yes (Claude Code); results above were run on this machine.
Longziip commented 2026-10-20 17:32:02 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Longziip on 2026-10-20T17:32:02Z.


Tested on EA SPORTS UFC 6 (PPSA23566, 01.004.000), the title this unblocks (#5996).

Setup: Windows 11 Pro 26300, AMD Ryzen 7 5700X, NVIDIA GeForce RTX 4060 8 GB (driver 616.64), 32 GB RAM, WinLibs GCC 15.2.0 Release. main 77e31219c + this PR (7e2eb2c0d; the only conflict was docs/dev/debt/shader.md, both entries kept) + #8126. Relinked with --windows --registry --module-dir ., run with APS5_LAZY_SHADER_PREPARE=1.

  • Without this PR, main stops after the title on shader 0x1163c84000 with GetImageResource dword 0 is not a valid runtime value; chain: Phi(Phi(...ReadConst(GetSrtResource, Immediate)...)).
  • With it, the game goes past that shader: title, loading, then the main menu fully rendered (PLAY tab, hero fighter, mode list, profile bar), no crash. About 0.9 FPS on the menu once the shaders were prepared, with an empty shader cache on first launch.
  • Not tested yet on this build: a fight. The same title reaches fights on the UFC 6 testing build from #5996, which carries these commits.
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6297059750 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8077#issuecomment-6297059750). Originally posted by [Longziip](https://github.com/Longziip) on 2026-10-20T17:32:02Z. --- Tested on EA SPORTS UFC 6 (PPSA23566, 01.004.000), the title this unblocks (#5996). Setup: Windows 11 Pro 26300, AMD Ryzen 7 5700X, NVIDIA GeForce RTX 4060 8 GB (driver 616.64), 32 GB RAM, WinLibs GCC 15.2.0 Release. `main` 77e31219c + this PR (7e2eb2c0d; the only conflict was `docs/dev/debt/shader.md`, both entries kept) + #8126. Relinked with `--windows --registry --module-dir .`, run with `APS5_LAZY_SHADER_PREPARE=1`. - Without this PR, `main` stops after the title on shader `0x1163c84000` with `GetImageResource dword 0 is not a valid runtime value; chain: Phi(Phi(...ReadConst(GetSrtResource, Immediate)...))`. - With it, the game goes past that shader: title, loading, then the main menu fully rendered (PLAY tab, hero fighter, mode list, profile bar), no crash. About 0.9 FPS on the menu once the shaders were prepared, with an empty shader cache on first launch. - Not tested yet on this build: a fight. The same title reaches fights on the UFC 6 testing build from #5996, which carries these commits.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!8077
No description provided.