feat(shader): support 64-bit image atomics through keyed image tables #10440

Merged
SuarezPM merged 1 commit from upstream-pr/10440 into main 2026-10-25 10:58:36 +00:00
SuarezPM commented 2026-10-24 00:26:01 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by SuarezPM on 2026-10-24T00:26:01Z.


What

64-bit image atomics through keyed image tables no longer fault. A T# keyed at runtime feeding image_atomic64_* now lowers to OpAtomic* on the table's Atomic64View instead of unsupported operation, mirroring the 32-bit path from #8792. Follows up the declared remainder of that PR's debt entry (packed formats and BY element counts still fault).

  • ResourceTracker::AssignTables keeps tableOperation supported for 64-bit atomics; packed and BY formats still mark Unsupported, and Merge still throws on mixed 64-bit/other accesses to one image.
  • Table elements carry the atomic64 flag through dedup identity into the descriptor binding (DescriptorBindingBuilder), and the table write path binds Atomic64View exactly like the compact path (ShaderResources).
  • docs/dev/debt/shader.md updates the image-table entry: 64-bit atomics supported via AtomicView/Atomic64View (Device scope, relaxed, AcquireRelease/UniformMemory barrier as the direct path); the host needs VK_FORMAT_FEATURE_STORAGE_IMAGE_ATOMIC_BIT for the view format.

Tested

$ cmake -S . -B build-full -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON -DANYPS5_ENABLE_SPIRV_TOOLS=ON
$ cmake --build build-full --target agc_shader_memory_tests agc_driver_image_table_tests
Built clean, exit 0

$ ./build-full/tests/agc_shader_memory_tests --bindless
Image table keys, maps, records and registration passed (incl. new atomic64 registration: Supported plan + all-true imageAtomic64 binding)

$ ./build-full/tests/agc_shader_memory_tests
Shader memory capture, strict validation and deterministic replay passed

$ ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ./build-full/tests/agc_driver_image_table_tests
image table tests passed (incl. new RunAtomic64Tests: 64-bit add through a keyed T# on R64_UINT with Int64ImageEXT gate, null-entry no-reach; 0 VUID- lines)

$ python3 tools/check_conventions.py --base origin/main
All conventions checks passed.

$ python3 tools/pr_overlap.py --branch ai/atomic64-keyed-tables
No overlap with open pull requests.

Host: Linux x86-64 (CachyOS), Ryzen 5 3600, RTX 2060 SUPER (NVIDIA 615.78.08, supports shaderImageInt64Atomics; validation layer requested). The SPIR-V validation lane (SPIRV_TOOLS=ON) that caught the #8792 Phi issue was reproduced locally this time. Full builds run on merge.

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 RTX 2060 SUPER, driver 615.78.08, CachyOS Linux (execution tests with validation layers requested; 0 VUIDs observed)
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4990958441 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10440). Originally posted by [SuarezPM](https://github.com/SuarezPM) on 2026-10-24T00:26:01Z. --- ### What 64-bit image atomics through keyed image tables no longer fault. A T# keyed at runtime feeding `image_atomic64_*` now lowers to `OpAtomic*` on the table's `Atomic64View` instead of `unsupported operation`, mirroring the 32-bit path from #8792. Follows up the declared remainder of that PR's debt entry (packed formats and BY element counts still fault). - `ResourceTracker::AssignTables` keeps `tableOperation` supported for 64-bit atomics; packed and BY formats still mark `Unsupported`, and `Merge` still throws on mixed 64-bit/other accesses to one image. - Table elements carry the `atomic64` flag through dedup identity into the descriptor binding (`DescriptorBindingBuilder`), and the table write path binds `Atomic64View` exactly like the compact path (`ShaderResources`). - `docs/dev/debt/shader.md` updates the image-table entry: 64-bit atomics supported via `AtomicView`/`Atomic64View` (`Device` scope, relaxed, `AcquireRelease`/`UniformMemory` barrier as the direct path); the host needs `VK_FORMAT_FEATURE_STORAGE_IMAGE_ATOMIC_BIT` for the view format. ### Tested <!-- OS, title or homebrew, what was checked. "Not tested" is a valid answer. A performance change: the summary lines of main and of this PR from the same machine and scene, with the traces attached, captured as the Performance report issue form describes. --> ``` $ cmake -S . -B build-full -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON -DANYPS5_ENABLE_SPIRV_TOOLS=ON $ cmake --build build-full --target agc_shader_memory_tests agc_driver_image_table_tests Built clean, exit 0 $ ./build-full/tests/agc_shader_memory_tests --bindless Image table keys, maps, records and registration passed (incl. new atomic64 registration: Supported plan + all-true imageAtomic64 binding) $ ./build-full/tests/agc_shader_memory_tests Shader memory capture, strict validation and deterministic replay passed $ ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ./build-full/tests/agc_driver_image_table_tests image table tests passed (incl. new RunAtomic64Tests: 64-bit add through a keyed T# on R64_UINT with Int64ImageEXT gate, null-entry no-reach; 0 VUID- lines) $ python3 tools/check_conventions.py --base origin/main All conventions checks passed. $ python3 tools/pr_overlap.py --branch ai/atomic64-keyed-tables No overlap with open pull requests. ``` Host: Linux x86-64 (CachyOS), Ryzen 5 3600, RTX 2060 SUPER (NVIDIA 615.78.08, supports `shaderImageInt64Atomics`; validation layer requested). The SPIR-V validation lane (`SPIRV_TOOLS=ON`) that caught the #8792 Phi issue was reproduced locally this time. Full builds run on merge. ### 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) - [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: NVIDIA RTX 2060 SUPER, driver 615.78.08, CachyOS Linux (execution tests with validation layers requested; 0 VUIDs observed) - [x] AI-assisted: yes
MarcZX10 commented 2026-10-24 21:58:38 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-24T21:58:38Z.

Review: APPROVED


Reviewed exact head 9c3ffcf5b00fbc760cadf6e431fd71b17bc56182.

The 64-bit atomic flag now survives table planning, dedup identity, binding population, and table descriptor resolution; the table write path selects Atomic64View while retaining the existing 32-bit and ordinary storage views. Unsupported packed/BY-counted cases remain rejected, and mixed accesses still fail closed. The added CPU-side table registration checks and Vulkan execution regression cover a keyed runtime T#, R64_UINT atomic add, extension gating, and the null-entry no-reach case.

Local checks: current-main merge-tree is clean; check_conventions.py --base upstream/main --head upstream/pr-10440 and git diff --check pass. I did not run the GPU test locally. The PR's detailed RTX 2060 SUPER validation-layer run is author-reported. Hosted eligibility, intake, labels, report, and conventions pass; product/relinker jobs are skipped by the workflow gate, so they are not hosted test evidence.

No blocking findings on this head.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5640187847 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10440#pullrequestreview-5640187847). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-24T21:58:38Z. **Review:** APPROVED --- Reviewed exact head `9c3ffcf5b00fbc760cadf6e431fd71b17bc56182`. The 64-bit atomic flag now survives table planning, dedup identity, binding population, and table descriptor resolution; the table write path selects `Atomic64View` while retaining the existing 32-bit and ordinary storage views. Unsupported packed/BY-counted cases remain rejected, and mixed accesses still fail closed. The added CPU-side table registration checks and Vulkan execution regression cover a keyed runtime `T#`, R64_UINT atomic add, extension gating, and the null-entry no-reach case. Local checks: current-main merge-tree is clean; `check_conventions.py --base upstream/main --head upstream/pr-10440` and `git diff --check` pass. I did not run the GPU test locally. The PR's detailed RTX 2060 SUPER validation-layer run is author-reported. Hosted eligibility, intake, labels, report, and conventions pass; product/relinker jobs are skipped by the workflow gate, so they are not hosted test evidence. No blocking findings on this head.
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!10440
No description provided.