tooling: disasm_rdna2 misspells or leaves unnamed several gfx1013 instructions, so the shader scan misreports them #931

Closed
opened 2026-11-23 17:57:32 +00:00 by MasterDomino · 23 comments
MasterDomino commented 2026-11-23 17:57:32 +00:00 (Migrated from github.com)
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by MasterDomino on 2026-11-23T17:57:32Z.


Problem

tools/disasm_rdna2.py prints several gfx1013 instructions differently from LLVM 15 or leaves them unnamed, and it stops decoding at the first s_endpgm. tools/scan_unsupported_shaders.py decodes binaries with it and then checks the lines with pixel_aot.lower(), whose patterns follow LLVM's spelling. So the scan reports instructions the translator does accept as unsupported, and it undercounts the others.

Reproduction with a source-built input only, at a8a88e1. Assemble with LLVM 15.0.7 (llvm-mc -arch=amdgcn -mcpu=gfx1013 -filetype=obj, then llvm-objcopy -O binary --only-section=.text):

s_setreg_imm32_b32 hwreg(HW_REG_MODE, 2, 2), 3
s_setreg_imm32_b32 hwreg(HW_REG_FLAT_SCR_LO), 0
v_interp_p1ll_f16 v1, v2, attr0.x
v_interp_p2_f16 v1, v2, attr0.x, v3
v_cmp_gt_u32_sdwa vcc_lo, v1, v2 src0_sel:WORD_1 src1_sel:DWORD
image_atomic_umax v1, v2, s[0:7] dmask:0x1 dim:SQ_RSRC_IMG_1D glc
v_add_co_ci_u32_e32 v1, vcc_lo, v2, v3, vcc_lo
s_endpgm
v_mov_b32_e32 v1, v2

Then decode the 60 bytes with disasm_rdna2.disasm_rdna2(data) and with pixel_aot.disassemble(data, libLLVM-15.so):

disasm_rdna2 LLVM 15
s_setreg_imm32_b32 0x881, 0x3 s_setreg_imm32_b32 hwreg(HW_REG_MODE, 2, 2), 3
s_setreg_imm32_b32 0xf814, 0x0 s_setreg_imm32_b32 hwreg(HW_REG_FLAT_SCR_LO), 0
v_vop3_342 v1, s0, v2, s0 v_interp_p1ll_f16 v1, v2, attr0.x
v_vop3_35a v1, s0, v2, v3 v_interp_p2_f16 v1, v2, attr0.x, v3
v_cmp_gt_u32_e32 <unsupported SDWA> v_cmp_gt_u32_sdwa vcc_lo, v1, v2 src0_sel:WORD_1 src1_sel:DWORD
image_mimg_17 v1, v2, s[0:7] dmask:0x1 dim:SQ_RSRC_IMG_1D glc image_atomic_umax v1, v2, s[0:7] dmask:0x1 dim:SQ_RSRC_IMG_1D glc
v_vop2_28 v1, v2, v3 v_add_co_ci_u32_e32 v1, vcc_lo, v2, v3, vcc_lo
s_endpgm s_endpgm
(stops) v_mov_b32_e32 v1, v2

Effect on the translator check. pixel_aot.lower() accepts s_setreg_imm32_b32 hwreg(HW_REG_MODE, 2, 2), 3 and s_setreg_imm32_b32 hwreg(HW_REG_FLAT_SCR_LO), 0, both handled since the MODE rounding and FLAT_SCRATCH work. It rejects the decoder's spellings s_setreg_imm32_b32 0x881, 0x3 and s_setreg_imm32_b32 0xf814, 0x0 with Unsupported instruction. Checked by inserting each line at the start of the tests/pixel_aot_check.py assembly(False) program and calling translate().

Size on one local input, the 12,101 PS records counted in #711 and #932. Only aggregates. A scan with tools/scan_unsupported_shaders.py reports Unsupported instruction: s_setreg_imm32_b32 as the first rejection in 2,249 records. All s_setreg in that input are the MODE[3:2] and FLAT_SCR_LO/HI forms above, which the translator handles in LLVM spelling. On a random sample of 300 records decoded over the same byte ranges, the mnemonic sequences differ from LLVM 15 in 132. The most frequent differences are the v_interp_p1ll_f16/v_interp_p2_f16 pair (1,151 each), SDWA compares printed as _e32, image_atomic_umax and v_add_co_ci_u32_e32.

#745 and #746 fixed other spellings in the same decoder. This is the same class of problem.

Proposal

Make the decoder's output match LLVM 15 for these cases, one reviewable step at a time:

  1. Print the hwreg(...) operand of s_setreg_imm32_b32 in LLVM's symbolic form, and check s_setreg_b32/s_getreg_b32, which I didn't test.
  2. Name v_interp_p1ll_f16 and v_interp_p2_f16 with LLVM's operand syntax, and check v_interp_p1lv_f16, which I didn't test.
  3. Name v_add_co_ci_u32_e32 with its implicit vcc_lo operands, name image_atomic_umax, and decode SDWA VOPC. The neighbouring carry and atomic forms are likely affected too, but I didn't test them.
  4. Decide whether decoding continues after s_endpgm, or whether the scanner should use the _bounded_code section bounds that pixel_aot uses.

Each step gets a fixture in tests/rdna2_tools_check.py that compares disasm_rdna2 with the LLVM 15 comparison test it already has (LLVM_LIB). I could take step 1 first, since it changes the scan result the most.

Alternatives

  • Have the scanner use LLVM (pixel_aot.disassemble) when --llvm is given, and keep the Python decoder as a fallback. This fixes the scan without touching the decoder. The decoder would still be wrong for other users, though.
  • Translate decoder spellings inside the scanner. That's brittle, and it hides the decoder bug.

Verification

