docs(debt): measure v_interp f16 denormal modes 1/2 and directed rounding on gfx1036 #18026

Merged
brumskysb merged 2 commits from upstream-pr/18026 into main 2026-11-13 22:25:04 +00:00
brumskysb commented 2026-11-10 05:26:08 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by brumskysb on 2026-11-10T05:26:08Z.


What

Measures the gap clause of the v_interp_p1ll_f16, v_interp_p1lv_f16 and v_interp_p2_f16 entry of docs/dev/debt/shader.md — "Denormal modes 1 and 2 (flush only inputs or only outputs) and rounding other than to nearest even are not measured and throw" — on a second RDNA2 part.

Measured on gfx1036 (driver 31.0.22044.1) with the hardware oracle, wave32, one work-group, the parameters written to LDS by a compute dispatch and read with v_interp_* (layout measured first: M0 is a byte address, attribute stride 48 bytes, P0 +0 / P10 +4 / P20 +32 for channel x):

  • Control first: the 32 rows of InterpolationModes.cpp Rows in the 8 pinned modes reproduce 768/768 words of the gfx1035 table. That is a family-level reproduction (pin from gfx1035, this part gfx1036), not a re-measurement of the entry's numbers.
  • Denormal fields 0-3 (IEEE {0,1} x denorm32 {0..3} x denorm16 {0..3}, nearest-even, 64 dispatches): with isolation rows where only one operand or only the result can change the word, bit 0 of each field keeps that precision's denormal inputs (I/J and p2's f32 S2 under denorm32; P0, P10/P20 and p1lv's f16 S2 under denorm16) and bit 1 keeps its denormal result (f32 for p1ll/p1lv, f16 for p2). Identical at IEEE 0 and 1; a flushed result is a zero of its sign.
  • Directed rounding (round32 {0..3} x round16 {0..3} at IEEE 0 with each denormal field 0 or 3, and at IEEE 1 with both kept; 96 dispatches; rows at exact, 0.25 ulp, even and odd ties, 0.75 ulp, overflow and denormal-result ties, both signs): v_interp_p1ll_f16 and v_interp_p1lv_f16 round their f32 result by the f32 field and v_interp_p2_f16 its f16 result by the f16 field — 3,840/3,840 cells equal the governing mode's key; a denormal result under a flushing field is a signed zero in every rounding mode, including +inf/-inf. Each dump proves its own mode in-band: plain v_add_f32/v_add_f16 odd ties, 384/384.
  • Determinism: one leg of each, two fresh-process windows each, 640/640 words identical, with the rig-side output deleted and verified absent before every dispatch and the rig's code-object SHA-256 equal to the local one.

The recompiler still throws in all of these modes (interpolationModeF16 in AttributeInstructions.cpp, read at this base): the entry keeps "throw". That is a code reading; no code changes in this PR.

Evidence (fixture, layout probe, row generators, runners, checkers, all 172 dumps as one bundle, per-dump SHA-256 ledger, claims worksheet, full results): https://gist.github.com/brumskysb/a48e81092e9a459dcac4ead9c5e72479

  • Gate change summary (verbatim): removed are, throw.; added throw. Measured on gfx1036 (driver 31.0.22044.1) with the hardware oracle at wave32, separate from the implementation: …, measured, and none of these modes is, on gfx1035. None of that is implemented: the recompiler still throws for denormal modes 1, 2 and for rounding other than to nearest even, so these rows record hardware it does not yet model. The two removed words are re-added inside the longer clause; no measured condition was dropped.
  • Clause split (reviewer suggestion): gabichuuuuu's non-blocking review asked for the gfx1036 measurement to stand apart from the implemented behaviour with an explicit "measured, not implemented, still throws". The measurement clause now opens Measured on gfx1036 … separate from the implementation: and closes by saying none of it is implemented, because interpolationModeF16 (Translation/src/AttributeInstructions.cpp:109-118) throws for any round field other than 0 and any denormal field outside {0,3}. No measurement changed in that edit; the lengths quoted above are updated.

Tested

  • GPU: AMD Radeon(TM) Graphics, integrated RDNA2, gfx1036, driver 31.0.22044.1, Windows 11; harness tools/hw-oracle through rig_runner.py, wave32, 32 rows, one work-group, LDS 4096, DX10 clamp 1, fp16_overflow 0.
  • Body per row: v_interp_p1ll_f16 v35, v30, attrN.x, v_interp_p2_f16 v36, v31, attrN.x, v32, v_interp_p1lv_f16 v37, v33, attrN.x, v34, then v_readlane_b32/v_writelane_b32 into lane N of v10..v12.
  • 8 + 64 + 96 + 4 dispatches; every dump's mode re-derived from its own fields, inputs checked against the row set; step2_check.py and step3_check.py recompute every count from the dumps. Gist README.md, dumps_bundle.json and step3_check.py raw-URL SHA-256 equal the local files.
  • Descriptor axis: none — no image resource is involved.

