Skip to content

docs/design.md: one copy of each rule in the Known approximations and 64-bit scalar bitwise rows - #4891

Open
LouisRiverstone wants to merge 4 commits into
ItsNotRexed:mainfrom
LouisRiverstone:docs-known-approx-row
Open

LouisRiverstone wants to merge 4 commits into
ItsNotRexed:mainfrom
LouisRiverstone:docs-known-approx-row

Conversation

@LouisRiverstone

Copy link
Copy Markdown
Contributor

Two more stitched docs/design.md rows, not covered by #3637 or #4879.

Known approximations (14,392 characters on main):

  • A block of about 17 sentences appears twice: the v_add_f64 omod, omod vs denormals, test_mode_round.py, the v_fma_mix, fma_mix_odd and transcendental sentences, and the MODE caveats.
  • Some sentences have two to four versions stitched inside them. For example, the v_fma_mix{lo,hi}_f16 sentence repeats its opening four times with different evidence, and ends with "the nearest-even path is unchanged (f32 Fma, then narrow)".
  • Older claims sit next to the newer measured ones that replaced them:
    • "Nearest-mode v_fma_mix* still rounds twice … unmeasured" (×2), and "In nearest mode the translator still rounds v_fma_mix{lo,hi}_f16 twice". The code calls Gen.fma_mix_odd for both modes (tools/rdna2spirv.py, the v_fma_mixlo/hi_f16 branch), and the row's own measured sentence says the hardware rounds once.
    • "v_cos_f16, v_exp_f16 and v_log_f16 are unmeasured", next to the exhaustive 65,536-input sweep of all seven (SHADER-132).
  • v_add_f64's FastTwoSum sentence was split at the unescaped |a| >= |b|. Its second half was spliced into the middle of the v_mul_legacy_f32 sentence (… RX 9070 XT). \| b \| , FastTwoSum …`).

