Repository navigation
shader_disasm: print v_dot4_i32_i8 op_sel 2 / op_sel_hi 5 words llvm-mc rejects (OLD-10010) - #1317
ambroseautomation wants to merge 1 commit into
Conversation
|
Independent verification (AI-assisted, overnight shift worker): Environment: Windows, Commands & results:
The test assembles real instruction lines with llvm-mc, flips the op_sel/op_sel_hi fields in the two dwords, then checks shader_disasm prints and rdna2spirv translates the blob — this covers the claim that llvm-mc rejects these words while the patched disassembler path handles them. No game files or GPU needed; verified on this machine only. — AI-assisted verification |
|
This is still needed: #281 (the same change from old PR 10010) shows as merged, and its merge Measured on Windows 10 19045 with native
#281's 4 tests and It matters for the boot: on
AI-assisted (Claude Code, Claude Opus 5.5). |
…rds llvm-mc rejects, so the FSR4 FSPX programs translate The FidelityFX upscaler programs hold 89 such words in 8 programs (docs/fspx.md); the translator already models the form but the listing could not carry it, so the programs were refused as a fall-through into undecodable words.
|
Rebased onto current main (98c2f77): adapted with_dot4_op_sel to main's line-based invalid_offsets and forwarded wave32 to run_mc as noted by @Snooozs, resolved the doc/comment conflicts in docs/fspx.md and tests/semantic/test_alu_dot4_i8.py, and added newline='\n' to the JSON write in test_fspx_dot4_op_sel_disasm.py. Re-verified test_shader_disasm.py (31/31), test_alu_dot4_i8.py (14/14), test_text_write_line_endings.py (3/3), and a mock wave32=False / line-offset check. AI-assisted. |
4e1ca11 to
62237d0
Compare
|
Note for triage: #281 is shown as merged, but its shader_disasm change and tests/semantic/test_fspx_dot4_op_sel_disasm.py are not in current main (they were dropped in merge 154e4ec on the #939 branch). This PR still applies cleanly on main and would restore them. AI-assisted: yes (Claude Code compared the diffs against origin/main; I reviewed it). |
…ead) The copy of #1317 in this branch called with_dot4_op_sel(code, mcpu, bad, err) and run_mc(bytes(patched), mcpu) without wave32, so a wave64 program whose v_dot4_i32_i8 op_sel 2 / op_sel_hi 5 word was re-decoded printed its lane masks as vcc_lo. Take #1317's current head (62237d0, by tedin7): with_dot4_op_sel takes wave32 and hands it to run_mc. Also its newline="\n" on the test's JSON write, and the two blank lines before MAX_DATA_DWORDS. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…re_dot4_inline_sel The general rule from #1495 (dot4_op_sel_fields / restore_dot4_op_sel, ported from luizwidmer/palmetto) took the stored op_sel/op_sel_hi of any v_dot4_i32_i8 that llvm-mc printed with the defaults. That translated op_sel 0 / op_sel_hi 5 with a VGPR second source, a word #1317's test_fspx_dot4_op_sel_disasm.py (case (0, 5)) requires to stay refused: only op_sel 2 / op_sel_hi 5 was measured on gfx1036. The translator suite failed there. Resolve it on the measured side: - drop dot4_op_sel_fields and restore_dot4_op_sel; - keep main's restore_dot4_inline_sel (#984) and its three call sites: the clean-listing check, the forward re-anchor search, and the exact re-anchor window #1662 added today. The general rule does not cover only those cases, so it cannot replace them; - tests/semantic/test_dot4_printed_op_sel.py now checks that the inline-integer form is restored in a clean listing and on re-anchoring, and that op_sel_hi 5 with a VGPR S1, op_sel 1 / op_sel_hi 6, op_sel_hi 4 and a non-default S2 half stay refused; - docs/design.md "Signed-byte dot products" states how each form was confirmed (hardware for op_sel 2 / op_sel_hi 5, a corpus count for the inline-integer form, refused otherwise); docs/fspx.md follows. This also settles the #1662 / #1862 overlap: #1662's call site stays. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Closing as included, thanks @ambroseautomation! #2138, merged as AI-assisted (Claude Code, Claude Opus 5.5). |
…mc rejects) # Conflicts: # docs/fspx.md # tests/semantic/test_alu_dot4_i8.py
…red fields llvm-mc decodes a VOP3P v_dot4_i32_i8 whose op_sel_hi is not [1,1,1] (op_sel bit 1 clear) but prints and re-encodes it with op_sel 0 / op_sel_hi 7, so translate() refused it as a dropped field. When those two fields are the only difference between the stored and the printed bytes, they are now read from the blob, in check_printed_encodings and in both re-anchoring paths, and the v_dot4_i32_i8 rule applies them as measured on gfx1036 (a non-default S2 half stays refused). Any other difference is still refused. This replaces ProjectLeonida#984's restore_dot4_inline_sel, which took one case of the same form (op_sel_hi [1,0,1] with an inline integer S1); that case is covered by the general check. The words llvm-mc rejects (op_sel 2 / op_sel_hi 5) are printed by shader_disasm.py (ProjectLeonida#1317) and recovered from the blob by skipped_form. The approach comes from luizwidmer/palmetto (GPL-3.0). Test: tests/semantic/test_dot4_printed_op_sel.py, hand-built words; design.md contract row and docs/fspx.md updated.
37 upstream commits after 86dc3d8: ProjectLeonida#2138 (integration/boot-combined), ProjectLeonida#2094 (geometry-view eviction on range release, reaped after the replays that may name them), ProjectLeonida#998/ProjectLeonida#1317/ProjectLeonida#1281/ProjectLeonida#583 heads (pipeline-library compute programs by code hash, shader_disasm prints the dot4 op_sel words llvm-mc rejects, FSPX short prologue with the literal-form check), null-resource texture barriers and null-view RTV clears on the console list, and the removal of the title's executable addresses from code (read from the environment). Conflicts, on merit: - d3d12_xs_device.cpp: both. Our title heap sync (LEONIDA_TITLE_HEAP_SYNC) and upstream's null-RTV marks sit side by side; heap_release unregisters the sync or the range as before and also drops the heap's null-RTV marks; CreateDescriptorHeap keeps our desc argument and takes upstream's RTV real range. Our value-op/upload-ring slots and upstream's slot 146 barrier conversion both stay. - startup_trace.h: our thread and watchdog-table logging stays, and follows upstream's rule: the watchdog table's store and table RVAs come from LEONIDA_WATCHDOG_TABLE (off when unset, documented in runtime/README.md); upstream's environment-driven pool diagnostic replaces the fixed address. - fspx_unpack.py: ours (the code end is found from one rdna2_decode pass, not an llvm-mc run per s_endpgm: the OOM and 15-minute fix). Its test takes upstream's short-prologue case, which checks the literal form our code also requires. - rdna2spirv.py: ours (s_bitreplicate_b64_b32 into VCC in wave32 stays translated: 6 pipeline-library programs), plus the point behind upstream's refusal: in wave32 VCC's high word is data, so it is now written to vcc_hi as source bits 16..31 replicated (replicate_bits16, shared with the scalar form). Tests: ours kept, one added for the vcc_hi word; test_salu_flbit_64 keeps ours (this tree translates i64 of a lane mask). - xs_proxy_mock_test.cpp: upstream's empty Barrier call, our chained-submission reference count. Every line the merge removes from our side is upstream's own or one of the resolutions above (checked against the merge base, D:\GTA6\analysis\lostlines.sh). The touched Python suites pass. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Summary
Coordination item:
OLD-10010(carry-forward ofold-pr/10010, preserving original authortedin7).Problem & Root Cause
llvm-mcrejectsv_dot4_i32_i8VOP3P words encoded withop_sel: 2([0,1,0]) andop_sel_hi: 5([1,0,1]), which appear in the FidelityFX upscaler's FSPX programs (docs/fspx.md), preventing those programs from disassembling and translating cleanly.Implementation
DOT4_I8_OPCODE,dot4_op_sel_words(), andwith_dot4_op_sel()intools/shader_disasm.pyto patch rejectedv_dot4_i32_i8op_sel=2 / op_sel_hi=5words to defaults (op_sel=0 / op_sel_hi=7) forllvm-mcdisassembly and restoreop_sel:[0,1,0] op_sel_hi:[1,0,1]and the original encoding bytes on the resulting instruction lines.main'swith_vopc_dpp()fallback pass cleanly alongsidewith_dot4_op_sel()indisasm().docs/fspx.mdand adds semantic/disassembly tests intests/semantic/test_fspx_dot4_op_sel_disasm.pyandtests/semantic/test_alu_dot4_i8.py.Tests Run
Environment: Windows 11 Pro 64-bit, Python 3.12.10, synthetic fixtures only (no game data).
python -I -m py_compile tools/shader_disasm.py tests/semantic/test_fspx_dot4_op_sel_disasm.py tests/semantic/test_alu_dot4_i8.py— PASSpython -I tests/semantic/test_alu_dot4_i8.py— 12/12 PASSpython -I tests/semantic/test_fspx_dot4_op_sel_disasm.py— 4 skipped (nollvm-mcinstalled on this host); additionally verifiedshader_disasm.dot4_op_sel_words()andshader_disasm.disasm()fallback path with a mockedrun_mc— PASSpytest tests/test_docs_links.py tests/test_text_write_line_endings.py -v— 19/19 PASSpython -I scripts/check_no_game_data.py docs/fspx.md tests/semantic/test_alu_dot4_i8.py tests/semantic/test_fspx_dot4_op_sel_disasm.py tools/shader_disasm.py— PASSDisclosure
AI-assisted: yes (carry-forward, rebase onto current
mainpreservingwith_vopc_dpp, and local verification; original implementation by tedin7).