upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/docs/isa_coverage.md
diff options
context:
space:
mode:
authorRafael <rafaelalvesp2005@gmail.com>2026-11-23 15:36:26 -0300
committerRafael <rafaelalvesp2005@gmail.com>2026-11-23 15:36:26 -0300
commit63f0e0dea3a9d44201db408c4e2c3f2f5b2b94d6 (patch)
tree86f0dcad8070e2a3a693ef4897aa83950cfeb224 /docs/isa_coverage.md
parentf78f7d6a2a9364cb128c03ac539fe540d5c70df1 (diff)
parent6dda0630bd6fc0514baadb94fb98e36bd7d64c0b (diff)
Merge main into fix/walk-bink_names
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'docs/isa_coverage.md')
-rw-r--r--docs/isa_coverage.md66
1 files changed, 60 insertions, 6 deletions
diff --git a/docs/isa_coverage.md b/docs/isa_coverage.md
index cef03230c..c5e4e029e 100644
--- a/docs/isa_coverage.md
+++ b/docs/isa_coverage.md
@@ -63,17 +63,71 @@ four `_l`/`_lz` forms, packed image formats (`*_pck`, `*_by2`), the 16-bit `v_pk
63`*_saveexec` / `s_nand`/`s_nor`/`s_xnor` scalar forms. `python -I tools/isa_coverage.py --list` has the full list per 63`*_saveexec` / `s_nand`/`s_nor`/`s_xnor` scalar forms. `python -I tools/isa_coverage.py --list` has the full list per
64encoding. 64encoding.
65 65
66Names the translator matches that are not in the RDNA2 XML (16), each checked with 66Names the translator matches that are not in the RDNA2 XML (10), each checked with
67`llvm-mc -arch=amdgcn -mcpu=gfx1013`: 67`llvm-mc -arch=amdgcn -mcpu=gfx1013`:
68 68
69| name | llvm-mc for gfx1013 | verdict | 69| name | llvm-mc for gfx1013 | verdict |
70|---|---|---| 70|---|---|---|
71| `s_and_b32_mask`, `s_or_b32_mask` | invalid instruction | dead: nothing in the repository produces them |
72| `v_add_u16`, `v_sub_u16` | other GPU only | internal: `v_add_nc_u16` / `v_sub_nc_u16` are re-dispatched under these names | 71| `v_add_u16`, `v_sub_u16` | other GPU only | internal: `v_add_nc_u16` / `v_sub_nc_u16` are re-dispatched under these names |
73| `v_subrev_u16`, `v_and_b16`, `v_or_b16`, `v_xor_b16` | other GPU only | dead GFX9 spellings, harmless |
74| `s_delay_alu` | other GPU only (RDNA3) | deliberate, in `NOOPS` | 72| `s_delay_alu` | other GPU only (RDNA3) | deliberate, in `NOOPS` |
75| `v_mac_f32`, `v_mac_legacy_f32`, `v_mad_f32`, `v_mad_legacy_f32`, `v_madak_f32`, `v_madmk_f32`, `s_get_waveid_in_workgroup` | valid | real gfx1013 instructions that AMD's XML omits | 73| `v_mac_f32`, `v_mac_legacy_f32`, `v_mad_f32`, `v_mad_legacy_f32`, `v_madak_f32`, `v_madmk_f32`, `s_get_waveid_in_workgroup` | valid | real gfx1013 instructions that AMD's XML omits |
76 74
77None is a typo that breaks translation, so there is nothing to fix in the translator; the two `_mask` names and the 75None is a typo that breaks translation, so there is nothing to fix in the translator. No name ends in a suffix
78four dead 16-bit spellings are candidates for removal. No name ends in a suffix `base_op()` strips (`_e32`, `_e64`, 76`base_op()` strips (`_e32`, `_e64`, `_sdwa`, `_dpp`), and every `startswith` prefix matches at least one RDNA2
79`_sdwa`, `_dpp`), and every `startswith` prefix matches at least one RDNA2 instruction. 77instruction.
78
79## Which rules the game reaches that hardware has not checked
80
81Several rows of the translator contract in `docs/design.md` say part of a rule is not measured on hardware, or
82not run on the shader corpus. `tools/op_reach.py` counts, over the disassembled corpus, the shaders and
83instructions that use each instruction. It merges the `_e32`/`_e64`/`_sdwa`/`_dpp` encodings and counts only the
84program up to a listing's last `s_endpgm`. The counts say whether 1.0.2.1 depends on the rule at all. They do
85not settle the hardware question.
86
87```sh
88python -I tools/op_reach.py <work>/shaders/dxbc/disasm --index <work>/shaders/dxbc/index.json v_cos_f16 v_log_f16 ...
89```
90
91Measured on the 26,503 1.0.2.1 listings (`shaders.rpf`, LLVM gfx1013; 12,101 PS, 9,282 MS, 2,689 CS, 2,236 VS,
92195 GS). The 2,035 decoded instructions after a listing's last `s_endpgm` are left out: they are data words, and
93the only place `s_cmov_b32` appears (4 listings). The embedded programs (the BVH builder's 52 FSSM programs,
94[embedded_shaders.md](embedded_shaders.md), and the 29 FidelityFX programs, [fspx.md](fspx.md)) are not counted,
95and a later game build may differ.
96
97**No 1.0.2.1 shader uses these instructions**, so on this build the unmeasured parts of their rows have no effect:
98
99| `docs/design.md` row | instructions with 0 shaders |
100|---|---|
101| Sub-dword MUBUF loads | `buffer_load_ubyte`, `_sbyte`, `_ushort`, `_sshort` |
102| 8/16-bit global stores and d16 loads | `global_store_byte`, `_short` and their `_d16_hi` forms; `global_load_{u,s}byte_d16`, `global_load_short_d16` and their `_hi` forms |
103| `v_rcp_f64`, `v_rsq_f64`, `v_sqrt_f64` | all three |
104| `ds_cmpst_f32`/`_rtn_f32`, `global_atomic_fcmpswap`, `buffer_atomic_fcmpswap` | all four |
105| `ds_add_f32`, `ds_add_rtn_f32` | both |
106| `image_atomic_{swap,inc,dec,fmin,fmax,fcmpswap}` | all six |
107| Scalar select and pack | `s_cmov_b32` (program code), `s_cmovk_i32`, `s_cmov_b64`, `s_pack_ll/lh/hh_b32_b16` |
108| Vector integer additions | `v_mul_hi_u32_u24`, `v_mul_hi_i32_i24`, `v_lshrrev_b64`, `v_ashrrev_i64`, `v_qsad_pk_u16_u8`, `v_mqsad_pk_u16_u8` |
109| `v_div_fixup_f16`, `v_div_fixup_f64` | both |
110| `v_frexp_mant_f16`, `v_frexp_exp_i16_f16`, `v_ldexp_f16` | all three |
111| `v_frexp_mant_f64`, `v_frexp_exp_i32_f64` | both |
112| `v_cvt_pknorm_i16_f32`, `v_cvt_pknorm_u16_f32` | both |
113| `v_cvt_pknorm_i16_f16`, `v_cvt_pknorm_u16_f16` ("not run on the shader corpus") | both |
114| `v_cmp_class_f16`/`_f64` and the `v_cmpx` forms ("and the shader corpus") | all four |
115| `buffer_atomic_{and,or,xor,swap}_x2` | all four |
116| `v_dot2c_i32_i16`, `v_dot8c_i32_i4` | both |
117
118**These the game does reach**, so their unmeasured parts still matter. Shaders, then instructions in brackets:
119
120| `docs/design.md` row | instruction: shaders (instructions), by stage |
121|---|---|
122| 16-bit interpolation | `v_interp_p1ll_f16` and `v_interp_p2_f16`: 4,776 PS (59,367 each) |
123| `v_interp_mov_f32` p10 / p20 | 3,673 PS (6,926) |
124| `v_cvt_f16_f32` output modifiers | `v_cvt_f16_f32`: 6,306 (44,496): 4,490 MS, 926 CS, 580 PS, 310 VS; the count is the instruction, not its modifiers |
125| Known approximations (`v_fma_mix*` rounding twice; `v_cos/exp/log_f16`) | `v_fma_mix_f32` 9,620 (487,658), `v_fma_mixlo_f16` 6,155 (33,900), `v_fma_mixhi_f16` 842 (2,135); `v_exp_f16` 3 CS (12), `v_cos_f16` 1 CS (2), `v_log_f16` 0 |
126| `v_cndmask_b32` source modifiers | `v_cndmask_b32`: 22,553 (1,490,241); the count is the instruction, not its modifiers |
127| Image atomics, size and LOD queries | `image_get_resinfo` 407 (1,148: 381 PS, 26 CS), `image_get_lod` 653 PS (718) |
128| Ray tracing (gfx1013 not measured) | `image_bvh_intersect_ray` 40 CS (638), `image_bvh64_intersect_ray` 24 CS (78) |
129| `s_bfe_u32` / `s_bfe_i32` past bit 31 | `s_bfe_u32` 15,398 (90,156), `s_bfe_i32` 2,847 (6,040); whether an operand passes bit 31 is not counted |
130
131A row's unmeasured part can be narrower than its instruction: a modifier, an operand range, an inactive lane or
132a special value. Where the count is the instruction alone, the table says so, and the count is an upper bound for
133that part. `tests/test_op_reach.py` checks the tool on hand-written listings.