Skip to content

docs/testing.md: which Known problems rows the game's shaders reach (op_reach --fssm, name patterns) - #6818

Merged
shayderrr merged 2 commits into
ItsNotRexed:mainfrom
abilliontokens:known-problems-reach
Nov 23, 2026
Merged

shayderrr merged 2 commits into
ItsNotRexed:mainfrom
abilliontokens:known-problems-reach

Conversation

@abilliontokens

Copy link
Copy Markdown
Contributor

Claimed in the coordination issue as: #6414 (comment) (docs/testing.md Known problems: which rows the game's shaders reach)

Depends on: #6735. This branch is built on it and extends its tools/op_reach.py. The diff below includes #6735's commit 32f09b1a8; this PR's own change is commit 6a1fa35a6. Once #6735 lands, only that commit remains.

What and why

Several rows of the Known problems table in docs/testing.md are tied to particular instructions: a fixture or fuzzer fails on some driver. A reader can't tell from the row whether a game shader can hit the same failure. This PR narrows those rows with counts over the 1.0.2.1 corpus.

  • tools/op_reach.py:
    • --fssm <dxbc>/fssm adds a count per compiled wave size, read with fssm_header.wave_size() (u32[0xD4] bit 5). With --index it also counts per stage and wave size.
    • An OP containing */? is now an fnmatch pattern over the printed names ('*_dpp'). A plain name is still a base name with every encoding merged.
  • tests/test_op_reach.py: 3 new tests (10 in total) on hand-written listings and synthetic FSSM headers that hold only the magic and the wave flag: pattern matching, the wave split (including a listing with no sidecar, which counts as w?), and the CLI with --fssm and its missing-folder exit 2.
  • docs/testing.md: a subsection after the Known problems table, "Which known problems the game's shaders reach". It is placed there so it does not touch the table rows that several open PRs edit.

Measured (1.0.2.1, 26,503 listings: 2,662 wave32 = 1,535 CS + 1,127 PS; 23,841 wave64)

Row Game reach
cs_w32_salu64 on RDNA1 / RADV 25.2.8 (high word of s_bfe_i64) 0 shaders use s_bfe_i64 (or s_bfe_u64)
lds_fuzz --wave 64 ds_bpermute_b32 on AMD's Windows driver 0 wave64 shaders; ds_bpermute_b32 is only in 5 wave32 CS
crosslane_fuzz --wave 64 AMD iGPU (v_permlanex16_b32 after a partial-row_mask DPP) DPP in 2,496 wave64 shaders, v_permlanex16_b32 in 561 wave64 shaders (upper bounds: the pairing and row_mask are not counted)
cs_dpp_ops on MoltenVK 1.4.2 DPP in 4,313 shaders (66,354 instructions)
MoltenVK f16 signed zero v_mul_f16 124, v_fma_f16 124, v_fmac_f16 130, v_pk_mul_f16 55, v_pk_fma_f16 47 shaders
ps_interp_f16_high on MoltenVK 16-bit interpolation in 4,776 PS
gs_tri / ms_tri on a Mac 195 GS, 9,282 MS

These are counts of instructions in the program; a count does not show that a shader reproduces the failure. The doc says so.

Tested

Commit 6a1fa35a6 (on #6735's 32f09b1a8, on origin/main 1cc6e3c12). Docs and a census tool only, with no translator change, so there is no translate/spirv-val before-and-after.

$ python -I tests/test_op_reach.py
Ran 10 tests
OK

$ for t in tests/test_docs_*.py tests/test_ci_registration.py; do python -I $t; done
OK (each)

$ python -I tools/op_reach.py <work>/shaders/dxbc/disasm --index <work>/shaders/dxbc/index.json --fssm <work>/shaders/dxbc/fssm s_bfe_i64 s_bfe_u64 '*_dpp' v_permlanex16_b32 v_permlane16_b32 ds_bpermute_b32 ds_permute_b32 v_mul_f16 v_pk_mul_f16 v_fma_f16 v_fmac_f16 v_pk_fma_f16 v_interp_p1ll_f16 v_interp_p2_f16
26503 listings {'cs': 2689, 'gs': 195, 'ms': 9282, 'ps': 12101, 'vs': 2236} {'w32': 2662, 'w64': 23841} ..., 2035 decoded instructions after the last s_endpgm left out

The run took about 3 minutes, CPU only, on Windows 11 (10.0.26200) with Python 3.12.10. No GPU or driver involved.

AI-assisted: yes (omp orchestrator).

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 rule changes.)