The replaced region, copied from check_entry_edit.py's REPLACED REGION:

- are not measured and throw.
+ throw. On a second part, RDNA2 (gfx1036, driver 31.0.22044.1), they were measured with the hardware oracle in wave32: bit 0 of each denormal field keeps the denormal inputs listed above for that precision and bit 1 its denormal result, at both `IEEE_MODE` values with nearest-even rounding; with each denormal field 0 or 3, v_interp_p1ll_f16 and v_interp_p1lv_f16 round their f32 result by the f32 rounding mode and v_interp_p2_f16 its f16 result by the f16 one, in all four modes, and a flushed denormal result is a zero of its sign in every mode. Directed rounding with denormal modes 1 and 2, or with IEEE=1 and a flushing field, is not measured, and none of these modes is measured on gfx1035.

before:
... Denormal modes 1 and 2 (flush only inputs or only outputs) and rounding other than to nearest even are not measured and throw. An unknown mode follows IEEE=0 with denormals kept. ...

after:
... Denormal modes 1 and 2 (flush only inputs or only outputs) and rounding other than to nearest even throw. On a second part, RDNA2 (gfx1036, driver 31.0.22044.1), they were measured with the hardware oracle in wave32: bit 0 of each denormal field keeps the denormal inputs listed above for that precision and bit 1 its denormal result, at both IEEE_MODE values with nearest-even rounding; with each denormal field 0 or 3, v_interp_p1ll_f16 and v_interp_p1lv_f16 round their f32 result by the f32 rounding mode and v_interp_p2_f16 its f16 result by the f16 one, in all four modes, and a flushed denormal result is a zero of its sign in every mode. Directed rounding with denormal modes 1 and 2, or with IEEE=1 and a flushing field, is not measured, and none of these modes is measured on gfx1035. An unknown mode follows IEEE=0 with denormals kept. ...

Removed phrases declared to the gate: are and and throw. — the clause loses only "are not measured and"; "throw" stays, and "not measured" moves to the conditions this campaign did not cover. The gfx1035 record, the NaN rules, "An unknown mode follows IEEE=0 with denormals kept" and the other two unconfirmed qualifiers (P10/P20 rounding, the tessellation path) are untouched.

Notes

  • debt-length warning: the entry grows from 2,102 to 2,955 characters; it was already 1,102 over the 1,000 guideline. No measured condition was compressed to fit; trimming the entry is its own PR.
  • Not covered, and the new text does not claim it: directed rounding with denormal field 1 or 2, directed rounding at IEEE 1 with a flushing field, any of these modes on gfx1035, the PS5's gfx1013, wave64, and a real pixel-shader attribute path (the fixture is a compute dispatch reading LDS).
  • Overlap: the 300 most recent open PRs were scanned; 6 touch docs/dev/debt/shader.md (#17974, #17967, #17932, #17807, #17733, #17701) and none of them edits this entry (#17733 carries it only as diff context).

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:5236337140 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/18026). Originally posted by [brumskysb](https://github.com/brumskysb) on 2026-11-10T05:26:08Z. --- ### What Measures the gap clause of the **v_interp_p1ll_f16, v_interp_p1lv_f16 and v_interp_p2_f16** entry of `docs/dev/debt/shader.md` — "Denormal modes 1 and 2 (flush only inputs or only outputs) and rounding other than to nearest even are not measured and throw" — on a second RDNA2 part. Measured on gfx1036 (driver **31.0.22044.1**) with the hardware oracle, wave32, one work-group, the parameters written to LDS by a compute dispatch and read with `v_interp_*` (layout measured first: M0 is a byte address, attribute stride 48 bytes, P0 +0 / P10 +4 / P20 +32 for channel x): - **Control first:** the 32 rows of `InterpolationModes.cpp` `Rows` in the 8 pinned modes reproduce **768/768** words of the gfx1035 table. That is a family-level reproduction (pin from gfx1035, this part gfx1036), not a re-measurement of the entry's numbers. - **Denormal fields 0-3** (IEEE {0,1} x denorm32 {0..3} x denorm16 {0..3}, nearest-even, 64 dispatches): with isolation rows where only one operand or only the result can change the word, bit 0 of each field keeps that precision's denormal **inputs** (I/J and p2's f32 S2 under denorm32; P0, P10/P20 and p1lv's f16 S2 under denorm16) and bit 1 keeps its denormal **result** (f32 for p1ll/p1lv, f16 for p2). Identical at IEEE 0 and 1; a flushed result is a zero of its sign. - **Directed rounding** (round32 {0..3} x round16 {0..3} at IEEE 0 with each denormal field 0 or 3, and at IEEE 1 with both kept; 96 dispatches; rows at exact, 0.25 ulp, even and odd ties, 0.75 ulp, overflow and denormal-result ties, both signs): v_interp_p1ll_f16 and v_interp_p1lv_f16 round their f32 result by the **f32** field and v_interp_p2_f16 its f16 result by the **f16** field — **3,840/3,840** cells equal the governing mode's key; a denormal result under a flushing field is a signed zero in every rounding mode, including +inf/-inf. Each dump proves its own mode in-band: plain `v_add_f32`/`v_add_f16` odd ties, **384/384**. - **Determinism:** one leg of each, two fresh-process windows each, **640/640** words identical, with the rig-side output deleted and verified absent before every dispatch and the rig's code-object SHA-256 equal to the local one. The recompiler still throws in all of these modes (`interpolationModeF16` in `AttributeInstructions.cpp`, read at this base): the entry keeps "throw". That is a code reading; no code changes in this PR. Evidence (fixture, layout probe, row generators, runners, checkers, all 172 dumps as one bundle, per-dump SHA-256 ledger, claims worksheet, full results): https://gist.github.com/brumskysb/a48e81092e9a459dcac4ead9c5e72479 - **Gate change summary (verbatim):** removed `are`, `throw.`; added `throw. Measured on gfx1036 (driver 31.0.22044.1) with the hardware oracle at wave32, separate from the implementation: …`, `measured, and none of these modes is`, `on gfx1035. None of that is implemented: the recompiler still throws for denormal modes 1`, `2 and for rounding other than to nearest even, so these rows record hardware it does not yet model.` The two removed words are re-added inside the longer clause; no measured condition was dropped. - **Clause split (reviewer suggestion):** `gabichuuuuu`'s non-blocking review asked for the gfx1036 measurement to stand apart from the implemented behaviour with an explicit "measured, not implemented, still throws". The measurement clause now opens `Measured on gfx1036 … separate from the implementation:` and closes by saying none of it is implemented, because `interpolationModeF16` (`Translation/src/AttributeInstructions.cpp:109-118`) throws for any round field other than 0 and any denormal field outside {0,3}. No measurement changed in that edit; the lengths quoted above are updated. ### Tested - GPU: AMD Radeon(TM) Graphics, integrated RDNA2, `gfx1036`, driver **31.0.22044.1**, Windows 11; harness `tools/hw-oracle` through `rig_runner.py`, wave32, 32 rows, one work-group, LDS 4096, DX10 clamp 1, fp16_overflow 0. - Body per row: `v_interp_p1ll_f16 v35, v30, attrN.x`, `v_interp_p2_f16 v36, v31, attrN.x, v32`, `v_interp_p1lv_f16 v37, v33, attrN.x, v34`, then `v_readlane_b32`/`v_writelane_b32` into lane N of v10..v12. - 8 + 64 + 96 + 4 dispatches; every dump's mode re-derived from its own fields, inputs checked against the row set; `step2_check.py` and `step3_check.py` recompute every count from the dumps. Gist `README.md`, `dumps_bundle.json` and `step3_check.py` raw-URL SHA-256 equal the local files. - Descriptor axis: none — no image resource is involved. The replaced region, copied from `check_entry_edit.py`'s REPLACED REGION: ``` - are not measured and throw. + throw. On a second part, RDNA2 (gfx1036, driver 31.0.22044.1), they were measured with the hardware oracle in wave32: bit 0 of each denormal field keeps the denormal inputs listed above for that precision and bit 1 its denormal result, at both `IEEE_MODE` values with nearest-even rounding; with each denormal field 0 or 3, v_interp_p1ll_f16 and v_interp_p1lv_f16 round their f32 result by the f32 rounding mode and v_interp_p2_f16 its f16 result by the f16 one, in all four modes, and a flushed denormal result is a zero of its sign in every mode. Directed rounding with denormal modes 1 and 2, or with IEEE=1 and a flushing field, is not measured, and none of these modes is measured on gfx1035. ``` before: `... Denormal modes 1 and 2 (flush only inputs or only outputs) and rounding other than to nearest even are not measured and throw. An unknown mode follows IEEE=0 with denormals kept. ...` after: `... Denormal modes 1 and 2 (flush only inputs or only outputs) and rounding other than to nearest even throw. On a second part, RDNA2 (gfx1036, driver 31.0.22044.1), they were measured with the hardware oracle in wave32: bit 0 of each denormal field keeps the denormal inputs listed above for that precision and bit 1 its denormal result, at both `IEEE_MODE` values with nearest-even rounding; with each denormal field 0 or 3, v_interp_p1ll_f16 and v_interp_p1lv_f16 round their f32 result by the f32 rounding mode and v_interp_p2_f16 its f16 result by the f16 one, in all four modes, and a flushed denormal result is a zero of its sign in every mode. Directed rounding with denormal modes 1 and 2, or with IEEE=1 and a flushing field, is not measured, and none of these modes is measured on gfx1035. An unknown mode follows IEEE=0 with denormals kept. ...` Removed phrases declared to the gate: `are` and `and throw.` — the clause loses only "are not measured and"; "throw" stays, and "not measured" moves to the conditions this campaign did not cover. The gfx1035 record, the NaN rules, "An unknown mode follows IEEE=0 with denormals kept" and the other two unconfirmed qualifiers (P10/P20 rounding, the tessellation path) are untouched. ### Notes - **`debt-length` warning:** the entry grows from 2,102 to 2,955 characters; it was already 1,102 over the 1,000 guideline. No measured condition was compressed to fit; trimming the entry is its own PR. - Not covered, and the new text does not claim it: directed rounding with denormal field 1 or 2, directed rounding at IEEE 1 with a flushing field, any of these modes on gfx1035, the PS5's gfx1013, wave64, and a real pixel-shader attribute path (the fixture is a compute dispatch reading LDS). - Overlap: the 300 most recent open PRs were scanned; 6 touch `docs/dev/debt/shader.md` (#17974, #17967, #17932, #17807, #17733, #17701) and none of them edits this entry (#17733 carries it only as diff context). ### 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
gabichuuuuu commented 2026-11-10 17:50:01 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by gabichuuuuu on 2026-11-10T17:50:01Z.

Review: COMMENTED


Read 41bdb64537 against main.

Correctness. TranslationContext::interpolationModeF16 (Translation/src/AttributeInstructions.cpp:109-118) still throws when mode & 0xf != 0 or either denormal field is 1 or 2, and the entry keeps saying those modes and non-nearest rounding "throw", so the text stays consistent with the code. "An unknown mode follows IEEE=0 with denormals kept" matches if (!floatMode.has_value()) return 0u (line 110). The sentence on main is unchanged since the PR base. The new gfx1036 paragraph is only a measurement record; the code does not implement it and agc_driver_interpolation_modes has no gfx1036 rows pinned.

Non-blocking. The entry is now one very long paragraph that mixes what is implemented with measurements the code does not use. A separate clause ("measured on gfx1036, not implemented, still throws") would make the open gap clearer. Same rig as #17807 and #18142 (gfx1036, driver 31.0.22044.1); no overlap with them.

Not run here; this is from reading the code.

AI-assisted: yes.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5846666359 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/18026#pullrequestreview-5846666359). Originally posted by [gabichuuuuu](https://github.com/gabichuuuuu) on 2026-11-10T17:50:01Z. **Review:** COMMENTED --- Read `41bdb64537` against `main`. **Correctness.** `TranslationContext::interpolationModeF16` (`Translation/src/AttributeInstructions.cpp:109-118`) still throws when `mode & 0xf != 0` or either denormal field is 1 or 2, and the entry keeps saying those modes and non-nearest rounding "throw", so the text stays consistent with the code. "An unknown mode follows IEEE=0 with denormals kept" matches `if (!floatMode.has_value()) return 0u` (line 110). The sentence on main is unchanged since the PR base. The new gfx1036 paragraph is only a measurement record; the code does not implement it and `agc_driver_interpolation_modes` has no gfx1036 rows pinned. **Non-blocking.** The entry is now one very long paragraph that mixes what is implemented with measurements the code does not use. A separate clause ("measured on gfx1036, not implemented, still throws") would make the open gap clearer. Same rig as #17807 and #18142 (gfx1036, driver 31.0.22044.1); no overlap with them. Not run here; this is from reading the code. 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!18026
No description provided.