tests/rdna2_tools_check.py with LLVM_LIB, LLVM_MC and LLVM_OBJCOPY set. A new case assembles the program above and requires identical text from both decoders. The negative control is that the current decoder fails it. This runs on Linux; no Windows or GPU is needed.

  • I checked for an existing issue or pull request for this change.
  • I did not include game files, dumps, distribution links or credentials.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6565534909 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/938). Originally posted by [MasterDomino](https://github.com/MasterDomino) on 2026-11-23T17:57:32Z. --- ### Problem `tools/disasm_rdna2.py` prints several gfx1013 instructions differently from LLVM 15 or leaves them unnamed, and it stops decoding at the first `s_endpgm`. `tools/scan_unsupported_shaders.py` decodes binaries with it and then checks the lines with `pixel_aot.lower()`, whose patterns follow LLVM's spelling. So the scan reports instructions the translator does accept as unsupported, and it undercounts the others. **Reproduction with a source-built input only, at `a8a88e1`.** Assemble with LLVM 15.0.7 (`llvm-mc -arch=amdgcn -mcpu=gfx1013 -filetype=obj`, then `llvm-objcopy -O binary --only-section=.text`): ``` s_setreg_imm32_b32 hwreg(HW_REG_MODE, 2, 2), 3 s_setreg_imm32_b32 hwreg(HW_REG_FLAT_SCR_LO), 0 v_interp_p1ll_f16 v1, v2, attr0.x v_interp_p2_f16 v1, v2, attr0.x, v3 v_cmp_gt_u32_sdwa vcc_lo, v1, v2 src0_sel:WORD_1 src1_sel:DWORD image_atomic_umax v1, v2, s[0:7] dmask:0x1 dim:SQ_RSRC_IMG_1D glc v_add_co_ci_u32_e32 v1, vcc_lo, v2, v3, vcc_lo s_endpgm v_mov_b32_e32 v1, v2 ``` Then decode the 60 bytes with `disasm_rdna2.disasm_rdna2(data)` and with `pixel_aot.disassemble(data, libLLVM-15.so)`: | `disasm_rdna2` | LLVM 15 | |---|---| | `s_setreg_imm32_b32 0x881, 0x3` | `s_setreg_imm32_b32 hwreg(HW_REG_MODE, 2, 2), 3` | | `s_setreg_imm32_b32 0xf814, 0x0` | `s_setreg_imm32_b32 hwreg(HW_REG_FLAT_SCR_LO), 0` | | `v_vop3_342 v1, s0, v2, s0` | `v_interp_p1ll_f16 v1, v2, attr0.x` | | `v_vop3_35a v1, s0, v2, v3` | `v_interp_p2_f16 v1, v2, attr0.x, v3` | | `v_cmp_gt_u32_e32 <unsupported SDWA>` | `v_cmp_gt_u32_sdwa vcc_lo, v1, v2 src0_sel:WORD_1 src1_sel:DWORD` | | `image_mimg_17 v1, v2, s[0:7] dmask:0x1 dim:SQ_RSRC_IMG_1D glc` | `image_atomic_umax v1, v2, s[0:7] dmask:0x1 dim:SQ_RSRC_IMG_1D glc` | | `v_vop2_28 v1, v2, v3` | `v_add_co_ci_u32_e32 v1, vcc_lo, v2, v3, vcc_lo` | | `s_endpgm` | `s_endpgm` | | (stops) | `v_mov_b32_e32 v1, v2` | **Effect on the translator check.** `pixel_aot.lower()` accepts `s_setreg_imm32_b32 hwreg(HW_REG_MODE, 2, 2), 3` and `s_setreg_imm32_b32 hwreg(HW_REG_FLAT_SCR_LO), 0`, both handled since the MODE rounding and FLAT_SCRATCH work. It rejects the decoder's spellings `s_setreg_imm32_b32 0x881, 0x3` and `s_setreg_imm32_b32 0xf814, 0x0` with `Unsupported instruction`. Checked by inserting each line at the start of the `tests/pixel_aot_check.py` `assembly(False)` program and calling `translate()`. **Size on one local input**, the 12,101 PS records counted in #711 and #932. Only aggregates. A scan with `tools/scan_unsupported_shaders.py` reports `Unsupported instruction: s_setreg_imm32_b32` as the first rejection in 2,249 records. All `s_setreg` in that input are the MODE[3:2] and FLAT_SCR_LO/HI forms above, which the translator handles in LLVM spelling. On a random sample of 300 records decoded over the same byte ranges, the mnemonic sequences differ from LLVM 15 in 132. The most frequent differences are the `v_interp_p1ll_f16`/`v_interp_p2_f16` pair (1,151 each), SDWA compares printed as `_e32`, `image_atomic_umax` and `v_add_co_ci_u32_e32`. #745 and #746 fixed other spellings in the same decoder. This is the same class of problem. ### Proposal Make the decoder's output match LLVM 15 for these cases, one reviewable step at a time: 1. Print the `hwreg(...)` operand of `s_setreg_imm32_b32` in LLVM's symbolic form, and check `s_setreg_b32`/`s_getreg_b32`, which I didn't test. 2. Name `v_interp_p1ll_f16` and `v_interp_p2_f16` with LLVM's operand syntax, and check `v_interp_p1lv_f16`, which I didn't test. 3. Name `v_add_co_ci_u32_e32` with its implicit `vcc_lo` operands, name `image_atomic_umax`, and decode SDWA VOPC. The neighbouring carry and atomic forms are likely affected too, but I didn't test them. 4. Decide whether decoding continues after `s_endpgm`, or whether the scanner should use the `_bounded_code` section bounds that `pixel_aot` uses. Each step gets a fixture in `tests/rdna2_tools_check.py` that compares `disasm_rdna2` with the LLVM 15 comparison test it already has (`LLVM_LIB`). I could take step 1 first, since it changes the scan result the most. ### Alternatives - Have the scanner use LLVM (`pixel_aot.disassemble`) when `--llvm` is given, and keep the Python decoder as a fallback. This fixes the scan without touching the decoder. The decoder would still be wrong for other users, though. - Translate decoder spellings inside the scanner. That's brittle, and it hides the decoder bug. ### Verification `tests/rdna2_tools_check.py` with `LLVM_LIB`, `LLVM_MC` and `LLVM_OBJCOPY` set. A new case assembles the program above and requires identical text from both decoders. The negative control is that the current decoder fails it. This runs on Linux; no Windows or GPU is needed. - [x] I checked for an existing issue or pull request for this change. - [x] I did not include game files, dumps, distribution links or credentials. AI-assisted.
R0Y00 commented 2026-11-24 06:49:27 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-23T18:22:28Z.


A focused first PR for symbolic HWREG spelling would be useful. Preserve the numeric fallback for unknown operands and the existing s_endpgm behavior. Please use LLVM 15 round-trips that distinguish the register, offset, and width, and include a source-built scan case that fails with the old spelling. Bounded decoding and changes to instruction boundaries can be reviewed separately.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7110071352 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/938#issuecomment-7110071352). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-23T18:22:28Z. --- A focused first PR for symbolic HWREG spelling would be useful. Preserve the numeric fallback for unknown operands and the existing s_endpgm behavior. Please use LLVM 15 round-trips that distinguish the register, offset, and width, and include a source-built scan case that fails with the old spelling. Bounded decoding and changes to instruction boundaries can be reviewed separately.
Batushn commented 2026-11-24 06:49:29 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by Batushn on 2026-11-23T18:33:54Z.


Claiming step 1 (symbolic hwreg(...) spelling in tools/disasm_rdna2.py for s_setreg_imm32_b32, s_setreg_b32, and s_getreg_b32, preserving numeric fallback for unknown/non-gfx1013 register IDs and existing s_endpgm behavior, plus LLVM 15 round-trips and a source-built binary scan test in tests/rdna2_tools_check.py). Developing on Windows 11, Python 3.12.10; LLVM 15 round-trips will be exercised by the Ubuntu CI job.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7110341625 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/938#issuecomment-7110341625). Originally posted by [Batushn](https://github.com/Batushn) on 2026-11-23T18:33:54Z. --- Claiming step 1 (symbolic `hwreg(...)` spelling in `tools/disasm_rdna2.py` for `s_setreg_imm32_b32`, `s_setreg_b32`, and `s_getreg_b32`, preserving numeric fallback for unknown/non-gfx1013 register IDs and existing `s_endpgm` behavior, plus LLVM 15 round-trips and a source-built binary scan test in `tests/rdna2_tools_check.py`). Developing on Windows 11, Python 3.12.10; LLVM 15 round-trips will be exercised by the Ubuntu CI job.
R0Y00 commented 2026-11-24 06:49:29 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-23T18:44:47Z.


#951 and #956 implement the same HWREG formatter and SOPK decode. I have independently checked #951 against LLVM 15.0.7, including all 64 hardware-register IDs, and will use it as the first merge candidate. @Batushn, thanks for the independent encoding and stream-boundary tests. Please retain the useful differences for a small follow-up after #951, especially any truncated second-dword or end-of-program boundary control not already covered. If you keep the scanner's known-opcode update, please show that recognition remains separate from translation support for s_getreg_b32 and s_setreg_b32.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7110593629 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/938#issuecomment-7110593629). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-23T18:44:47Z. --- #951 and #956 implement the same HWREG formatter and SOPK decode. I have independently checked #951 against LLVM 15.0.7, including all 64 hardware-register IDs, and will use it as the first merge candidate. @Batushn, thanks for the independent encoding and stream-boundary tests. Please retain the useful differences for a small follow-up after #951, especially any truncated second-dword or end-of-program boundary control not already covered. If you keep the scanner's known-opcode update, please show that recognition remains separate from translation support for s_getreg_b32 and s_setreg_b32.
MasterDomino commented 2026-11-24 06:49:31 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by MasterDomino on 2026-11-23T19:06:21Z.


Taking step 2 now, scoped to the 16-bit interpolation names only: disasm_rdna2 decodes v_interp_p1ll_f16, v_interp_p1lv_f16 and v_interp_p2_f16 (VOP3 opcodes 0x342, 0x343 and 0x35a) as LLVM 15 prints them, with LLVM 15 round trips and a source-built scan case. This leaves alone the instruction-boundary and s_endpgm follow-up from #951/#956, and the SDWA VOPC, image_atomic_* and v_add_co_ci_u32 names (step 3).

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7111099991 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/938#issuecomment-7111099991). Originally posted by [MasterDomino](https://github.com/MasterDomino) on 2026-11-23T19:06:21Z. --- Taking step 2 now, scoped to the 16-bit interpolation names only: `disasm_rdna2` decodes `v_interp_p1ll_f16`, `v_interp_p1lv_f16` and `v_interp_p2_f16` (VOP3 opcodes 0x342, 0x343 and 0x35a) as LLVM 15 prints them, with LLVM 15 round trips and a source-built scan case. This leaves alone the instruction-boundary and `s_endpgm` follow-up from #951/#956, and the SDWA VOPC, `image_atomic_*` and `v_add_co_ci_u32` names (step 3). AI-assisted.
MasterDomino commented 2026-11-24 06:49:31 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by MasterDomino on 2026-11-23T19:16:01Z.


Step 2 is up as #970: v_interp_p1ll_f16, v_interp_p1lv_f16 and v_interp_p2_f16 decode as LLVM 15 prints them. Encodings LLVM 15 refuses are reported as unsupported. It includes LLVM 15 round trips that differ in one field per line and a source-built scan case that fails with the old v_vop3_342 spelling. A local sweep of 77,920 encodings against LLVMDisasmInstruction found no differences. It doesn't touch the boundary work in #956.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7111343175 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/938#issuecomment-7111343175). Originally posted by [MasterDomino](https://github.com/MasterDomino) on 2026-11-23T19:16:01Z. --- Step 2 is up as #970: `v_interp_p1ll_f16`, `v_interp_p1lv_f16` and `v_interp_p2_f16` decode as LLVM 15 prints them. Encodings LLVM 15 refuses are reported as unsupported. It includes LLVM 15 round trips that differ in one field per line and a source-built scan case that fails with the old `v_vop3_342` spelling. A local sweep of 77,920 encodings against `LLVMDisasmInstruction` found no differences. It doesn't touch the boundary work in #956. AI-assisted.
MasterDomino commented 2026-11-24 06:49:33 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by MasterDomino on 2026-11-23T19:38:49Z.


Taking step 3 now, as three small PRs in this order so each stays reviewable:

  1. The VOP2 carry-in forms v_add_co_ci_u32_e32, v_sub_co_ci_u32_e32 and v_subrev_co_ci_u32_e32 (today v_vop2_28/29/2a without the implicit vcc_lo operands).
  2. The MIMG atomics (image_atomic_*, 16 forms in docs/coverage/gfx1013.tsv; today image_mimg_NN).
  3. SDWA VOPC (124 forms; today <unsupported SDWA>).

Each will come with an LLVM 15 sweep, round trips and a source-built scan case, as for #951 and #970. Step 4 (decoding past s_endpgm) is not included.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7111899005 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/938#issuecomment-7111899005). Originally posted by [MasterDomino](https://github.com/MasterDomino) on 2026-11-23T19:38:49Z. --- Taking step 3 now, as three small PRs in this order so each stays reviewable: 1. The VOP2 carry-in forms `v_add_co_ci_u32_e32`, `v_sub_co_ci_u32_e32` and `v_subrev_co_ci_u32_e32` (today `v_vop2_28`/`29`/`2a` without the implicit `vcc_lo` operands). 2. The MIMG atomics (`image_atomic_*`, 16 forms in `docs/coverage/gfx1013.tsv`; today `image_mimg_NN`). 3. SDWA VOPC (124 forms; today `<unsupported SDWA>`). Each will come with an LLVM 15 sweep, round trips and a source-built scan case, as for #951 and #970. Step 4 (decoding past `s_endpgm`) is not included. AI-assisted.
Batushn commented 2026-11-24 06:49:34 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by Batushn on 2026-11-23T19:42:05Z.


Heads-up to avoid duplicate work on step 3: #977 (VOP2 carry-in ops \ _add_co_ci_u32_e32\ / \ _sub_co_ci_u32_e32\ / \ subrev_co_ci_u32_e32\ plus all 16 GFX10 MIMG \image_atomic*\ ops, conflict against #970 resolved) and #980 (all 124 GFX10 VOPC/VOPCX SDWA forms, LLVM 15 round-trip CI green) are both open with LLVM 15 round-trip and binary scanner tests. Step 4 (decoding past \s_endpgm) is untouched.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7111975727 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/938#issuecomment-7111975727). Originally posted by [Batushn](https://github.com/Batushn) on 2026-11-23T19:42:05Z. --- Heads-up to avoid duplicate work on step 3: #977 (VOP2 carry-in ops \ _add_co_ci_u32_e32\ / \ _sub_co_ci_u32_e32\ / \ _subrev_co_ci_u32_e32\ plus all 16 GFX10 MIMG \image_atomic_*\ ops, conflict against #970 resolved) and #980 (all 124 GFX10 VOPC/VOPCX SDWA forms, LLVM 15 round-trip CI green) are both open with LLVM 15 round-trip and binary scanner tests. Step 4 (decoding past \s_endpgm\) is untouched.
R0Y00 commented 2026-11-24 06:49:34 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-23T19:45:20Z.


#977 and #980 already cover the three step-3 decode slices and are in review. @MasterDomino, please hold off on duplicate implementations. An independent LLVM 15 sweep of those candidates is useful, especially for rejected modifier and source encodings, the record length after a refusal, and recognized-versus-translated classification. Please attach any deltas to the relevant PR. The post-s_endpgm boundary work is separate.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7112056924 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/938#issuecomment-7112056924). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-23T19:45:20Z. --- #977 and #980 already cover the three step-3 decode slices and are in review. @MasterDomino, please hold off on duplicate implementations. An independent LLVM 15 sweep of those candidates is useful, especially for rejected modifier and source encodings, the record length after a refusal, and recognized-versus-translated classification. Please attach any deltas to the relevant PR. The post-`s_endpgm` boundary work is separate.
MasterDomino commented 2026-11-24 06:49:34 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by MasterDomino on 2026-11-23T19:51:02Z.


Understood, holding off. My step-3 claim overlapped #977, which was already open; that's on me for not checking open PRs first. Sorry, @Batushn.

To avoid more parallel work on this decoder, I suggest one person owns what's left of #938 (step 4 and any further spelling fixes), and the other stays out of disasm_rdna2.py unless asked. @R0Y00, your call on who. Batushn already has #977 and #980 in review, so they're the obvious choice, and I'm happy to step back to review.

If it helps meanwhile, I can run the independent LLVM 15 sweep you described against #977 and #980 (refused modifier and source encodings, record length after a refusal, recognized versus translated classification) and attach any deltas to those PRs.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7112193080 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/938#issuecomment-7112193080). Originally posted by [MasterDomino](https://github.com/MasterDomino) on 2026-11-23T19:51:02Z. --- Understood, holding off. My step-3 claim overlapped #977, which was already open; that's on me for not checking open PRs first. Sorry, @Batushn. To avoid more parallel work on this decoder, I suggest one person owns what's left of #938 (step 4 and any further spelling fixes), and the other stays out of `disasm_rdna2.py` unless asked. @R0Y00, your call on who. Batushn already has #977 and #980 in review, so they're the obvious choice, and I'm happy to step back to review. If it helps meanwhile, I can run the independent LLVM 15 sweep you described against #977 and #980 (refused modifier and source encodings, record length after a refusal, recognized versus translated classification) and attach any deltas to those PRs. AI-assisted.
R0Y00 commented 2026-11-24 06:49:36 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-23T20:01:42Z.


Thanks for coordinating. #977 has landed. Please run the independent LLVM 15 sweep of #980, with refused encodings, next-record offsets, and scanner classifications as discussed. @Batushn can pick up the post-s_endpgm boundary slice if interested. Please align on that slice here before starting it.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7112450029 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/938#issuecomment-7112450029). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-23T20:01:42Z. --- Thanks for coordinating. #977 has landed. Please run the independent LLVM 15 sweep of #980, with refused encodings, next-record offsets, and scanner classifications as discussed. @Batushn can pick up the post-`s_endpgm` boundary slice if interested. Please align on that slice here before starting it.
MasterDomino commented 2026-11-24 06:49:41 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by MasterDomino on 2026-11-23T21:17:29Z.


Running the independent LLVM 15 sweep of #980 now that it has merged: refused modifier and source encodings, next-record offsets after a refusal, and recognized-versus-translated scanner classification. I will post any deltas here. Not touching the post-s_endpgm slice.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7114261902 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/938#issuecomment-7114261902). Originally posted by [MasterDomino](https://github.com/MasterDomino) on 2026-11-23T21:17:29Z. --- Running the independent LLVM 15 sweep of #980 now that it has merged: refused modifier and source encodings, next-record offsets after a refusal, and recognized-versus-translated scanner classification. I will post any deltas here. Not touching the post-`s_endpgm` slice. AI-assisted.
MasterDomino commented 2026-11-24 06:49:43 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by MasterDomino on 2026-11-23T21:36:33Z.


Independent LLVM 15 sweep of the #980 VOPC/VOPCX SDWA decoder. This was a measurement only. I did not change tools/disasm_rdna2.py.

Setup

  • Commit: ca52bbc1c01687c11ee9796e853249c6541ff43f (upstream main, which contains the #980 merge b92dc80).

  • Reference: the Windows release build of LLVM 15.0.7, C:\Program Files\LLVM\bin\LLVM-C.dll, called through pixel_aot.disassemble with triple amdgcn--amdpal, CPU gfx1013 and no features (LLVM's wave32 default).

  • Environment: Windows 11, Python 3.13.1.

  • Encodings: every record is built from the VOP_SDWA9Be field layout. No bytes are written by hand. The sweep covers all 256 VOPC opcodes, crossed with:

    • every selector pair, including the reserved value 7;
    • all 256 combinations of the eight modifier and reserved bits (sext/neg/abs and bits 22 and 30);
    • every scalar source code on src0 and src1, both plain and under neg, abs, neg+abs and sext;
    • sample VGPRs;
    • every sdst value with sd set and with sd clear;
    • 256 seeded random word-1 values per opcode.

    That gives 869,888 distinct 8-byte records. Each record is followed by v_mov_b32_e32 v3, v4 and s_endpgm (0403067e000081bf, checked against LLVM) so the next-record offset can be checked.

  • Command (from a checkout at that commit): python -B out/reports/938-sweep/sweep_980.py --repo . --llvm-lib "C:\Program Files\LLVM\bin\LLVM-C.dll". It takes 82 s with 8 worker processes.

Results

LLVM 15 disasm_rdna2 Records
decodes decodes, same text 200,243
refuses refuses 636,138
faults (selector 7) refuses 372
decodes decodes, different text 13,006
refuses decodes 20,129
decodes refuses 0
  • LLVM decodes 213,249 records, all of them 8 bytes long. They use exactly the 124 mnemonics listed in docs/coverage/gfx1013.tsv.
  • The decoder refuses 636,510 records:
    • 448,536 because the opcode is 64-bit or unknown;
    • 167,748 because a modifier is not allowed for the operand type;
    • 15,873 because a VOPCX record has sd set;
    • 3,981 because a scalar source code is 249, 250 or 255;
    • 372 because of selector 7.
  • Next-record offsets: every record is reported as 8 bytes, whether the decoder decodes or refuses it, and the sentinel decodes at offset 8. LLVM agrees for all 213,249 records it decodes.
  • Truncation: I tried a 4-byte SDWA prefix followed by 0 to 3 bytes at the end of the stream (1,024 cases). LLVM refuses all of them. The decoder reports vopc_truncated (4 bytes) and the leftover bytes as data. No deltas.

Deltas

All 33,135 delta records come from one of three causes.

  1. Scalar source codes 209 to 234. LLVM refuses these records and the decoder prints s209 to s234. This affects 20,129 records across all 124 opcodes: 10,171 on src0, 9,954 on src1 and 4 on both. For example, LLVM refuses f904007cd1008606 but the decoder prints v_cmp_f_f32_sdwa vcc_lo, s209, v2 src0_sel:DWORD src1_sel:DWORD. The SDWA scalar-operand check refuses only 249, 250 and 255, and decode_s_reg falls back to s{n} for 209 to 234.

  2. neg without abs on an inline constant. This affects 12,131 records across 68 float compare mnemonics, including v_cmp[x]_class_*. LLVM prints neg(c). The decoder prints -c, or --c when the constant is negative (2,703 records).

    • With an integer constant (10,917 records), the decoder's text names a different operand. For f924027c81009606, LLVM prints v_cmp_lt_f32_sdwa vcc_lo, neg(1), v18 src0_sel:DWORD src1_sel:DWORD, which is operand 0x80000001. The decoder prints ... -1, v18 .... That is the same text LLVM prints for f924027cc1008606, which encodes the inline constant -1 (operand 0xffffffff). Reassembling also shows the modifier is lost: llvm-mc turns LLVM's neg(0) text for f904007c80009606 back into those bytes, but turns the decoder's -0 text into f904007c80008606, without the neg bit.
    • With float constants only (1,214 records), the value is the same and only the spelling differs: neg(0.5) against -0.5, and neg(-0.5) against --0.5.
  3. Float inline constants (codes 240 to 248) on the 24 v_cmp[x]_{eq,ne,lt,le,gt,ge}_{i16,u16}_sdwa forms. This affects 875 records. LLVM prints the f16 bit pattern and the decoder prints the float. For f904127df0008606, LLVM prints v_cmp_lt_i16_sdwa vcc_lo, 0x3800, v2 ... and the decoder prints ... 0.5, v2 .... A round trip does not settle which spelling is right. LLVM 15.0.7 llvm-mc (-triple=amdgcn--amdpal -mcpu=gfx1013 -mattr=+wavefrontsize32) rejects both texts with invalid operand for instruction on all 875 records, so LLVM's own disassembly of these encodings does not reassemble either. I am reporting this as a spelling difference whose meaning is unconfirmed, not as a wrong value.

Scanner classification

These checks use scan_unsupported_shaders.py with the decoder's text as input.

  • Every record on which both decoders agree is a recognized opcode.
  • Canonical sources: I took src0 = s44 and src1 = v18, with 5 to 8 variants per opcode, giving 812 encodings that both decoders decode the same way. For all 812, the per-line is_instruction_supported verdict matches pixel_aot.lower run on a known-good program (with_constants, constant_descriptor=64). 96 are supported and lowered (the 16 v_cmp_*_f32_sdwa forms with DWORD selectors). The other 716 are neither.
  • Delta 1: 3,329 distinct decoder texts containing s209 to s234 pass the per-line check. lower rejects all of them (KeyError), so only the per-line supported count is affected.
  • Delta 2: 2,880 records with DWORD selectors (2,592 of them with integer constants) produce decoder text that passes the per-line check and that lower accepts. For f924027c81009606, lower therefore accepts an operand of -1 where the encoding means neg(1). LLVM's neg(c) spelling passes the per-line regex, but lower rejects it.
  • Refused records keep their e32 mnemonic, for example v_cmp_f_f32_e32 <unsupported SDWA>. is_opcode_recognized accepts these through its v_cmp_ prefix rule. A shader that contains one is classified opcode_recognized_translator_rejected, the same as a valid SDWA compare that is not translated. Of the 636,510 refused records, 412,242 are recognized this way. The other 224,268 are unrecognized: these are opcodes without a VOPC_OPS entry, printed as v_vopc_NN <unsupported SDWA>. #980 did not change this behaviour. I note it because the issue asks about recognized versus translated.

Negative controls

Each control patches the decoder in memory and compares it against the same LLVM results. The decoder is restored and re-checked afterwards.

  • Renaming VOPC_OPS[0x01] to v_cmp_le_f32_e32 gives 2,081 new text deltas, all on opcode 0x01. That is every LLVM-decoded 0x01 record that had no delta before.
  • Swapping WORD_0 and WORD_1 in SDWA_SEL_NAMES gives 4,569 new deltas, all on records with a WORD selector. That is every such record that had no delta before.
  • Reporting refused records as 4 bytes gives 636,138 next-record-offset deltas, all on refused records.

Limits

  • The sweep is not exhaustive. There are 2^48 field combinations. The families above cover each field fully on its own, but cover combinations of fields only through the random samples.
  • Selector 7: once the opcode is valid, LLVM 15.0.7 faults with an access violation inside LLVMDisasmInstruction. The #980 test notes that printSDWASel reaches llvm_unreachable. There is no reference text for these 372 records. The decoder refuses all 768 selector-7 records.
  • Only wave32 was tested. The wave64 spellings (vcc, SGPR pairs) were not.
  • The translator check uses one known-good program. It shows lower's verdict, not that the generated HLSL is correct.
  • The sweep script is local (out/ is gitignored). I can share it if that is useful.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7114685534 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/938#issuecomment-7114685534). Originally posted by [MasterDomino](https://github.com/MasterDomino) on 2026-11-23T21:36:33Z. --- Independent LLVM 15 sweep of the #980 VOPC/VOPCX SDWA decoder. This was a measurement only. I did not change `tools/disasm_rdna2.py`. **Setup** - Commit: `ca52bbc1c01687c11ee9796e853249c6541ff43f` (upstream `main`, which contains the #980 merge `b92dc80`). - Reference: the Windows release build of LLVM 15.0.7, `C:\Program Files\LLVM\bin\LLVM-C.dll`, called through `pixel_aot.disassemble` with triple `amdgcn--amdpal`, CPU `gfx1013` and no features (LLVM's wave32 default). - Environment: Windows 11, Python 3.13.1. - Encodings: every record is built from the VOP_SDWA9Be field layout. No bytes are written by hand. The sweep covers all 256 VOPC opcodes, crossed with: - every selector pair, including the reserved value 7; - all 256 combinations of the eight modifier and reserved bits (sext/neg/abs and bits 22 and 30); - every scalar source code on src0 and src1, both plain and under neg, abs, neg+abs and sext; - sample VGPRs; - every `sdst` value with `sd` set and with `sd` clear; - 256 seeded random word-1 values per opcode. That gives 869,888 distinct 8-byte records. Each record is followed by `v_mov_b32_e32 v3, v4` and `s_endpgm` (`0403067e000081bf`, checked against LLVM) so the next-record offset can be checked. - Command (from a checkout at that commit): `python -B out/reports/938-sweep/sweep_980.py --repo . --llvm-lib "C:\Program Files\LLVM\bin\LLVM-C.dll"`. It takes 82 s with 8 worker processes. **Results** | LLVM 15 | `disasm_rdna2` | Records | |---|---|---:| | decodes | decodes, same text | 200,243 | | refuses | refuses | 636,138 | | faults (selector 7) | refuses | 372 | | decodes | decodes, different text | 13,006 | | refuses | decodes | 20,129 | | decodes | refuses | 0 | - LLVM decodes 213,249 records, all of them 8 bytes long. They use exactly the 124 mnemonics listed in `docs/coverage/gfx1013.tsv`. - The decoder refuses 636,510 records: - 448,536 because the opcode is 64-bit or unknown; - 167,748 because a modifier is not allowed for the operand type; - 15,873 because a VOPCX record has `sd` set; - 3,981 because a scalar source code is 249, 250 or 255; - 372 because of selector 7. - Next-record offsets: every record is reported as 8 bytes, whether the decoder decodes or refuses it, and the sentinel decodes at offset 8. LLVM agrees for all 213,249 records it decodes. - Truncation: I tried a 4-byte SDWA prefix followed by 0 to 3 bytes at the end of the stream (1,024 cases). LLVM refuses all of them. The decoder reports `vopc_truncated` (4 bytes) and the leftover bytes as data. No deltas. **Deltas** All 33,135 delta records come from one of three causes. 1. **Scalar source codes 209 to 234.** LLVM refuses these records and the decoder prints `s209` to `s234`. This affects 20,129 records across all 124 opcodes: 10,171 on src0, 9,954 on src1 and 4 on both. For example, LLVM refuses `f904007cd1008606` but the decoder prints `v_cmp_f_f32_sdwa vcc_lo, s209, v2 src0_sel:DWORD src1_sel:DWORD`. The SDWA scalar-operand check refuses only 249, 250 and 255, and `decode_s_reg` falls back to `s{n}` for 209 to 234. 2. **neg without abs on an inline constant.** This affects 12,131 records across 68 float compare mnemonics, including `v_cmp[x]_class_*`. LLVM prints `neg(c)`. The decoder prints `-c`, or `--c` when the constant is negative (2,703 records). - With an integer constant (10,917 records), the decoder's text names a different operand. For `f924027c81009606`, LLVM prints `v_cmp_lt_f32_sdwa vcc_lo, neg(1), v18 src0_sel:DWORD src1_sel:DWORD`, which is operand 0x80000001. The decoder prints `... -1, v18 ...`. That is the same text LLVM prints for `f924027cc1008606`, which encodes the inline constant -1 (operand 0xffffffff). Reassembling also shows the modifier is lost: `llvm-mc` turns LLVM's `neg(0)` text for `f904007c80009606` back into those bytes, but turns the decoder's `-0` text into `f904007c80008606`, without the neg bit. - With float constants only (1,214 records), the value is the same and only the spelling differs: `neg(0.5)` against `-0.5`, and `neg(-0.5)` against `--0.5`. 3. **Float inline constants (codes 240 to 248) on the 24 `v_cmp[x]_{eq,ne,lt,le,gt,ge}_{i16,u16}_sdwa` forms.** This affects 875 records. LLVM prints the f16 bit pattern and the decoder prints the float. For `f904127df0008606`, LLVM prints `v_cmp_lt_i16_sdwa vcc_lo, 0x3800, v2 ...` and the decoder prints `... 0.5, v2 ...`. A round trip does not settle which spelling is right. LLVM 15.0.7 `llvm-mc` (`-triple=amdgcn--amdpal -mcpu=gfx1013 -mattr=+wavefrontsize32`) rejects both texts with `invalid operand for instruction` on all 875 records, so LLVM's own disassembly of these encodings does not reassemble either. I am reporting this as a spelling difference whose meaning is unconfirmed, not as a wrong value. **Scanner classification** These checks use `scan_unsupported_shaders.py` with the decoder's text as input. - Every record on which both decoders agree is a recognized opcode. - Canonical sources: I took src0 = `s44` and src1 = `v18`, with 5 to 8 variants per opcode, giving 812 encodings that both decoders decode the same way. For all 812, the per-line `is_instruction_supported` verdict matches `pixel_aot.lower` run on a known-good program (`with_constants`, `constant_descriptor=64`). 96 are supported and lowered (the 16 `v_cmp_*_f32_sdwa` forms with DWORD selectors). The other 716 are neither. - Delta 1: 3,329 distinct decoder texts containing `s209` to `s234` pass the per-line check. `lower` rejects all of them (KeyError), so only the per-line supported count is affected. - Delta 2: 2,880 records with DWORD selectors (2,592 of them with integer constants) produce decoder text that passes the per-line check and that `lower` accepts. For `f924027c81009606`, `lower` therefore accepts an operand of -1 where the encoding means neg(1). LLVM's `neg(c)` spelling passes the per-line regex, but `lower` rejects it. - Refused records keep their e32 mnemonic, for example `v_cmp_f_f32_e32 <unsupported SDWA>`. `is_opcode_recognized` accepts these through its `v_cmp_` prefix rule. A shader that contains one is classified `opcode_recognized_translator_rejected`, the same as a valid SDWA compare that is not translated. Of the 636,510 refused records, 412,242 are recognized this way. The other 224,268 are unrecognized: these are opcodes without a `VOPC_OPS` entry, printed as `v_vopc_NN <unsupported SDWA>`. #980 did not change this behaviour. I note it because the issue asks about recognized versus translated. **Negative controls** Each control patches the decoder in memory and compares it against the same LLVM results. The decoder is restored and re-checked afterwards. - Renaming `VOPC_OPS[0x01]` to `v_cmp_le_f32_e32` gives 2,081 new text deltas, all on opcode 0x01. That is every LLVM-decoded 0x01 record that had no delta before. - Swapping WORD_0 and WORD_1 in `SDWA_SEL_NAMES` gives 4,569 new deltas, all on records with a WORD selector. That is every such record that had no delta before. - Reporting refused records as 4 bytes gives 636,138 next-record-offset deltas, all on refused records. **Limits** - The sweep is not exhaustive. There are 2^48 field combinations. The families above cover each field fully on its own, but cover combinations of fields only through the random samples. - Selector 7: once the opcode is valid, LLVM 15.0.7 faults with an access violation inside `LLVMDisasmInstruction`. The #980 test notes that `printSDWASel` reaches `llvm_unreachable`. There is no reference text for these 372 records. The decoder refuses all 768 selector-7 records. - Only wave32 was tested. The wave64 spellings (`vcc`, SGPR pairs) were not. - The translator check uses one known-good program. It shows `lower`'s verdict, not that the generated HLSL is correct. - The sweep script is local (`out/` is gitignored). I can share it if that is useful. AI-assisted.
MasterDomino commented 2026-11-24 06:49:43 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by MasterDomino on 2026-11-23T21:36:39Z.


@Batushn, are you taking the post-s_endpgm boundary slice? If not, I would like to pick up what is left of #938, in focused PRs:

  1. The two decoder deltas from the sweep above that change what lower sees. SDWA scalar source codes 209 to 234 should be refused, as LLVM 15 refuses them. neg without abs on an inline constant should be printed as neg(c), so lower rejects the encoding instead of reading it as a different constant. Each gets an LLVM 15 round-trip test and a negative control.
  2. The post-s_endpgm boundary slice, scoped here before I start it.

The i16/u16 float-constant spelling (delta 3) stays as it is until something settles it, since LLVM 15 does not reassemble either form.

As @R0Y00 asked above, I will not start until one of you confirms here.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7114687703 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/938#issuecomment-7114687703). Originally posted by [MasterDomino](https://github.com/MasterDomino) on 2026-11-23T21:36:39Z. --- @Batushn, are you taking the post-`s_endpgm` boundary slice? If not, I would like to pick up what is left of #938, in focused PRs: 1. The two decoder deltas from the sweep above that change what `lower` sees. SDWA scalar source codes 209 to 234 should be refused, as LLVM 15 refuses them. neg without abs on an inline constant should be printed as `neg(c)`, so `lower` rejects the encoding instead of reading it as a different constant. Each gets an LLVM 15 round-trip test and a negative control. 2. The post-`s_endpgm` boundary slice, scoped here before I start it. The i16/u16 float-constant spelling (delta 3) stays as it is until something settles it, since LLVM 15 does not reassemble either form. As @R0Y00 asked above, I will not start until one of you confirms here. AI-assisted.
R0Y00 commented 2026-11-24 06:49:44 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-23T21:43:21Z.


Please take the two SDWA decoder deltas from the sweep first, as focused changes. Keep a synthetic accepted record and a refused record followed by a known 4-byte instruction, so the test measures both the classification and the next offset. Preserve neg on an inline constant explicitly so the lowerer can reject that encoding. Label the 209–234 refusal as the supported LLVM 15 decoder subset unless there is independent ISA evidence. The LLVM-specific i16/u16 spelling can stay unchanged.

Batushn has not claimed the post-s_endpgm slice in this thread. You can take it separately after the decoder fixes. Keep discovery of later records separate from whether the translator accepts a multi-exit program. Include a closed one-exit shader and a case with real instructions or padding after the first marker.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7114832529 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/938#issuecomment-7114832529). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-23T21:43:21Z. --- Please take the two SDWA decoder deltas from the sweep first, as focused changes. Keep a synthetic accepted record and a refused record followed by a known 4-byte instruction, so the test measures both the classification and the next offset. Preserve neg on an inline constant explicitly so the lowerer can reject that encoding. Label the 209–234 refusal as the supported LLVM 15 decoder subset unless there is independent ISA evidence. The LLVM-specific i16/u16 spelling can stay unchanged. Batushn has not claimed the post-s_endpgm slice in this thread. You can take it separately after the decoder fixes. Keep discovery of later records separate from whether the translator accepts a multi-exit program. Include a closed one-exit shader and a case with real instructions or padding after the first marker.
MasterDomino commented 2026-11-24 06:49:44 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by MasterDomino on 2026-11-23T21:47:32Z.


Taking the two SDWA decoder deltas now as two focused PRs: refusing SDWA scalar source codes 209 to 234 (labelled as the supported LLVM 15 decoder subset), and printing neg(c) for neg without abs on an inline constant. Each test has a synthetic accepted record and a refused record followed by a known 4-byte instruction. The post-s_endpgm slice comes after those, separately. I will link the PRs here.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7114923579 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/938#issuecomment-7114923579). Originally posted by [MasterDomino](https://github.com/MasterDomino) on 2026-11-23T21:47:32Z. --- Taking the two SDWA decoder deltas now as two focused PRs: refusing SDWA scalar source codes 209 to 234 (labelled as the supported LLVM 15 decoder subset), and printing `neg(c)` for neg without abs on an inline constant. Each test has a synthetic accepted record and a refused record followed by a known 4-byte instruction. The post-`s_endpgm` slice comes after those, separately. I will link the PRs here. AI-assisted.
MasterDomino commented 2026-11-24 06:49:46 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by MasterDomino on 2026-11-23T22:09:53Z.


The two SDWA decoder fixes are up: #1028 (scalar codes 209 to 234 refused as the supported LLVM 15 subset) and #1029 (neg(c) on inline constants).

Below is the scope for the post-s_endpgm slice (step 4), as asked above, before I start it. I will not begin coding it until #1028 and #1029 settle, since all three touch tools/disasm_rdna2.py.

Measured on one local input (12,101 PS records, the same population as #711), aggregates only:

  • Bounding is not the problem. For every record, the span tools/extract_shaders.py writes (from the code start to the last aligned s_endpgm word) is identical to pixel_aot._bounded_code, the FSSM v0x101 section extent minus s_code_end padding.
  • Decoded with LLVM 15, 6,088 records have real instructions after the first s_endpgm: 5,465 have two exits and 623 have three or more. The other 5,912 have one exit as their last instruction. LLVM refuses to decode 101 records, which is unrelated.
  • The number of non-padding instructions after the first exit has a median of 4, a 95th percentile of 3,070 and a maximum of 9,798. Some shaders exit early and keep most of their code after that point.
  • disasm_rdna2 stops at the first s_endpgm in all 6,088 of these records, so the scanner never sees that code.

Proposed change, decoder only. Discovery is kept separate from translator acceptance, as asked:

  1. disasm_rdna2 keeps decoding to the end of the buffer it is given instead of breaking at the first s_endpgm. It reports each later record with the same offsets and lengths as LLVM 15.
  2. Nothing changes in what the translator accepts. pixel_aot.lower still refuses Instruction follows program end, and container_code keeps its verified two-exit rule. The scanner simply counts and classifies every decoded record. Its per-record verdict stays whatever lower says.
  3. Tests in tests/rdna2_tools_check.py, each also compared with LLVM 15 text and next offsets when LLVM_LIB is set:
    • a closed one-exit shader, with identical records before and after the change;
    • the #938 repro, s_endpgm followed by v_mov_b32_e32 v1, v2, plus a two-exit program with a branch over the first exit;
    • padding after the first marker: s_code_end words, and the zero words the current code comment mentions;
    • negative control: the current decoder fails the real-code case.
  4. In the PR, the aggregate before/after scan counts on the same input, re-baselined on current main.

One question: zero words after the last s_endpgm. LLVM 15 (llvm-mc --disassemble, gfx1013) decodes s_code_end as s_code_end, but treats a 0x00000000 word as an invalid encoding. The current decoder comment expects "4 trailing zero padding bytes after endpgm". Should such a zero tail after the final exit be refused as LLVM refuses it, as a 4-byte unknown record, or reported as padding? My default is to match LLVM, so the zero tail becomes a refused record and an unbounded buffer is visible as such. Stripping stays with callers, as _bounded_code already does for s_code_end. The extractor's .bin files end at the last s_endpgm, so this case does not occur in the input measured above.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7115407103 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/938#issuecomment-7115407103). Originally posted by [MasterDomino](https://github.com/MasterDomino) on 2026-11-23T22:09:53Z. --- The two SDWA decoder fixes are up: #1028 (scalar codes 209 to 234 refused as the supported LLVM 15 subset) and #1029 (`neg(c)` on inline constants). Below is the scope for the post-`s_endpgm` slice (step 4), as asked above, before I start it. I will not begin coding it until #1028 and #1029 settle, since all three touch `tools/disasm_rdna2.py`. **Measured on one local input** (12,101 PS records, the same population as #711), aggregates only: - Bounding is not the problem. For every record, the span `tools/extract_shaders.py` writes (from the code start to the last aligned `s_endpgm` word) is identical to `pixel_aot._bounded_code`, the FSSM v0x101 section extent minus `s_code_end` padding. - Decoded with LLVM 15, 6,088 records have real instructions after the first `s_endpgm`: 5,465 have two exits and 623 have three or more. The other 5,912 have one exit as their last instruction. LLVM refuses to decode 101 records, which is unrelated. - The number of non-padding instructions after the first exit has a median of 4, a 95th percentile of 3,070 and a maximum of 9,798. Some shaders exit early and keep most of their code after that point. - `disasm_rdna2` stops at the first `s_endpgm` in all 6,088 of these records, so the scanner never sees that code. **Proposed change**, decoder only. Discovery is kept separate from translator acceptance, as asked: 1. `disasm_rdna2` keeps decoding to the end of the buffer it is given instead of breaking at the first `s_endpgm`. It reports each later record with the same offsets and lengths as LLVM 15. 2. Nothing changes in what the translator accepts. `pixel_aot.lower` still refuses `Instruction follows program end`, and `container_code` keeps its verified two-exit rule. The scanner simply counts and classifies every decoded record. Its per-record verdict stays whatever `lower` says. 3. Tests in `tests/rdna2_tools_check.py`, each also compared with LLVM 15 text and next offsets when `LLVM_LIB` is set: - a closed one-exit shader, with identical records before and after the change; - the #938 repro, `s_endpgm` followed by `v_mov_b32_e32 v1, v2`, plus a two-exit program with a branch over the first exit; - padding after the first marker: `s_code_end` words, and the zero words the current code comment mentions; - negative control: the current decoder fails the real-code case. 4. In the PR, the aggregate before/after scan counts on the same input, re-baselined on current `main`. **One question: zero words after the last `s_endpgm`.** LLVM 15 (`llvm-mc --disassemble`, gfx1013) decodes `s_code_end` as `s_code_end`, but treats a `0x00000000` word as an invalid encoding. The current decoder comment expects "4 trailing zero padding bytes after endpgm". Should such a zero tail after the final exit be refused as LLVM refuses it, as a 4-byte unknown record, or reported as padding? My default is to match LLVM, so the zero tail becomes a refused record and an unbounded buffer is visible as such. Stripping stays with callers, as `_bounded_code` already does for `s_code_end`. The extractor's `.bin` files end at the last `s_endpgm`, so this case does not occur in the input measured above. AI-assisted.
R0Y00 commented 2026-11-24 06:49:49 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-23T22:44:34Z.


#1028 and #1029 are both on main, so the decoder-only follow-up can start. In a caller-supplied span, keep a zero word after the final exit as a four-byte refused/unknown record if LLVM 15 refuses that exact encoding. Only a caller with an established format boundary should drop it as padding. Keep s_code_end visible as a decoded record. Please preserve offsets for a branch past the first exit and a refused word, and verify that the scanner counts later decoded records while translator acceptance remains unchanged. The aggregate local count is useful context; keep the committed regressions synthetic.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7116126240 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/938#issuecomment-7116126240). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-23T22:44:34Z. --- #1028 and #1029 are both on main, so the decoder-only follow-up can start. In a caller-supplied span, keep a zero word after the final exit as a four-byte refused/unknown record if LLVM 15 refuses that exact encoding. Only a caller with an established format boundary should drop it as padding. Keep s_code_end visible as a decoded record. Please preserve offsets for a branch past the first exit and a refused word, and verify that the scanner counts later decoded records while translator acceptance remains unchanged. The aggregate local count is useful context; keep the committed regressions synthetic.
R0Y00 commented 2026-11-24 06:49:54 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-23T23:55:37Z.


#1055 now implements the decoder-only continuation after s_endpgm. I ran the full 97-test rdna2_tools_check suite with LLVM 15.0.7 on edb4eb2, including the source-built branch and trailing-word case. It preserves later offsets, recognizes s_code_end at the GFX10 encoding and leaves the lowerer refusing the extra executable records. @MasterDomino, please carry forward any independent coverage from your earlier claim in that PR so there is one decoder change.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7117512623 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/938#issuecomment-7117512623). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-23T23:55:37Z. --- #1055 now implements the decoder-only continuation after s_endpgm. I ran the full 97-test rdna2_tools_check suite with LLVM 15.0.7 on edb4eb2, including the source-built branch and trailing-word case. It preserves later offsets, recognizes s_code_end at the GFX10 encoding and leaves the lowerer refusing the extra executable records. @MasterDomino, please carry forward any independent coverage from your earlier claim in that PR so there is one decoder change.
tedin7 commented 2026-11-24 06:49:59 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T01:04:39Z.


Claiming two more slices of this issue, decoding only in tools/disasm_rdna2.py: the SMEM ops (s_buffer_store_dword*, s_gl1_inv, s_dcache_inv/wb, s_memtime/realtime, s_atc_probe*) and the f16 VOP1/VOP2 opcodes. The SOPK/SOPP slice is already open as #1092. Environment: Linux with LLVM 19 locally; I rely on the Ubuntu LLVM 15 job and the Windows WARP jobs for the rest. AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7118729634 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/938#issuecomment-7118729634). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T01:04:39Z. --- Claiming two more slices of this issue, decoding only in tools/disasm_rdna2.py: the SMEM ops (s_buffer_store_dword*, s_gl1_inv, s_dcache_inv/wb, s_memtime/realtime, s_atc_probe*) and the f16 VOP1/VOP2 opcodes. The SOPK/SOPP slice is already open as #1092. Environment: Linux with LLVM 19 locally; I rely on the Ubuntu LLVM 15 job and the Windows WARP jobs for the rest. AI-assisted.
tedin7 commented 2026-11-24 06:50:01 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T01:13:33Z.


Claiming the s_movrel* SOP1 slice (5 ops) in tools/disasm_rdna2.py, decoding only. Environment: Linux with LLVM 19 locally; I rely on the Ubuntu LLVM 15 job and the Windows WARP jobs for the rest. AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7118886665 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/938#issuecomment-7118886665). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T01:13:33Z. --- Claiming the s_movrel* SOP1 slice (5 ops) in tools/disasm_rdna2.py, decoding only. Environment: Linux with LLVM 19 locally; I rely on the Ubuntu LLVM 15 job and the Windows WARP jobs for the rest. AI-assisted.
tedin7 commented 2026-11-24 06:50:06 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T02:00:22Z.


Claiming the VOP3 and MUBUF slice, decoding only, in tools/disasm_rdna2.py and tools/scan_unsupported_shaders.py: VOP3 opcodes 0x16b (v_mul_lo_i32), 0x172 (v_qsad_pk_u16_u8), 0x173 (v_mqsad_pk_u16_u8) and 0x202 (v_interp_mov_f32_e64), and MUBUF opcodes 0x26 and 0x27 (buffer_load_format_d16_hi_x, buffer_store_format_d16_hi_x). Environment: Linux with LLVM 19 locally, plus an extracted Debian LLVM 15.0.6 for spelling; I rely on the Ubuntu LLVM 15 job and the Windows WARP jobs for the rest. LLVM 15 does not know the two MUBUF spellings for gfx1013, so those two are checked against LLVM 19 only. AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7119661799 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/938#issuecomment-7119661799). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T02:00:22Z. --- Claiming the VOP3 and MUBUF slice, decoding only, in tools/disasm_rdna2.py and tools/scan_unsupported_shaders.py: VOP3 opcodes 0x16b (v_mul_lo_i32), 0x172 (v_qsad_pk_u16_u8), 0x173 (v_mqsad_pk_u16_u8) and 0x202 (v_interp_mov_f32_e64), and MUBUF opcodes 0x26 and 0x27 (buffer_load_format_d16_hi_x, buffer_store_format_d16_hi_x). Environment: Linux with LLVM 19 locally, plus an extracted Debian LLVM 15.0.6 for spelling; I rely on the Ubuntu LLVM 15 job and the Windows WARP jobs for the rest. LLVM 15 does not know the two MUBUF spellings for gfx1013, so those two are checked against LLVM 19 only. AI-assisted.
triggered02 commented 2026-11-24 06:50:20 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by triggered02 on 2026-11-24T04:37:22Z.


Reopening the last open item from this issue: D9 is still present on current main (4926f34a), even though most of the list has landed.

tools/disasm_rdna2.py still routes VOP3 interpolation through the gfx9/VI range only:

elif 0x270 <= op < 0x274:
    vintrp_names = {0: v_interp_p1_f32_e64, 1: v_interp_p2_f32_e64, 2: v_interp_mov_f32_e64}

On gfx10/gfx1013 these live at 0x200 / 0x201 / 0x202 (LLVM 15 VOP3Instructions.td:1045-1047), so they fall through to the generic placeholder. Decoding the LLVM golden encoding for v_interp_p1_f32_e64 v5, v2, attr0.x ([0x05,0x00,0x00,0xd6,0x00,0x04,0x02,0x00]) on current main gives:

opcode='v_vop3_200'  asm='v_vop3_200 v5, s0, v2, s0'

i.e. no mnemonic and the attribute operand rendered as a source register. Same for 0x201 and 0x202.

Confirmed already fixed on main, so this is only the VINTRP remainder: MIMG image_msaa_load (0x80) and the image_sample_*_g16 family now decode correctly.

I am taking the 0x200-0x202 slice: map the three forms to v_interp_p1_f32_e64 / v_interp_p2_f32_e64 / v_interp_mov_f32_e64, render the attribute operand as attrN.<chan> with clamp/omod where the encoding allows, verify the existing 0x270-0x274 branch is genuinely the VI range before keeping it, and add golden vectors taken from LLVM 15.0.7 MC tests with file/line citations. Decoding only; no translator change.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7122188046 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/938#issuecomment-7122188046). Originally posted by [triggered02](https://github.com/triggered02) on 2026-11-24T04:37:22Z. --- Reopening the last open item from this issue: **D9 is still present on current `main`** (`4926f34a`), even though most of the list has landed. `tools/disasm_rdna2.py` still routes VOP3 interpolation through the gfx9/VI range only: ``` elif 0x270 <= op < 0x274: vintrp_names = {0: v_interp_p1_f32_e64, 1: v_interp_p2_f32_e64, 2: v_interp_mov_f32_e64} ``` On gfx10/gfx1013 these live at **0x200 / 0x201 / 0x202** (LLVM 15 `VOP3Instructions.td:1045-1047`), so they fall through to the generic placeholder. Decoding the LLVM golden encoding for `v_interp_p1_f32_e64 v5, v2, attr0.x` (`[0x05,0x00,0x00,0xd6,0x00,0x04,0x02,0x00]`) on current `main` gives: ``` opcode='v_vop3_200' asm='v_vop3_200 v5, s0, v2, s0' ``` i.e. no mnemonic and the attribute operand rendered as a source register. Same for 0x201 and 0x202. Confirmed already fixed on `main`, so this is only the VINTRP remainder: MIMG `image_msaa_load` (0x80) and the `image_sample_*_g16` family now decode correctly. I am taking the 0x200-0x202 slice: map the three forms to `v_interp_p1_f32_e64` / `v_interp_p2_f32_e64` / `v_interp_mov_f32_e64`, render the attribute operand as `attrN.<chan>` with `clamp`/`omod` where the encoding allows, verify the existing 0x270-0x274 branch is genuinely the VI range before keeping it, and add golden vectors taken from LLVM 15.0.7 MC tests with file/line citations. Decoding only; no translator change.
MasterDomino commented 2026-11-24 06:50:25 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by MasterDomino on 2026-11-24T05:18:32Z.


Independent check of #1055 on Windows with LLVM 15.0.7, plus the before/after scan on the local input mentioned above. Measurement only, no project change. Nothing from my earlier claim needs to be carried forward: #1055 already covers every planned case.

Setup

  • upstream/main at 908c34bf, Windows 11 26H2 (build 26300.9974), Python 3.13.1.
  • LLVM 15.0.7: LLVM-C.dll from the LLVM 15.0.7 Windows install, and llvm-mc / llvm-objcopy 15.0.7.
  • "Before" is the same tree with only the first-exit break put back in disassemble_binary. The s_code_end name and the zero-word record from #1055 stay in place, so the comparison isolates the continuation.

Decoder tests

LLVM_LIB=<LLVM-C.dll> LLVM_MC=<llvm-mc> LLVM_OBJCOPY=<llvm-objcopy> python -B tests/rdna2_tools_check.py

  • 908c34bf: 129 tests, OK, 1 skip. The skip is the expected one: LLVM 15 does not decode buffer_load_format_d16_hi_x for gfx1013. test_source_built_records_after_s_endpgm ran and passed.
  • Before tree (negative control): 4 failures, namely test_decode_continues_past_s_endpgm, test_source_built_records_after_s_endpgm, test_binary_scan_counts_records_after_s_endpgm and test_hwreg_truncated_literal_and_endpgm_boundaries.

One local input, aggregates only

The input is 12,101 PS records (the same population as #711), re-extracted with tools/extract_shaders.py --stage pixel --format native at 908c34bf. As the LLVM reference, every record was walked with LLVMDisasmInstruction the way llvm-mc does it: a refused word becomes a 4-byte record and decoding continues.

Records and boundaries

  • disasm_rdna2 now returns 18,957,986 records, against 16,603,289 up to the first exit. That is 2,354,697 more. LLVM 15 returns 18,958,000.
  • 12,089 records have identical offsets and lengths across the whole span. The other 12 first differ after the first exit, each at a word LLVM refuses that our decoder reads as an 8-byte instruction: v_madmk_f32 (8), VOP2 DPP8 (2), VOP2 SDWA (1) and an unnamed SOP1 with a literal (1).
  • 6,189 records have code after the first exit, all with two or more exits. This is the 6,088 from my earlier count plus the 101 below, which LLVM previously refused as a whole.
  • LLVM-refused words: 1,302 words (197 of them zero) in 101 records, all after the first exit. In every one of these records the first refused word directly follows an s_endpgm, and in 70 of them a later s_endpgm follows. I have not checked what these bytes are or whether any branch reaches them. Non-instruction data between exits is a hypothesis only.

Scanner (tools/scan_unsupported_shaders.py --llvm <LLVM-C.dll> on the .bin directory)

before after
opcodes recognized, translator rejected 10,882 10,561
unsupported opcodes 1,219 1,540
unique unsupported opcodes 4 46
translator accepted 0 0
  • The translator verdict is unchanged in all 12,101 records: lower_status and lower_error are identical before and after. That confirms acceptance is unchanged.
  • 321 records move to "unsupported opcodes" because of code after the first exit:
    • 258 only because of v_vop3_378;
    • 36 only because of LLVM-refused words;
    • 25 because of refused words plus s_sopk_1b / s_sopk_1c (LLVM: s_subvector_loop_begin / _end);
    • 2 because of v_vop3_378 plus refused words.
  • Of the 42 new unique "opcodes", most are placeholders for words LLVM also refuses, such as .long and assorted s_sop1_xx / s_sopc_xx. After the first exit, our unrecognized records are:
    • 687 that LLVM decodes: 614 v_permlanex16_b32, 52 s_subvector_loop_end and 21 s_subvector_loop_begin;
    • 444 that LLVM refuses too.
  • s_subvector_loop_* appears only in records that also contain refused words, so I would not treat it as a decoder gap yet.

Two observations

  1. VOP3 0x378 is unnamed in disasm_rdna2. llvm-mc 15 encodes v_permlanex16_b32 v0, v1, s0, s1 as [0x00,0x00,0x78,0xd7,0x01,0x01,0x04,0x00] and v_permlane16_b32 as 0x377. The scanner already lists both names. v_vop3_378 was the most frequent unsupported placeholder before #1055 (2,571 occurrences) and still is after it (3,185). I found no issue or PR for either opcode. If it is useful, I can take naming 0x377/0x378 as a decoding-only slice with LLVM 15 round trips and the source-built scan case, once you confirm.
  2. The scanner counts LLVM-refused words as unsupported opcodes. That accounts for most of the jump from 4 to 46 unique opcodes, and these words are not instructions. Reporting refused encodings separately from unsupported opcodes would keep the opcode list meaningful. I have not changed anything here; this is your call.

Limits

  • One local input and one LLVM version.
  • "After the first exit" means byte order only. Reachability of later code was not analysed.
  • The 12 boundary differences are all at words LLVM refuses, so they matter only if those bytes are ever treated as code.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7122825345 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/938#issuecomment-7122825345). Originally posted by [MasterDomino](https://github.com/MasterDomino) on 2026-11-24T05:18:32Z. --- Independent check of #1055 on Windows with LLVM 15.0.7, plus the before/after scan on the local input mentioned above. Measurement only, no project change. Nothing from my earlier claim needs to be carried forward: #1055 already covers every planned case. ## Setup - `upstream/main` at `908c34bf`, Windows 11 26H2 (build 26300.9974), Python 3.13.1. - LLVM 15.0.7: `LLVM-C.dll` from the LLVM 15.0.7 Windows install, and `llvm-mc` / `llvm-objcopy` 15.0.7. - "Before" is the same tree with only the first-exit `break` put back in `disassemble_binary`. The `s_code_end` name and the zero-word record from #1055 stay in place, so the comparison isolates the continuation. ## Decoder tests `LLVM_LIB=<LLVM-C.dll> LLVM_MC=<llvm-mc> LLVM_OBJCOPY=<llvm-objcopy> python -B tests/rdna2_tools_check.py` - `908c34bf`: 129 tests, OK, 1 skip. The skip is the expected one: LLVM 15 does not decode `buffer_load_format_d16_hi_x` for gfx1013. `test_source_built_records_after_s_endpgm` ran and passed. - Before tree (negative control): 4 failures, namely `test_decode_continues_past_s_endpgm`, `test_source_built_records_after_s_endpgm`, `test_binary_scan_counts_records_after_s_endpgm` and `test_hwreg_truncated_literal_and_endpgm_boundaries`. ## One local input, aggregates only The input is 12,101 PS records (the same population as #711), re-extracted with `tools/extract_shaders.py --stage pixel --format native` at `908c34bf`. As the LLVM reference, every record was walked with `LLVMDisasmInstruction` the way `llvm-mc` does it: a refused word becomes a 4-byte record and decoding continues. **Records and boundaries** - `disasm_rdna2` now returns 18,957,986 records, against 16,603,289 up to the first exit. That is 2,354,697 more. LLVM 15 returns 18,958,000. - 12,089 records have identical offsets and lengths across the whole span. The other 12 first differ after the first exit, each at a word LLVM refuses that our decoder reads as an 8-byte instruction: `v_madmk_f32` (8), VOP2 DPP8 (2), VOP2 SDWA (1) and an unnamed SOP1 with a literal (1). - 6,189 records have code after the first exit, all with two or more exits. This is the 6,088 from my earlier count plus the 101 below, which LLVM previously refused as a whole. - LLVM-refused words: 1,302 words (197 of them zero) in 101 records, all after the first exit. In every one of these records the first refused word directly follows an `s_endpgm`, and in 70 of them a later `s_endpgm` follows. I have not checked what these bytes are or whether any branch reaches them. Non-instruction data between exits is a hypothesis only. **Scanner** (`tools/scan_unsupported_shaders.py --llvm <LLVM-C.dll>` on the `.bin` directory) | | before | after | |---|---|---| | opcodes recognized, translator rejected | 10,882 | 10,561 | | unsupported opcodes | 1,219 | 1,540 | | unique unsupported opcodes | 4 | 46 | | translator accepted | 0 | 0 | - The translator verdict is unchanged in all 12,101 records: `lower_status` and `lower_error` are identical before and after. That confirms acceptance is unchanged. - 321 records move to "unsupported opcodes" because of code after the first exit: - 258 only because of `v_vop3_378`; - 36 only because of LLVM-refused words; - 25 because of refused words plus `s_sopk_1b` / `s_sopk_1c` (LLVM: `s_subvector_loop_begin` / `_end`); - 2 because of `v_vop3_378` plus refused words. - Of the 42 new unique "opcodes", most are placeholders for words LLVM also refuses, such as `.long` and assorted `s_sop1_xx` / `s_sopc_xx`. After the first exit, our unrecognized records are: - 687 that LLVM decodes: 614 `v_permlanex16_b32`, 52 `s_subvector_loop_end` and 21 `s_subvector_loop_begin`; - 444 that LLVM refuses too. - `s_subvector_loop_*` appears only in records that also contain refused words, so I would not treat it as a decoder gap yet. ## Two observations 1. VOP3 `0x378` is unnamed in `disasm_rdna2`. llvm-mc 15 encodes `v_permlanex16_b32 v0, v1, s0, s1` as `[0x00,0x00,0x78,0xd7,0x01,0x01,0x04,0x00]` and `v_permlane16_b32` as `0x377`. The scanner already lists both names. `v_vop3_378` was the most frequent unsupported placeholder before #1055 (2,571 occurrences) and still is after it (3,185). I found no issue or PR for either opcode. If it is useful, I can take naming `0x377`/`0x378` as a decoding-only slice with LLVM 15 round trips and the source-built scan case, once you confirm. 2. The scanner counts LLVM-refused words as unsupported opcodes. That accounts for most of the jump from 4 to 46 unique opcodes, and these words are not instructions. Reporting refused encodings separately from unsupported opcodes would keep the opcode list meaningful. I have not changed anything here; this is your call. ## Limits - One local input and one LLVM version. - "After the first exit" means byte order only. Reachability of later code was not analysed. - The 12 boundary differences are all at words LLVM refuses, so they matter only if those bytes are ever treated as code. AI-assisted.
Sign in to join this conversation.
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
R0Y00/Xbox2Windows#931
No description provided.