docs(shader): record VOP3 16-bit integer clamp on gfx1036 #21997

Merged
brumskysb merged 1 commit from upstream-pr/21997 into main 2026-11-17 07:06:56 +00:00
brumskysb commented 2026-11-17 01:08:24 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by brumskysb on 2026-11-17T01:08:24Z.


What

Measures one clause of the [VOP3 16-bit integer binary clamp] entry of docs/dev/debt/shader.md (added by #19337): "the behaviour is not measured on hardware (min, max and shifts cannot saturate, v_mul_lo_u16 remains open)". No code changes.

Measured on gfx1036 (driver 31.0.22044.1) with the hardware oracle, wave32. The bodies are the Code words of Vop3Integer16Clamp.cpp with only the destination register moved, so each of the eight opcodes runs with and without the clamp bit (bit 15 of the first VOP3 dword) on the same inputs: the test's 32 Rows plus 32 rows whose v_mul_lo_u16 product exceeds 0xffff (64 input rows per opcode).

  • Controls (step 1, 3 dispatches): v_mov_b32 v10, 0x2a probe 32 of 32; v_add_nc_u16 with clamp saturates to 0xffff on 16 of 16 overflow rows where the form without clamp wraps (32 of 32 match the low 16 bits of the sum), so the clamp bit reaches the 16-bit integer ALU on this part.
  • Sweep (step 2, 4 dispatches): with clamp and without clamp give the same 32-bit word on 0 of 1,152 differing words (all eight opcodes, 64 rows each; v_mul_lo_u16 in both bodies). v_mul_lo_u16 with clamp keeps (a*b) & 0xffff on all 76 overflowing lanes (38 rows, two bodies) and never saturates to 0xffff; bits 31:16 of the destination are 0 in both forms. The test's lavapipe Expected table matches the hardware 288 of 288.
  • Determinism (step 4, 8 dispatches): all 4 sweep dispatches re-run in two fresh windows: 0 of 4,096 words differ from the archive.
  • Independent recount (verify_clamp16.py, reads the dumps only, decodes opcode, vdst and clamp from the raw words itself and cross-checks all 40 instruction words against llvm-mc-21 -mcpu=gfx1036, expected values from its own integer model): PASS, model 1,280 of 1,280 words; 18 mutation controls each fire from that passing baseline.

The hardware agrees with the decoder's "without effect"; the implementation sentence is not edited.

Evidence (runners, every dump, claims worksheets, checker, verifier, overlap sweeps, SHA-256 ledger): https://gist.github.com/brumskysb/71b0044d4089fa162d183af656623026

Tested

  • GPU: AMD Radeon(TM) Graphics, integrated RDNA2, gfx1036, driver 31.0.22044.1, Windows 11. Harness: tools/hw-oracle via the campaign's rigio.py (in the gist).
  • Dispatches: 3 + 4 + 8 = 15. Fixture descriptor: none (VALU only).
  • Merge check: one commit on c50f19c4b8, the main fetched before the edit; it changes only line 269 of docs/dev/debt/shader.md.

Only that clause changes.

Before:

the behaviour is not measured on hardware (min, max and shifts cannot saturate, v_mul_lo_u16 remains open)

After:

measured on RDNA2 (gfx1036, AMD Windows driver 31.0.22044.1) in wave32 over 64 input rows, the bit changes none of the eight 32-bit results: v_mul_lo_u16 keeps the low 16 bits of an overflowing product instead of saturating, while v_add_nc_u16 with clamp saturates on the same part; wave64 is not measured

CHANGE SUMMARY (from the gate):

- removed: behaviour
- removed: measured on hardware (min, max and shifts cannot saturate, v_mul_lo_u16 remains open),
+ added:   measured on RDNA2 (gfx1036, AMD Windows driver 31.0.22044.1) in wave32 over 64 input rows,
+ added:   bit changes none of the eight 32-bit results: `v_mul_lo_u16` keeps the low 16 bits of an overflowing product instead of saturating, while `v_add_nc_u16` with clamp saturates on the same part; wave64
+ added:   measured,

Removed phrases declared to the gate: behaviour, measured on hardware (min, max and shifts cannot saturate, v_mul_lo_u16 remains open),. "measured" is re-added; "RDNA2 ISA Table 88 is cited only as an encoding reference pointer" and "console comparison on gfx1013 remains unmeasured" are unchanged.

Notes

  • debt-length: the entry grows from 714 to 917 characters, under the 1,000 guideline.
  • Not covered: wave64, opsel/high-half source forms, other 16-bit integer opcodes, other parts, and the console's gfx1013; the entry's "console comparison on gfx1013 remains unmeasured" stays.
  • Overlap: overlap_sweep.py on c50f19c4b8 (1,593 open PRs, 91 candidates, 91 evaluated, 0 hits; controls A/B fire, C silent). No open PR edits this entry.

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 (attached 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(TM) Graphics (gfx1036, driver 31.0.22044.1, Windows 11)
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5348360665 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/21997). Originally posted by [brumskysb](https://github.com/brumskysb) on 2026-11-17T01:08:24Z. --- ### What Measures one clause of the **[VOP3 16-bit integer binary clamp]** entry of `docs/dev/debt/shader.md` (added by #19337): "the behaviour is not measured on hardware (min, max and shifts cannot saturate, v_mul_lo_u16 remains open)". No code changes. Measured on gfx1036 (driver **31.0.22044.1**) with the hardware oracle, wave32. The bodies are the `Code` words of `Vop3Integer16Clamp.cpp` with only the destination register moved, so each of the eight opcodes runs with and without the clamp bit (bit 15 of the first VOP3 dword) on the same inputs: the test's 32 `Rows` plus 32 rows whose `v_mul_lo_u16` product exceeds 0xffff (64 input rows per opcode). - **Controls (step 1, 3 dispatches):** `v_mov_b32 v10, 0x2a` probe 32 of 32; `v_add_nc_u16` with clamp saturates to 0xffff on 16 of 16 overflow rows where the form without clamp wraps (32 of 32 match the low 16 bits of the sum), so the clamp bit reaches the 16-bit integer ALU on this part. - **Sweep (step 2, 4 dispatches):** with clamp and without clamp give the same 32-bit word on **0 of 1,152 differing** words (all eight opcodes, 64 rows each; `v_mul_lo_u16` in both bodies). `v_mul_lo_u16` with clamp keeps `(a*b) & 0xffff` on all 76 overflowing lanes (38 rows, two bodies) and never saturates to 0xffff; bits 31:16 of the destination are 0 in both forms. The test's lavapipe `Expected` table matches the hardware 288 of 288. - **Determinism (step 4, 8 dispatches):** all 4 sweep dispatches re-run in two fresh windows: 0 of 4,096 words differ from the archive. - **Independent recount** (`verify_clamp16.py`, reads the dumps only, decodes opcode, vdst and clamp from the raw words itself and cross-checks all 40 instruction words against `llvm-mc-21 -mcpu=gfx1036`, expected values from its own integer model): PASS, model 1,280 of 1,280 words; 18 mutation controls each fire from that passing baseline. The hardware agrees with the decoder's "without effect"; the implementation sentence is not edited. Evidence (runners, every dump, claims worksheets, checker, verifier, overlap sweeps, SHA-256 ledger): https://gist.github.com/brumskysb/71b0044d4089fa162d183af656623026 ### Tested - GPU: AMD Radeon(TM) Graphics, integrated RDNA2, `gfx1036`, driver **31.0.22044.1**, Windows 11. Harness: `tools/hw-oracle` via the campaign's `rigio.py` (in the gist). - Dispatches: 3 + 4 + 8 = 15. Fixture descriptor: none (VALU only). - Merge check: one commit on `c50f19c4b8`, the `main` fetched before the edit; it changes only line 269 of `docs/dev/debt/shader.md`. Only that clause changes. Before: > the behaviour is not measured on hardware (min, max and shifts cannot saturate, v_mul_lo_u16 remains open) After: > measured on RDNA2 (gfx1036, AMD Windows driver 31.0.22044.1) in wave32 over 64 input rows, the bit changes none of the eight 32-bit results: `v_mul_lo_u16` keeps the low 16 bits of an overflowing product instead of saturating, while `v_add_nc_u16` with clamp saturates on the same part; wave64 is not measured CHANGE SUMMARY (from the gate): ``` - removed: behaviour - removed: measured on hardware (min, max and shifts cannot saturate, v_mul_lo_u16 remains open), + added: measured on RDNA2 (gfx1036, AMD Windows driver 31.0.22044.1) in wave32 over 64 input rows, + added: bit changes none of the eight 32-bit results: `v_mul_lo_u16` keeps the low 16 bits of an overflowing product instead of saturating, while `v_add_nc_u16` with clamp saturates on the same part; wave64 + added: measured, ``` Removed phrases declared to the gate: `behaviour`, `measured on hardware (min, max and shifts cannot saturate, v_mul_lo_u16 remains open),`. "measured" is re-added; "RDNA2 ISA Table 88 is cited only as an encoding reference pointer" and "console comparison on gfx1013 remains unmeasured" are unchanged. ### Notes - `debt-length`: the entry grows from 714 to 917 characters, under the 1,000 guideline. - Not covered: wave64, opsel/high-half source forms, other 16-bit integer opcodes, other parts, and the console's gfx1013; the entry's "console comparison on gfx1013 remains unmeasured" stays. - Overlap: `overlap_sweep.py` on `c50f19c4b8` (1,593 open PRs, 91 candidates, 91 evaluated, 0 hits; controls A/B fire, C silent). No open PR edits this entry. ### 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 (attached 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(TM) Graphics (gfx1036, driver 31.0.22044.1, Windows 11) - [x] AI-assisted: yes
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!21997
No description provided.