tooling: recognize SOPK hwreg opcodes in scanner and add boundary tests #949
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/956"
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 R0Y00/Xbox2Windows. Originally posted by Batushn on 2026-11-23T18:37:49Z.
Summary
Rebased onto
mainafter #951 as a small follow-up to #938, keeping only the remaining useful differences requested by @R0Y00:tools/scan_unsupported_shaders.py): adds_getreg_b32,s_setreg_b32, ands_setreg_imm32_b32toKNOWN_RDNA2_BASE_OPCODES(SOPK). Without this, even an otherwise lowerable pixel shader using accepteds_setreg_imm32_b32forms was still classified asunsupported_opcodes(opcodes_recognized=False).tests/rdna2_tools_check.py):test_binary_scan_reports_decoded_hwreg_writes_as_supportedto assertopcodes_recognized=Trueandunsupported_opcodes={}on both the accepted and directed-rounding binary controls.test_binary_scan_hwreg_recognition_stays_separate_from_translation_supportproving:s_setreg_imm32_b32forms (HW_REG_FLAT_SCR_LO/HI,HW_REG_MODE0/3) now reachescompatibility_category == "accepted"andis_fully_supported == True.s_getreg_b32ands_setreg_b32are recognized RDNA 2 opcodes (opcodes_recognized == True,unsupported_opcodes == {}) yet remain rejected by the translator (is_instruction_supported == False,translator_accepted == False,compatibility_category == "opcode_recognized_translator_rejected"), tested both in a binary scan and embedded in an otherwise accepted pixel shader.opcodes_recognized == Falseandcompatibility_category == "unsupported_opcodes".s_endpgmboundary controls (tests/rdna2_tools_check.py):test_hwreg_truncated_literal_and_endpgm_boundariescovering 4-byte and 6-byte truncateds_setreg_imm32_b32streams, mid-stream truncation afters_getreg_b32, and a boundary control wheres_setreg_imm32_b32's 32-bit literal equals0xbf810000(s_endpgm) so disassembly consumes it as a literal, decodes the followings_getreg_b32, and stops cleanly at the reals_endpgmbefore trailing bytes.Refs #938
Verification
python -B tests/rdna2_tools_check.pyon Windows 11 (Python 3.12.10, synthetic inputs, no game files):Ran 80 tests ... OK (skipped=2)(the 2 skipped tests requirellvm-mc/llvm-objcopyand will run in Ubuntu CI).AI-assisted: yes
Imported from R0Y00/Xbox2Windows. Originally posted by Batushn on 2026-11-23T19:07:51Z.
Thanks @R0Y00! Rebased #956 onto
main(788fc9e) after #951 as a focused follow-up retaining only:s_getreg_b32,s_setreg_b32, ands_setreg_imm32_b32toKNOWN_RDNA2_BASE_OPCODESintools/scan_unsupported_shaders.py, with tests proving recognition stays separate from translation support fors_getreg_b32/s_setreg_b32while an accepteds_setreg_imm32_b32pixel shader reachesaccepted.s_endpgm-as-literal (0xbf810000) boundary controls intests/rdna2_tools_check.py.Local check:
python -B tests/rdna2_tools_check.py-> 80 run (78 passed, 2 LLVM-only skipped); CI is now re-running on the rebased head.