Skip to content

Decode FSSM listings at the compiled wave size - #9556

Closed
nova-aryan wants to merge 1 commit into
ProjectLeonida:mainfrom
nova-aryan:contrib/20-fssm-wave-size-disasm
Closed

nova-aryan wants to merge 1 commit into
ProjectLeonida:mainfrom
nova-aryan:contrib/20-fssm-wave-size-disasm

Conversation

@nova-aryan

Copy link
Copy Markdown
Contributor

Claimed in the coordination issue.

The Python disassembler always emitted wave32 operand spellings. The FSSM header already records the compiled wave size.

Pass that size through both initial disassembly and fallback scanning. The synthetic CLI test checks one compare encoded identically for wave32 and wave64, expecting vcc_lo and vcc respectively. With the original code the wave64 case emitted vcc_lo.

30 shader disassembly tests passed on Windows. In the combined run, the 5,957-test Linux semantic suite reproduced the baseline failures in test_image_atomics_guard and test_image_store_d16. No game files were used.

Developed with AI assistance.

@matheusfermiano-source

Copy link
Copy Markdown

Independent Linux CLI check at aadfda67 with LLVM 23.1.4. I assembled a synthetic v_cmp_eq_u32_e32 and v_cndmask_b32_e32 in explicit wave32 and wave64 modes. The instruction bytes are identical, so the FSSM flag is the input that distinguishes the desired operand spelling.

Using both a valid code offset and the backward-scan path, the parent's Python backend printed vcc_lo for the wave64 fixture. The PR printed vcc for both wave64 instructions and kept vcc_lo for the wave32 fixture. #8916 at 5e67de97 applied cleanly on top in a scratch worktree. All four CLI cases and all 30 focused tests passed there.

Two remaining paths are worth recording separately from the fresh Python result:

  • --skip-existing reused a pre-fix Python wave64 listing byte for byte, so its two operands stayed vcc_lo. A fresh run over the same input wrote vcc. A resume marker that covers the decoder mode would let an existing workspace refresh those listings.
  • The default llvm-mc backend still printed vcc_lo for both header variants at gfx1030 on this LLVM. Setting LLVM_MC='llvm-mc -mattr=+wavefrontsize64,-wavefrontsize32' for the single wave64 fixture produced vcc for both instructions. Applying the header mode per input would cover that backend too.

Synthetic headers and instructions only. AI-assisted (Codex).

@Heyitsjaimin

Copy link
Copy Markdown
Contributor

CPU check at aadfda67e on macOS 27.0.1 (arm64), Python 3.12.10 (pytest 9.2.0) — tool only, no GPU.

  • python -m pytest tests/test_shader_disasm.py -q: 30 passed, 8 subtests passed on the head.
  • Against main's tools/shader_disasm.py the PR's test file gives 1 failed, 30 passed — test_python_backend_uses_the_fssm_wave_size with operand='vcc' — so the new wave-size case is exercised, but only that one subtest is new coverage. The other 29 pass on both, which is expected for a single-path change.

Not checked: the LLVM backend path (needs llvm-mc), and neither side needs a game copy. AI-assisted.

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.

4 participants