The row now keeps one copy of each rule, always the newest wording already in it:

  • v_add_f64's sentence whole again, from b24f2ce where it was added, with the pipes escaped
  • the v_fma_mix sentence with all its evidence (gfx1036 7/7, the RX 6800 word, SHADER-296 / fix(translator): round v_fma_mixlo/hi_f16 once to f16 (finding 7079901079) #1774), which now says the translator uses fma_mix_odd in both modes, as the code does
  • the clean fma_mix_odd tiny-product sentence
  • the transcendental sentence with the exhaustive sweep

It goes from 14,392 to 5,028 characters. No measurement or attribution in the row is dropped, except the superseded "unmeasured" claims.

64-bit scalar bitwise ops: the two repeated sentences ("The lane-mask path … cannot be measured this way", "The lane-mask dispatch … was not re-measured") are dropped. The row's trailing \| is unchanged from main.

Checked:

  • the kept claims against tools/rdna2spirv.py (fma_mix_odd, f64_add_mode's FastTwoSum)
  • both rows have the same column count as their neighbours, with no unescaped | inside a cell
  • the tests/test_docs_*.py checks pass

Docs only. No game files. Claimed on #4816 before starting.

AI-assisted (Claude Code): I reviewed and ran the checks.

… 64-bit scalar bitwise rows

Known approximations (14,392 chars) held a repeated block of ~17 sentences,
sentences with two to four stitched versions inside them, older claims next to
the newer measured ones ('nearest-mode v_fma_mix* still rounds twice ...
unmeasured', 'v_cos/exp/log_f16 are unmeasured'), and v_add_f64's
FastTwoSum sentence split at the unescaped |a| >= |b| with its second half
spliced into the v_mul_legacy sentence. It now keeps one copy of each rule,
the newest wording already in the row: v_add_f64's sentence whole again
(from b24f2ce, pipes escaped), the v_fma_mix sentence that matches the code
(Gen.fma_mix_odd in both modes), the exhaustive 65,536-input transcendental
sweep. 64-bit scalar bitwise ops: two repeated sentences dropped. No
behaviour change.
@DenRakEiw

Copy link
Copy Markdown
Contributor

Tested on Windows 11 / Python 3.12.10 at head SHA a13c24e285d68be20c1d04d1818a4a350b1e2b22.

  • Trial-merge onto origin/main (d974c88a): clean (git diff --cached --check clean).
  • python -I tests/test_docs_design_rows.py: 4 passed (Ran 4 tests ... OK).
  • python -I tests/test_docs_links.py: 6 passed (Ran 6 tests ... OK).
  • Code read: deduplicates the 64-bit scalar bitwise ops and Known approximations rows in docs/design.md (preserving measurements and escaped pipes while aligning v_fma_mix{lo,hi}_f16 and v_add_f64 FastTwoSum notes with tools/rdna2spirv.py lines 820–823 and 9356–9360).

AI-assisted review (Gemini 4 Neon).

@LouisRiverstone

Copy link
Copy Markdown
Contributor Author

Thanks @DenRakEiw, on the current head a13c24e2, including the check of the kept v_fma_mix / FastTwoSum claims against the code. Nothing is pending. #4899 does the same for the EXEC, v_cvt_pknorm and Wave64 mask ballot rows.

@kapitche

Copy link
Copy Markdown
Contributor

Tested a13c24e merged with main 3faac55 on Linux (WSL2), Python 3.12.16: pass, with one note

  • All tests/test_docs_*.py (10 files) pass. Docs only, so no new test and no negative control applies.
  • Known approximations row: the kept claims match tools/rdna2spirv.py (fma_mix_odd is used for both modes at the v_fma_mix* branch).
  • Note: the 64-bit scalar bitwise ops row is still repeated after this PR. In the head, "Not GPU-verified" occurs 3 times (main: 3) and "hardware-verified on an AMD RX 7600 (gfx1102)" 5 times (main: 5), and "The measured plain-data words" 3 times; only two sentences were dropped (5,550 to 5,362 characters). If the PR title/body is meant to cover that row too, the stitched copies are still there.

@memorypressure

Copy link
Copy Markdown

Verified against current main (3faac55, merges cleanly): the docs guards pass, and a sentence-level comparison shows every fact removed from the two rows still appears at least once elsewhere in design.md — re-checked here on the strongest probes (the single-rounding statement, the finding citation, steps-back-one-ulp, the lane-mask caveat: each present in the result), and nothing ends at zero occurrences. The edit removes only duplicate copies of the same measurement, and fixes the self-contradictory fma_mix wording the old row had accumulated. For a reviewer skimming the raw diff: the sentence-level audit is why this is a content-preserving dedup, not a content loss. Checks pending. AI-assisted: yes. Tested on Linux (RTX 5080 host, CPU-only run).

…py of each sentence

@kapitche on ItsNotRexed#4891: the row was still stitched after dropping its two exact
repeats. An unescaped '(D.lo | D.hi)' had split the RX 7600 sentence, and
merges then repeated its pieces: three '**Not GPU-verified.**', five 'hardware-
verified on an AMD RX 7600', three 'The measured plain-data words' (a copy of
the RX 7900 XTX words spliced into the RX 7600 sentence). The row now keeps the
dispatch, plain-data, until, nand/nor/xnor and source sentences, the
CPU-checked + RX 7900 XTX hardware sentence ('on the same part' named: the
gfx1100 raw wave32 kernels of 3105a93), and the RX 7600 sentence whole with
its pipe escaped. 5,361 -> 2,501 characters. No behaviour change.
@LouisRiverstone

Copy link
Copy Markdown
Contributor Author

Thanks @kapitche, you're right: that row was still stitched. The exact-repeat pass only removed two sentences. An unescaped (D.lo | D.hi) had split the RX 7600 sentence, and merges repeated its pieces, including a copy of the RX 7900 XTX words spliced into the middle of it.

Rebuilt in 80871786 from one copy of each sentence (5,361 → 2,501 characters):

  • kept: the dispatch, plain-data, until, nand/nor/xnor and source sentences
  • the CPU-checked + hardware sentence, where "on the same part" now names the part: the RX 7900 XTX (gfx1100) raw wave32 kernels from 3105a93, @bobcatchris
  • the RX 7600 sentence whole, with its pipe escaped

Now "Not GPU-verified" occurs 0 times, "RX 7600" once, and the measured words once. The column count matches the neighbours, and the docs tests pass.

@sovljanskii

Copy link
Copy Markdown
Contributor

Fact-checked 80871786 merged with main 3faac557 (clean), on macOS, Apple M4, Python 3.15.2. The branch sits on d974c88a, but 3faac557 doesn't touch docs/, so the comparison is against current main.

Known approximations (docs/design.md:437), 14,392 → 5,028 characters

  • I compared the row with main's sentence by sentence. Of the 31 distinct sentences in main's row, 17 are kept word for word. The other 14 are either stitched or repeated variants of kept sentences, or the superseded claims listed in the PR body.
  • Every measurement I looked for is still there:
  • The dropped claims really are superseded. tools/rdna2spirv.py:9356-9358 calls Gen.fma_mix_odd for v_fma_mixlo/hi_f16 with no mode test, so "nearest mode still rounds twice … unmeasured" contradicted the code.

64-bit scalar bitwise ops (docs/design.md:403), 5,549 → 2,501 characters

  • main's row is 5,549 characters at 3faac557, not the 5,361 in your last comment. That doesn't change anything in the doc.

  • The new "an AMD RX 7900 XTX (gfx1100, raw wave32 kernels through tools/hw_oracle, bobcatchris)" replaces main's dangling "on the same part". I traced it to 3105a934 (docs: pin the scalar quadmask and 64-bit bitwise rows to measured words #1685): there "the same part" referred to the quadmask row just before it, which was measured on an RX 7900 XTX (gfx1100) with one raw wave32 kernel per op. So the substitution is correct.

  • Counts in the row, main → PR:

    main PR
    "Not GPU-verified." 3 0
    "cannot be measured this way" 4 1
    "was not re-measured" 5 1
    "RX 7600" 5 1

    The "Not GPU-verified" copies contradicted the hardware results. The RX 7600 sentence and the plain-data words remain whole.

Checks: both rows have 3 unescaped pipes (4 cells), like their neighbours. tests/test_docs_*.py: all 10 files OK. git diff --check is clean.

Note (not blocking): the row no longer points to the f16 transcendentals row for the RX 6700 XT sweep. That measurement is still at docs/design.md:339, so nothing is lost, but "(see the f16 transcendentals row)" could stay.

Overlap with #3074: both PRs change the same row and they conflict. This PR already has #3074's FastTwoSum sentence whole, and it removes the fragment #3074 leaves, so #3074 has nothing to add once this lands.

Verdict: pass.

AI-assisted.

…6 transcendentals row

@sovljanskii on ItsNotRexed#4891: the dedupe dropped the RX 6700 XT sweep and its
'see the f16 transcendentals row' pointer from this row. The measurement is
still in that row; the pointer is back.
@LouisRiverstone

Copy link
Copy Markdown
Contributor Author

Thanks @sovljanskii, and for checking fma_mix_odd against the dropped sentence. The pointer is back in 72a2d062: the RX 6700 XT sweep is named in the row again, with "see the f16 transcendentals row". The docs tests pass.

@cynbun

cynbun commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Reviewed 72a2d06 (docs read + tests/test_docs_*.py on Linux, Python 3.14): pass.

The only change since the checked 8087178 is one clause in the Known approximations row (docs/design.md:437): "...wave64), so they always narrow..." becomes "...wave64; an RX 6700 XT gave the same words with FP_ROUND round-toward-zero and round-to-nearest on every input of each, see the f16 transcendentals row), so...".

  • The clause is the wording already on main (in that row, three times), so nothing new is claimed.
  • It matches its source: the f16 transcendentals row (docs/design.md:339) measures all seven ops on an RX 6700 XT (gfx1031) over all 65,536 inputs and says "The f16 field of FP_ROUND is ignored: round toward zero gives the same words as round to nearest on every input."
  • All ten tests/test_docs_*.py OK (the row still has 4 cells), git diff --check clean, merges cleanly onto main 3faac55.

AI-assisted (Claude Code).

@LouisRiverstone

Copy link
Copy Markdown
Contributor Author

Merged current main. A later merge on main had stitched one more copy of the RX 7600 sentence into the "64-bit scalar bitwise ops" row ("RX 7600" 3 times there). The PR row keeps it once, as before, and the "Known approximations" row keeps the RX 6700 XT pointer. The docs tests pass.

@kapitche

kapitche commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Follow-up to my earlier comment (#4891 (comment), tested a13c24e): resolved.

Tested ca6109a merged with main 561b65a on Linux (WSL2), Python 3.12.16: pass.

  • All 11 tests/test_docs_*.py files run with -I, all OK (design_rows 4 tests, links 6, table_rows 2, table_ids 2).
  • The 64-bit scalar bitwise ops row is now 2,501 characters (was 5,362 at a13c24e). The exact string "The measured plain-data words" occurs 0 times in design.md (main: 4; I did not check how the PR rephrased it), "RX 7600" occurs once in that row, and "Not GPU-verified" occurs 30 times in the file against 33 on main, so the stitched copies are gone.
  • Docs only, so no negative control applies.

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.

6 participants