Skip to content

docs: VOP3 output modifiers measured on RDNA2 (gfx1031) (SHADER-353) - #2062

Merged
ItsNotRexed merged 1 commit into
ItsNotRexed:mainfrom
dororodev:shader-353-rdna2-omod
Nov 22, 2026
Merged

ItsNotRexed merged 1 commit into
ItsNotRexed:mainfrom
dororodev:shader-353-rdna2-omod

Conversation

@dororodev

Copy link
Copy Markdown
Contributor

Claimed in the coordination issue as: SHADER-353 (claim)

What and why

SHADER-353 asks whether the VOP3 output modifiers (mul:2, mul:4, div:2) behave on RDNA2 as they were measured on gfx1150 (RDNA3.5). SHADER-187 (#1281) changes the translator on that evidence, and the console is RDNA2.

Answer: yes, rule for rule, on a discrete RDNA2 card (RX 6700 XT, gfx1031). tools/f32_fuzz.py --oracle hw, seeds 1 to 6: 39,101 programs, 0 mismatch, 66 known omod_neg_zero deviations. Counting only the programs where the modifier changes the result:

omod flush (IEEE off, f32 denormals flushed: the game's mode) keep (f32 denormals kept) no_dx10 ieee (MODE.IEEE = 1)
applied 2,680 869 2,680 0
applied, but a -0 result becomes +0 66 22 66 0
ignored 0 1,811 0 2,650
-0 result kept (applied or ignored, same word) 0 44 0 65
other 0 0 0 31
  • IEEE off, denormals flushed: the modifier is always applied, and a -0 result becomes +0. The translator keeps -0 today (SHADER-187: canonicalize f32 negative zero before VOP3 omod #1281 is the fix).
  • Denormals kept: the 869 + 22 applied are all v_rcp/rcp_iflag/rsq/sqrt/exp/log_f32 and the four cube ops (exactly OMOD_IGNORES_DENORM_MODE). The 1,811 ignored are all ALU ops.
  • IEEE on: ignored, and no program applied it unambiguously.
  • The 31 "other" with IEEE on are all v_min/max/min3/max3/med3_f32 programs with a signalling-NaN source, which the IEEE-off min/max rules of Coordinating who works on what (3) (moved to #1006) #634 don't cover. The modifier isn't what differs there. (I checked all 31 operand lists.)

Changes:

  • docs/design.md: the "Output modifiers on hardware (gfx1150)" row appeared twice (probably a merge leftover), and the two copies contradicted each other: one said "RDNA2 itself is unmeasured", the other cited the gfx1036 run. This merges them into one row, keeps every fact from both (the gfx1036 counts, v_rcp_iflag_f32, the SHADER-298 v_fma_mix* note) and adds the gfx1031 result.
  • docs/shader_validation.md: the gfx1031 run and the table above, after the gfx1036 paragraphs.
  • tools/f32_fuzz.py, omod_label: when the result is -0 both with and without the modifier, a -0 from the hardware shows neither "applied" nor "ignored". It used to be counted as "applied", so the ieee column read "applied 65" although no unambiguous program applied it. It now gets its own label. The "applied, but a -0 result becomes +0" path is unchanged. Also widened the table's label column, and replaced the "RDNA2 unmeasured" notes in the docstrings.
  • tests/test_f32_fuzz.py: one test for the omod_label labels, the -0 case included. It failed before the change.

Tested

  • GPU: AMD Radeon RX 6700 XT (gfx1031, RDNA2), AMD Windows driver 26.11.2 (Vulkan 1.4.315), Windows 11 10.0.26200.
  • Toolchain: amdhip64_6.dll from the driver, AMD clang 24.0.0git (rocm-sdk-core 10.2.0), WinLibs MinGW gcc as LEONIDA_HOST_CC, Python 3.11.6.
  • python -I tools/f32_fuzz.py --oracle hw --programs 5000 --seed N, N = 1..6, on main at 4eb6155d and again with this branch. Same judged counts both times: 28,856 match, 0 mismatch, 66 known deviation, 4,056 skipped (GFX10.1-only mad opcodes), 3,201 denormal, 2,922 other. MODE read back as 0x1c0 / 0x1f0 / 0xc0 / 0x3c0.
  • python -I tools/f32_fuzz.py --oracle hw --negative-control: all six wrong models caught (5 to 23 mismatches).
  • python -I tests/test_f32_fuzz.py: 26 tests OK (1 skipped, as on main). python -m compileall -q make_game.py tools tests: clean.

Not measured: gfx1013 itself (no such part available), and the GFX10.1-only v_mad* opcodes, which gfx1031 doesn't have (SHADER-340).

Checklist

  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (No translator change; the measured hardware rule is in the merged row.)

AI-assisted (Claude Code).

🤖 Generated with Claude Code

tools/f32_fuzz.py --oracle hw, seeds 1 to 6, on an RX 6700 XT (gfx1031,
AMD Windows driver 26.11.2): 39,101 programs, 0 mismatch, 66 omod -0 -> +0
deviations. mul:2/mul:4/div:2 behave as measured on gfx1150: applied with
IEEE off and f32 denormals flushed (a -0 result becomes +0), ignored by the
ALU ops with denormals kept (the transcendental and cube ops still apply
them), ignored with MODE.IEEE = 1.

- docs/design.md: merge the two duplicated "Output modifiers on hardware"
  rows (one said RDNA2 was unmeasured, the other cited gfx1036) and add the
  gfx1031 numbers.
- docs/shader_validation.md: the gfx1031 run and its omod table.
- tools/f32_fuzz.py: omod_label no longer counts a -0 result that the omod
  cannot change as "applied" (65 such programs showed up as "applied" in
  the ieee column); widen the table's label column; drop "RDNA2 unmeasured".
- tests/test_f32_fuzz.py: the omod_label labels, the -0 case included.

AI-assisted (Claude Code).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Jadiac5

Jadiac5 commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Tested 09c3394b on Windows 11, Python 3.11.2: pass

  • Ran python -m compileall -q make_game.py tools tests (clean) and python -m unittest discover -s tests/semantic (1671 OK, 2 skipped; same as main at 4eb6155d).
  • python -I tests/test_f32_fuzz.py: 26 tests, 1 error; main has 25 tests and the same 1 error. The error is HardwareOracle.test_on_hardware on this machine ("MODE dx10_clamp, ieee cannot be set on gfx1201"), not something this PR changes.
  • The new test test_omod_label_does_not_count_a_kept_minus_zero_as_applied fails with tools/f32_fuzz.py from main ('applied' != '-0 result kept (applied or ignored, same word)') and passes with the PR's.
  • python -I tests/test_docs_design_rows.py: repeated topics in docs/design.md go from 24 on main to 23, because the two "Output modifiers on hardware (gfx1150)" rows become one. I compared the merged row with both old rows: the gfx1036 counts, the v_rcp_iflag_f32 sentence and the SHADER-298 v_fma_mix* sentence are all kept.
  • The counts in docs/shader_validation.md add up: 28,856 + 0 + 66 + 4,056 + 3,201 + 2,922 = 39,101.
  • Read the omod_label change (tools/f32_fuzz.py:1108): the new label is returned only when the model gives the same word with and without the omod and the hardware gives that word, which is the case the doc describes. No concerns.
  • Not done: no --oracle hw run on RDNA2 (the measurement is the author's), no spirv-val, no GPU, no corpus run.

AI-assisted (Claude Code).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants