TESTS-DISASM-PARTIAL-SWIZZLE-ENCODING: include gfx1013 encodings in cs_w64x_partial_swizzle disasm fixture #2998
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2998"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from ubiquitarianism/leonida. Originally posted by bobcatchris on 2026-12-01T22:54:12Z.
Fixes #2977.
Addresses claim in https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7328374450.
Cause
runtime/test/shaders/cs_w64x_partial_swizzle.asmcarried theregen_fixtures.pymarker, which only generates un-encoded straight-line.slistings. Because it containss_cbranch_execz 9,tools/rdna2spirv.pyrejectedtests/semantic/fixtures/disasm/cs_w64x_partial_swizzle.swithUnsupported: branch without encodingwhen runningrun_gpu_tests.py --disasm-dir tests/semantic/fixtures/disasm.Fix
; regen_fixtures:marker fromruntime/test/shaders/cs_w64x_partial_swizzle.asm(matching branching fixturesps_far_branch.asmandps_pops_wait_loop.asm).tests/semantic/fixtures/disasm/cs_w64x_partial_swizzle.swithllvm-mc -triple=amdgcn--amdpal -mcpu=gfx1013 -mattr=+wavefrontsize64,-wavefrontsize32 -show-encodingso every instruction includes its; encoding:bytes.test_disasm_fixture_matches_asm_and_translatesintests/semantic/test_w64x_partial_swizzle.pyverifying mnemonic parity with.asm, translation in both native wave64 and--wave64-emulate,check_absent_lane_ub, and emulated execution output[508, 523, 0, 0, 528, 0, 531, 0].Verification
.sfixture,test_disasm_fixture_matches_asm_and_translatesfails withrdna2spirv.Unsupported: branch without encoding(RED_EXIT=1); with the fix,test_w64x_partial_swizzle.pypasses (4 passed).tests/semantic/regen_fixtures.py --check,tests/semantic/test_fixtures.py(1 passed),tests/test_regen_fixtures.py(11 passed),tests/test_semantic_translator_use.py(3 passed), andscripts/check_no_game_data.pyall pass.llvm-mcand translation across allfixtures/disasm/*.s): approved.AI-assisted
Imported from ubiquitarianism/leonida. Originally posted by andrew-ai on 2026-12-01T23:02:53Z.
Independently assembled the source at
4058dc897with LLVM 20.1.8 using the gfx1013 wave64 flags in the fixture header. All 58 per-instruction byte sequences match the listing, 304 bytes in total. SHA-256 of the concatenated instruction bytes is be55c9b3553890c9bb72b70483e6e2c6fc774a6e969ee8e51bed5712b0b73e3b.One coverage detail: all four test_w64x_partial_swizzle.py tests passed on the committed file and also after changing just the branch's encoding from [0x09,0x00,0x88,0xbf] to [0x08,0x00,0x88,0xbf], keeping its printed operand at 9. The current fixture is correct. If the intent is to detect stale encodings too, an optional assembler-backed byte comparison would catch this discrepancy. Codex-assisted.
Imported from ubiquitarianism/leonida. Originally posted by bobcatchris on 2026-12-01T23:07:08Z.
Updated in fast-forward commit
ef4100f54to address the coverage gap flagged by @andrew-ai:test_disasm_fixture_matches_asm_and_translatesintests/semantic/test_w64x_partial_swizzle.pynow parses every instruction's; encoding:bytes (checking 4/8-byte instruction lengths), verifiess_cbranch_execz's encoded 16-bit signed displacement matches its printed operand (9) and spans the exact byte offset (36bytes) tos_mov_b64 exec, s[6:7], and cross-checks all instruction encodings againstllvm-mcwhen present onPATH.PATH=""(nollvm-mc) that changing justs_cbranch_execz's encoding to[0x08,0x00,0x88,0xbf]while leaving operand9intact now fails (RED_STALE_DISP=1), and passes with[0x09,0x00,0x88,0xbf](4 passed).AI-assisted
Imported from ubiquitarianism/leonida. Originally posted by andrew-ai on 2026-12-01T23:08:03Z.
Rechecked
ef4100f54on Windows without llvm-mc on PATH. All four tests passed with the committed listing. Repeating the original one-byte change now fails with "8 != 9 : encoded branch displacement must match printed operand". That closes the reported branch-displacement gap even without LLVM installed. Codex-assisted.Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-12-01T23:09:03Z.
The pre-disassembled GPU case is fixed, but the new optional byte check fails with LLVM 23.1.5.
At
ef4100f54merged onto913b88b90,python -m unittest discover -s tests/semantic -p test_w64x_partial_swizzle.pypasses 4/4 with nollvm-mconPATH. With LLVM 23.1.5 it passes 3/4 and fails atlisting bytes diverged from llvm-mc. The branch still encodes displacement 9 in both outputs. The twov_mbcntinstructions andv_cmp_gt_u32_e64each have02as their last byte in LLVM 23 output where the listing has00. LLVM 20.1.8 was reported to match exactly. A version-pinned byte check would keep this comparison reproducible across environments.Separately, I ran the public
run_gpu_tests.py --disasm-dir tests/semantic/fixtures/disasm --filter cs_w64x_partial_swizzlewith a fresh native Vulkan harness. The original fixture on002bd88f8failed translation withbranch without encodingin all four lanes. On the current PR all four lanes passspirv-val. RTX 4070 SUPER (620.73.04) with emulation and Radeon Raphael (RADV 26.3.1) with native and emulated wave64 each read[508, 523, 0, 0, 528, 0, 531, 0]. NVIDIA native dispatch skips as expected because it has no 64-wide compute subgroup. On RADV the separately assembled LLVM 23 path produced byte-identical SPIR-V and the same readback as the fixture in both modes. Synthetic test only. AI-assisted with OpenAI Codex and independent raw-log verification.Imported from ubiquitarianism/leonida. Originally posted by bobcatchris on 2026-12-01T23:15:10Z.
Updated in fast-forward commit
9360f4672per @merzleckeier's LLVM 23.1.5 report:llvm-mcwhole-bytes comparison (encodings(mc_lines) == encs), keeping the deterministic pure-Python encoding-length, signed displacement (enc_disp == printed_disp), and branch target byte-offset checks so the test stays independent of host LLVM version encoding differences in unused OPSEL/VGPR_HI bits while still failing (RED_STALE_DISP=1) if the branch displacement byte diverges from9.test_w64x_partial_swizzle.py(4 passed),test_semantic_translator_use.py(3 passed), andcheck_no_game_data.py.AI-assisted