[PR #3082] [MERGED] shader_recompiler: Reduce cases where shared memory to buffer pass is needed. #3208

Closed
opened 2026-02-27 22:02:50 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/shadps4-emu/shadPS4/pull/3082
Author: @squidbus
Created: 6/11/2025
Status: Merged
Merged: 6/11/2025
Merged by: @squidbus

Base: mainHead: fix-shared-3


📝 Commits (1)

  • ee1c744 shader_recompiler: Reduce cases where shared memory to buffer pass is needed.

📊 Changes

9 files changed (+232 additions, -49 deletions)

View changed files

📝 CMakeLists.txt (+1 -0)
📝 src/shader_recompiler/backend/spirv/emit_spirv.cpp (+2 -1)
📝 src/shader_recompiler/backend/spirv/spirv_emit_context.cpp (+21 -7)
📝 src/shader_recompiler/info.h (+1 -1)
📝 src/shader_recompiler/ir/passes/ir_passes.h (+1 -0)
📝 src/shader_recompiler/ir/passes/shader_info_collection_pass.cpp (+19 -3)
src/shader_recompiler/ir/passes/shared_memory_simplify_pass.cpp (+127 -0)
📝 src/shader_recompiler/ir/passes/shared_memory_to_storage_pass.cpp (+59 -37)
📝 src/shader_recompiler/recompiler.cpp (+1 -0)

📄 Description

Reduce instances where the shared memory to buffer pass is needed by:

  • Modifying the pass to ensure that workgroup explicit layout support is only a factor if multiple shared memory types are needed.
  • Modifying the shared memory definition logic to only define used shared memory types, and avoid decorating for aliasing if only one is used.
  • Adding a new pass to simplify 16-bit and 64-bit shared memory accesses to 32-bit if atomics of the respective type are not used. This pass only operates if workgroup explicit layout is not supported, as otherwise we can trivially alias shared memory.

As usual additional regression testing is appreciated.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/shadps4-emu/shadPS4/pull/3082 **Author:** [@squidbus](https://github.com/squidbus) **Created:** 6/11/2025 **Status:** ✅ Merged **Merged:** 6/11/2025 **Merged by:** [@squidbus](https://github.com/squidbus) **Base:** `main` ← **Head:** `fix-shared-3` --- ### 📝 Commits (1) - [`ee1c744`](https://github.com/shadps4-emu/shadPS4/commit/ee1c74434a9e2d256facde7c6d3bb3715dae3db1) shader_recompiler: Reduce cases where shared memory to buffer pass is needed. ### 📊 Changes **9 files changed** (+232 additions, -49 deletions) <details> <summary>View changed files</summary> 📝 `CMakeLists.txt` (+1 -0) 📝 `src/shader_recompiler/backend/spirv/emit_spirv.cpp` (+2 -1) 📝 `src/shader_recompiler/backend/spirv/spirv_emit_context.cpp` (+21 -7) 📝 `src/shader_recompiler/info.h` (+1 -1) 📝 `src/shader_recompiler/ir/passes/ir_passes.h` (+1 -0) 📝 `src/shader_recompiler/ir/passes/shader_info_collection_pass.cpp` (+19 -3) ➕ `src/shader_recompiler/ir/passes/shared_memory_simplify_pass.cpp` (+127 -0) 📝 `src/shader_recompiler/ir/passes/shared_memory_to_storage_pass.cpp` (+59 -37) 📝 `src/shader_recompiler/recompiler.cpp` (+1 -0) </details> ### 📄 Description Reduce instances where the shared memory to buffer pass is needed by: * Modifying the pass to ensure that workgroup explicit layout support is only a factor if multiple shared memory types are needed. * Modifying the shared memory definition logic to only define used shared memory types, and avoid decorating for aliasing if only one is used. * Adding a new pass to simplify 16-bit and 64-bit shared memory accesses to 32-bit if atomics of the respective type are not used. This pass only operates if workgroup explicit layout is not supported, as otherwise we can trivially alias shared memory. As usual additional regression testing is appreciated. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-27 22:02:50 +03:00
Sign in to join this conversation.
No milestone
No project
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.

Dependencies

No dependencies set.

Reference
starred/shadPS4#3208
No description provided.