tools/op_reach.py counts, over a disassembled corpus, the shaders and
instructions using each instruction, merging the _e32/_e64/_sdwa/_dpp
encodings and counting only the program up to a listing's last s_endpgm
(decoded data words after it are reported separately). tests/test_op_reach.py
checks it on hand-written listings.

docs/isa_coverage.md lists, for the docs/design.md rows whose rule is partly
not measured on hardware (or 'not run on the shader corpus'), which
instructions no 1.0.2.1 shader uses (v_cvt_pknorm_*, v_cmp_class_f16/f64,
v_div_fixup_f16/f64, f16/f64 frexp/ldexp, f64 rcp/rsq/sqrt, ds_add_f32,
the fcmpswap family, s_cmov/s_pack, the x2 bitwise buffer atomics, the extra
image atomics, v_dot2c/v_dot8c, sub-dword buffer/global forms) and how many
use the others (16-bit interpolation 4,776 PS, v_fma_mix* 9,620, ...).
…op_reach --fssm, patterns)

tools/op_reach.py gains --fssm (count per compiled wave size, from the FSSM
header flag fssm_header.wave_size() reads, and per stage and wave size with
--index) and OP patterns over the printed names ('*_dpp'). Three new tests.

docs/testing.md: a subsection after the Known problems table with the
1.0.2.1 counts for the instruction-specific rows: no shader uses s_bfe_i64
(RDNA1/RADV cs_w32_salu64), no wave64 shader uses ds_bpermute_b32 (5 wave32
CS do; lds_fuzz --wave 64 on AMD's driver), DPP in 4,313 shaders (2,496
wave64), v_permlanex16_b32 in 2,293 (561 wave64), the five MoltenVK
signed-zero f16 ops in 47-130 shaders each, 16-bit interpolation in 4,776 PS,
195 GS and 9,282 MS for the Mac gs_tri/ms_tri row.
@wasonidas

Copy link
Copy Markdown

Independent CPU check of 6a1fa35a604cbf79fca774c07c35a5afbbef0e90 above #6735 32f09b1a. On Windows, test_op_reach.py passed 10/10 and test_fssm_header.py passed 42/42, plus four independent synthetic controls. Wildcards matched printed instruction names, multiple matches in one listing counted the listing once, and words after the last s_endpgm were excluded. Exact-length FSSM headers separated wave32 and wave64. Missing, truncated and wrong-magic sidecars stayed unknown, and missing stage metadata stayed unindexed.

The new testing table distinguishes opcode-level counts from operand and driver conditions, including the high-half interpolation operand. I did not remeasure the documented corpus counts. The unrelated line-ending check already fails on the base at tools/f64_omod_probe.py:268.

Synthetic inputs only. AI-assisted.

@shayderrr shayderrr left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary: Adds tools/op_reach.py, which counts per-instruction shader and instruction totals over a disassembled shader corpus, merging _e32/_e64/_sdwa/_dpp encodings through base_name() and excluding words after the last s_endpgm. With --index and --fssm it also splits counts by stage and compiled wave size. tests/test_op_reach.py exercises base-name normalization, encoding merging, post-endpgm exclusion, patterns, stage and wave splits, and CLI JSON and error paths. docs/isa_coverage.md and docs/testing.md record the measured 1.0.2.1 reach of unmeasured-contract rules and driver-fuzzer rows.

Why merge: Turns open hardware-coverage questions into measured, reproducible counts so effort can focus on instructions the game actually reaches.

Verdict: Approve

@shayderrr

Copy link
Copy Markdown
Collaborator

Summary: Adds tools/op_reach.py, which counts per-instruction shader and instruction totals over a disassembled shader corpus, merging _e32/_e64/_sdwa/_dpp encodings through base_name() and excluding words after the last s_endpgm. With --index and --fssm it also splits counts by stage and compiled wave size. tests/test_op_reach.py exercises base-name normalization, encoding merging, post-endpgm exclusion, patterns, stage and wave splits, and CLI JSON and error paths. docs/isa_coverage.md and docs/testing.md record the measured 1.0.2.1 reach of unmeasured-contract rules and driver-fuzzer rows.

Why merge: Turns open hardware-coverage questions into measured, reproducible counts so effort can focus on instructions the game actually reaches.

Verdict: Approve

@shayderrr
shayderrr merged commit 802ed3c into ItsNotRexed:main Nov 23, 2026
0 of 2 checks passed
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