shader: ds_min/max/add_src2_f32 throw for a reason that no longer holds #14089

Closed
opened 2026-10-31 18:36:42 +00:00 by LeandroLP23 · 0 comments
LeandroLP23 commented 2026-10-31 18:36:42 +00:00 (Migrated from github.com)
Contributor

Imported from boykopovar/AnyPS5. Originally posted by LeandroLP23 on 2026-10-31T18:36:42Z.


What happens

ds_min_src2_f32, ds_max_src2_f32 and ds_add_src2_f32 throw at translation with:

f32 DS src2 operations depend on the f32 denormal mode, which is not modelled for LDS float atomics

(core/shader/recompiler/Translation/src/MemoryInstructions/MemoryInstructionDispatch.cpp:374, added in be3bd9fbd7 on 10-08). That reason no longer holds. Since 731575c802 (10-14) the LDS float atomics model the f32 denormal field:

  • TranslationContext::dsAtomic sets flushDenormals and flushDenormalResults (SharedMemoryInstructions.cpp:35-36);
  • EmitSharedAtomicFAdd32 and the min/max emitters read them;
  • the rule is documented in docs/dev/debt/shader.md (the LDS float atomics entry).

The integer src2 forms already go through TranslationContext::dsSrc2 (SharedMemoryInstructions.cpp:199), which reads DS[B] and updates DS[A] with the matching 32-bit atomic.

Proposal

Route the three f32 src2 opcodes through dsSrc2 with SharedAtomicFMin32, SharedAtomicFMax32 and SharedAtomicFAdd32, after making dsSrc2 set the same two flush fields as dsAtomic. Add translation tests in the existing DS src2 suite. The 64-bit, GDS and offset1[7] forms would keep throwing, as documented.

Question for maintainers

The src2 opcodes exist only on GFX10.1, and the oracle hardware (RDNA2) has none. The behaviour would be inferred from the non-src2 ds_min/max/add_f32 measured on gfx1035, which is how the integer src2 forms were done. Is that acceptable for the f32 forms, or should they keep throwing until someone measures a GFX10.1 part? Note that shader.md's DS src2 entry gives the obsolete reason today; #14085 rewords it to "not measured".

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:6138395791 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/14089). Originally posted by [LeandroLP23](https://github.com/LeandroLP23) on 2026-10-31T18:36:42Z. --- ### What happens `ds_min_src2_f32`, `ds_max_src2_f32` and `ds_add_src2_f32` throw at translation with: ``` f32 DS src2 operations depend on the f32 denormal mode, which is not modelled for LDS float atomics ``` (`core/shader/recompiler/Translation/src/MemoryInstructions/MemoryInstructionDispatch.cpp:374`, added in be3bd9fbd7 on 10-08). That reason no longer holds. Since 731575c802 (10-14) the LDS float atomics model the f32 denormal field: - `TranslationContext::dsAtomic` sets `flushDenormals` and `flushDenormalResults` (`SharedMemoryInstructions.cpp:35-36`); - `EmitSharedAtomicFAdd32` and the min/max emitters read them; - the rule is documented in `docs/dev/debt/shader.md` (the LDS float atomics entry). The integer src2 forms already go through `TranslationContext::dsSrc2` (`SharedMemoryInstructions.cpp:199`), which reads `DS[B]` and updates `DS[A]` with the matching 32-bit atomic. ### Proposal Route the three f32 src2 opcodes through `dsSrc2` with `SharedAtomicFMin32`, `SharedAtomicFMax32` and `SharedAtomicFAdd32`, after making `dsSrc2` set the same two flush fields as `dsAtomic`. Add translation tests in the existing DS src2 suite. The 64-bit, GDS and `offset1[7]` forms would keep throwing, as documented. ### Question for maintainers The src2 opcodes exist only on GFX10.1, and the oracle hardware (RDNA2) has none. The behaviour would be inferred from the non-src2 `ds_min/max/add_f32` measured on gfx1035, which is how the integer src2 forms were done. Is that acceptable for the f32 forms, or should they keep throwing until someone measures a GFX10.1 part? Note that `shader.md`'s DS src2 entry gives the obsolete reason today; #14085 rewords it to "not measured". AI-assisted: yes (Claude Code)
Sign in to join this conversation.
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#14089
No description provided.