docs(debt): measure the VOP3 16-bit integer clamp in wave64 on gfx1036 #22615

Merged
MichonGoddijn231849 merged 2 commits from upstream-pr/22615 into main 2026-11-18 00:08:41 +00:00
MichonGoddijn231849 commented 2026-11-17 23:16:35 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MichonGoddijn231849 on 2026-11-17T23:16:35Z.


What

Closes the "wave64 is not measured" clause of the [VOP3 16-bit integer binary clamp] entry of docs/dev/debt/shader.md (the wave32 measurement came in #21997). No code changes; one debt fragment.

The body of Vop3Integer16Clamp.cpp's Code (the eight opcodes with the VOP3 clamp bit into v10..v17, the same eight without it into v18..v25) ran on RDNA2 hardware over the test's 32 Rows, in wave32 and in wave64 (rows repeated over 64 lanes):

  • wave32: 256 / 256 clamped words equal the test's Expected; the clamped and unclamped forms agree on 256 / 256.
  • wave64: 512 / 512 equal Expected; clamped and unclamped agree on 512 / 512.

The fragment replaces "wave64 is not measured" with that result; the rest of the entry is unchanged.

Tested

  • GPU: AMD Radeon(TM) Graphics, integrated RDNA2 (gfx1036), AMD Windows driver 32.0.21045.16010, Windows 11 Pro 10.0.26200, through tools/hw-oracle (HIP runtime). Float controls (integer opcodes): IEEE 0, DX10_CLAMP 1, f32 denormals flushed, f16/f64 kept, round to nearest even, FP16_OVFL 0.
  • python3 tools/check_conventions.py --base main on the branch: all checks passed.
Measurement script (run from the repository root; it reads the words, rows and expected values from the test file)
import re
import sys
sys.path.insert(0, "tools/hw-oracle")
from hw_oracle import run

src = open("core/libs/prx/libSceAgcDriver/tests/execution/Vop3Integer16Clamp.cpp").read()
code = [int(x, 16) for x in re.findall(r"0x([0-9a-fA-F]+)u", re.search(r"Code\{(.*?)\};", src, re.S).group(1))]
rows = [tuple(int(x, 16) for x in re.findall(r"0x([0-9a-fA-F]+)u", r)) for r in re.findall(r"\{(0x[^}]*)\}", re.search(r"Rows\[32\]\[4\] = \{(.*?)\n\};", src, re.S).group(1))]
expected = [[int(x, 16) for x in re.findall(r"0x([0-9a-fA-F]+)u", r)] for r in re.findall(r"\{(0x[^}]*)\}", re.search(r"Expected\[32\]\[Checked\] = \{(.*?)\n\};", src, re.S).group(1))]
start = code.index(0xbf8c3f70) + 1
end = next(i for i in range(start, len(code)) if (code[i] >> 26) == 0x38)
body = "\n".join(f"  .long 0x{w:08x}" for w in code[start:end]) + "\n"
for wave64 in (False, True):
    lanes = [rows[i % 32] for i in range(64 if wave64 else 32)]
    out = run(body, lanes, wave64=wave64, ieee=0, dx10_clamp=1, denorm32=0, denorm16=3, round32=0, round16=0, fp16_overflow=0)
    ok = sum(out[l][k] == expected[l % 32][k] for l in range(len(lanes)) for k in range(8))
    same = sum(out[l][k] == out[l][k + 8] for l in range(len(lanes)) for k in range(8))
    print(f"wave{64 if wave64 else 32}: {ok}/{len(lanes) * 8} equal Expected; clamp form == unclamped form {same}/{len(lanes) * 8}")

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(TM) Graphics (RDNA2 iGPU, gfx1036), AMD Windows driver 32.0.21045.16010, Windows 11 Pro 10.0.26200 (hardware oracle; no driver code changed)
  • AI-assisted: yes

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5366734862 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/22615). Originally posted by [MichonGoddijn231849](https://github.com/MichonGoddijn231849) on 2026-11-17T23:16:35Z. --- ### What Closes the "wave64 is not measured" clause of the **[VOP3 16-bit integer binary clamp]** entry of `docs/dev/debt/shader.md` (the wave32 measurement came in #21997). No code changes; one debt fragment. The body of `Vop3Integer16Clamp.cpp`'s `Code` (the eight opcodes with the VOP3 clamp bit into `v10`..`v17`, the same eight without it into `v18`..`v25`) ran on RDNA2 hardware over the test's 32 `Rows`, in wave32 and in wave64 (rows repeated over 64 lanes): - wave32: 256 / 256 clamped words equal the test's `Expected`; the clamped and unclamped forms agree on 256 / 256. - wave64: 512 / 512 equal `Expected`; clamped and unclamped agree on 512 / 512. The fragment replaces "wave64 is not measured" with that result; the rest of the entry is unchanged. ### Tested - GPU: AMD Radeon(TM) Graphics, integrated RDNA2 (`gfx1036`), AMD Windows driver 32.0.21045.16010, Windows 11 Pro 10.0.26200, through `tools/hw-oracle` (HIP runtime). Float controls (integer opcodes): IEEE 0, DX10_CLAMP 1, f32 denormals flushed, f16/f64 kept, round to nearest even, FP16_OVFL 0. - `python3 tools/check_conventions.py --base main` on the branch: all checks passed. <details><summary>Measurement script (run from the repository root; it reads the words, rows and expected values from the test file)</summary> ```python import re import sys sys.path.insert(0, "tools/hw-oracle") from hw_oracle import run src = open("core/libs/prx/libSceAgcDriver/tests/execution/Vop3Integer16Clamp.cpp").read() code = [int(x, 16) for x in re.findall(r"0x([0-9a-fA-F]+)u", re.search(r"Code\{(.*?)\};", src, re.S).group(1))] rows = [tuple(int(x, 16) for x in re.findall(r"0x([0-9a-fA-F]+)u", r)) for r in re.findall(r"\{(0x[^}]*)\}", re.search(r"Rows\[32\]\[4\] = \{(.*?)\n\};", src, re.S).group(1))] expected = [[int(x, 16) for x in re.findall(r"0x([0-9a-fA-F]+)u", r)] for r in re.findall(r"\{(0x[^}]*)\}", re.search(r"Expected\[32\]\[Checked\] = \{(.*?)\n\};", src, re.S).group(1))] start = code.index(0xbf8c3f70) + 1 end = next(i for i in range(start, len(code)) if (code[i] >> 26) == 0x38) body = "\n".join(f" .long 0x{w:08x}" for w in code[start:end]) + "\n" for wave64 in (False, True): lanes = [rows[i % 32] for i in range(64 if wave64 else 32)] out = run(body, lanes, wave64=wave64, ieee=0, dx10_clamp=1, denorm32=0, denorm16=3, round32=0, round16=0, fp16_overflow=0) ok = sum(out[l][k] == expected[l % 32][k] for l in range(len(lanes)) for k in range(8)) same = sum(out[l][k] == out[l][k + 8] for l in range(len(lanes)) for k in range(8)) print(f"wave{64 if wave64 else 32}: {ok}/{len(lanes) * 8} equal Expected; clamp form == unclamped form {same}/{len(lanes) * 8}") ``` </details> ### 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(TM) Graphics (RDNA2 iGPU, gfx1036), AMD Windows driver 32.0.21045.16010, Windows 11 Pro 10.0.26200 (hardware oracle; no driver code changed) - [x] AI-assisted: yes 🤖 Generated with [Claude Code](https://claude.com/claude-code)
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!22615
No description provided.