perf(shader): read each indirect image table descriptor once per pointer #25850

Merged
Remi-Bon merged 1 commit from upstream-pr/25850 into main 2026-11-23 08:16:39 +00:00
Remi-Bon commented 2026-11-22 19:23:51 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Remi-Bon on 2026-11-22T19:23:51Z.


What

The image table snapshot reads an indirect column record by record, through the descriptor pointer each record holds. Many records hold the same pointer, and each one walked the hops and read the descriptor again.

This change has three parts:

  • An open-addressing table keyed by pointer records the first record that read each pointer. Later records with the same pointer copy its state, words and captured pointer.
  • When a descriptor's dwords are contiguous and aligned, the snapshot reads them in one readWords call instead of dword by dword.
  • When the whole descriptor lies in a page already known to be fully accessible, the per-dword accessibility check is skipped.

Tested

  • Windows 11, MinGW Release build.
  • ctest --test-dir build -R "image_table|materializ|resource_table|indirect": 66/66 passed, with ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1, VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation and VK_LOADER_DEBUG=layer, validation layer from Vulkan SDK 1.4.363.1. The loader log shows Insert instance layer "VK_LAYER_KHRONOS_validation" and contains no VUID-.
  • Measured in PPSA01317 (Café scene) on a local tree that carries other unmerged split table call work, so this is not a main vs change tools/trace_digest.py comparison: main alone does not reach the scene. Guest word reads during split part capture fell about 7x. The single bulk read alone showed no measurable gain.

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 and the licence notice of code adapted from upstream (see AGENTS.md)
  • 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: AMD Radeon RX 9070, AMD driver 2.0.416 (Vulkan 1.4.359), Windows 11
  • AI-assisted: yes

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5442478085 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/25850). Originally posted by [Remi-Bon](https://github.com/Remi-Bon) on 2026-11-22T19:23:51Z. --- ### What The image table snapshot reads an indirect column record by record, through the descriptor pointer each record holds. Many records hold the same pointer, and each one walked the hops and read the descriptor again. This change has three parts: - An open-addressing table keyed by pointer records the first record that read each pointer. Later records with the same pointer copy its state, words and captured pointer. - When a descriptor's dwords are contiguous and aligned, the snapshot reads them in one `readWords` call instead of dword by dword. - When the whole descriptor lies in a page already known to be fully accessible, the per-dword accessibility check is skipped. ### Tested - Windows 11, MinGW Release build. - `ctest --test-dir build -R "image_table|materializ|resource_table|indirect"`: 66/66 passed, with `ANYPS5_REQUIRE_VULKAN=1`, `ANYPS5_NO_SHADER_CACHE=1`, `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation` and `VK_LOADER_DEBUG=layer`, validation layer from Vulkan SDK 1.4.363.1. The loader log shows `Insert instance layer "VK_LAYER_KHRONOS_validation"` and contains no `VUID-`. - Measured in PPSA01317 (Café scene) on a local tree that carries other unmerged split table call work, so this is not a `main` vs change `tools/trace_digest.py` comparison: `main` alone does not reach the scene. Guest word reads during split part capture fell about 7x. The single bulk read alone showed no measurable gain. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [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) and the licence notice of code adapted from upstream (see AGENTS.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: none - [x] GPUs tested: AMD Radeon RX 9070, AMD driver 2.0.416 (Vulkan 1.4.359), Windows 11 - [x] AI-assisted: yes 🤖 Generated with [Claude Code](https://claude.com/claude-code)
MarcZX10 commented 2026-11-22 19:32:12 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-22T19:32:12Z.

Review: APPROVED


Reviewed — looks good

The reviewed change at head 61fb2a335b024575d9a33a6a0b7ffe12507f3af5 has no verified blocking defect in the changed logic; execution checks were not run.

What I ran

Read the prepared diff and the changed implementation at the pinned head. No build or tests were run.

Results

Check Result Note
Diff and changed source review passed One changed source file read
Build and tests not run No execution environment used

Findings

Blocking

None identified in the code read.

Non-blocking

None.

Not verified

Build, tests, and the author-reported Windows and console measurements were not independently verified. The review bundle reports files.json as excluded/not available; the listing shows one changed file, and its full text was included and read. No other changed files were excluded.

To get this to a good state

Nothing is required.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6014047059 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/25850#pullrequestreview-6014047059). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-22T19:32:12Z. **Review:** APPROVED --- # Reviewed — looks good The reviewed change at head `61fb2a335b024575d9a33a6a0b7ffe12507f3af5` has no verified blocking defect in the changed logic; execution checks were not run. ## What I ran Read the prepared diff and the changed implementation at the pinned head. No build or tests were run. ## Results | Check | Result | Note | |---|---|---| | Diff and changed source review | passed | One changed source file read | | Build and tests | not run | No execution environment used | ## Findings ### Blocking None identified in the code read. ### Non-blocking None. ## Not verified Build, tests, and the author-reported Windows and console measurements were not independently verified. The review bundle reports `files.json` as excluded/not available; the listing shows one changed file, and its full text was included and read. No other changed files were excluded. ## To get this to a good state Nothing is required.
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!25850
No description provided.