shader: use named operand codes in gfx1013_isa.cpp and gfx1013_pixel.cpp #3918
No reviewers
Labels
No labels
accessibility
awaiting author
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
priority: P0
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/R0Y00--Xbox2Windows!3918
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3916"
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?
@Leyukaka on GitHub · 2026-12-03 10:18 UTC · original
Leyukaka:quality-item2-s6-isa-pixel→main· +88 −16 · 5 files · 3 commits · merged 2026-12-03 13:42 UTCProblem
src/gfx1013_isa.cppandsrc/gfx1013_pixel.cppstill write operand codes as bare numbers: 255 for the literal operand, and 128, 192, 193 and 208 for the inline integer bounds. #3832 addedsrc/gfx1013_registers.hto keep the register code, operand and translator slot meanings apart. #3903, #3907, #3912 and #3915 convertedgfx1013_graphics_wqm.inl,gfx1013_sampled_pixel.cpp,gfx1013_vertex_id.cppandgfx1013_compute_clear.cpp.Change
This is the sixth slice. Both files are small, so they share one PR with one commit each. No behaviour change.
780298ed8replaces the nine== 255comparisons inprobe_instruction(src/gfx1013_isa.cpp, +7/-5) withoperand::literal. Each one compares an already extracted source field (VOP1/VOP2/VOPC, SOP1, SOPC, SOP2, VOP3/VOP3P) against the code that selects the trailing literal dword. The file is insidenamespace x2w::gfx1013, sooperand::needs no qualifier. The VOP3 line is wrapped because it became longer; its operands and evaluation order are unchanged.947377404names the literal and the inline integer bounds in thev_mov_b32source decode ofdecode_color(src/gfx1013_pixel.cpp, +6/-3):operand::literal,operand::zero..operand::int_pos_lastandoperand::int_neg_first..operand::int_neg_last.decode_coloris a file-static function outsidenamespace x2w, so the file addsnamespace gfx1013 = x2w::gfx1013;.constexpr unsignedwith the same values as the numbers they replace, so the decoded instruction sizes and the decoded colours are unchanged.& 255and& 511. They are bit masks, not operand codes.gfx1013_isa.cpp, the source codes233,234,249and250on the same line as the first literal comparison. The header has no constants for them, and adding some is out of scope here.gfx1013_pixel.cpp, the lines thattests/cmake/gfx1013_pixel.cmakeuses as mutation anchors:src >= 256 && vgpr[src - 256],dst = src - 128;,dst = 192u - src;and the float table. The test configuration stops if an anchor is no longer found, so these stay as they are.240..247float range. The header'soperand::float_lastis 248, so it is not a like-for-like replacement.string(REPLACE ...), five intests/cmake/gfx1013_isa.cmakeand five intests/cmake/gfx1013_pixel.cmake) target lines this change does not touch.gfx1013_registers.his header-only and already insrc.Validation
Built on Windows with MSVC, head
947377404onmaind2e6a4ed9. The targeted set passed:gfx1013_isa_alland thegfx1013_isa_*cases.gfx1013_pixel_alland thegfx1013_pixel_*cases.*_mut,WILL_FAIL) still fail as expected, so the anchors still apply:gfx1013_isa_mtbuf_bit3_mut,gfx1013_isa_mimg_nsa_mut,gfx1013_isa_vop3_fallback_mut,gfx1013_isa_vop2_madmk_mutandgfx1013_isa_flat_segment_mut;gfx1013_pixel_inline_int_mut,gfx1013_pixel_inline_neg_mut,gfx1013_pixel_inline_float_mut,gfx1013_pixel_vgpr_copy_mutandgfx1013_pixel_endpgm_trailing_mut.mesh57_integer_alu, which also compilesgfx1013_isa.cpp.native_translator_corpus_dxilandnative_translator_corpus_ir.Translator corpus: the TSV built from
maind2e6a4ed9and the TSV built from this branch have the same SHA-256, so they are byte-identical.Each replaced site was also read a second time against the header to confirm the same value and meaning, and that the pixel inline integer ranges are unchanged.
Other open PRs
No open PR edits
gfx1013_isa.cpporgfx1013_pixel.cpp. Thegfx1013_direct_*.inlfrontends are still edited by many open PRs, so they will follow once that work lands.@R0Y00 on GitHub · 2026-12-03 12:43 UTC · original · requested changes
The Linux check on
94737740fails two source-contract checks after the operand codes were renamed:tests/gfx1013_isa_meta_check.pystill expectssrc == 233 || src == 234 || src == 249 || src == 250 || src == 255.tests/gfx1013_pixel_meta_check.pystill expectssrc == 255.Please update the assertions to recognize the named codes while retaining coverage of their numeric values and the literal-operand decoding paths. Both scripts should pass on the revised head.
Linux check log
@Leyukaka on GitHub · 2026-12-03 13:19 UTC · original
Thank you for the review. Fixed in
409fa331, on top of94737740.tests/gfx1013_isa_meta_check.pyandtests/gfx1013_pixel_meta_check.pynow expect the named codes in their model anchors and contract lines.src/gfx1013_registers.hand asserts the values behind the names it relies on. That isliteral= 255 in both, and in the pixel check alsozero= 128,int_pos_last= 192,int_neg_first= 193 andint_neg_last= 208.ext_src255,vop3_literalandliteral_255mutations keep their control cases, and the test words still encode 255. The models, test cases and CMake mutation anchors are untouched.tests/gfx1013_compute_clear_meta_check.pyis fixed in the same commit. It has been broken onmainsince #3915: itsmbcnt_hi_srcanchor still expected the old256literal. I should have caught that in #3915, sorry. It now expectsgfx1013::operand::vgpr_baseand assertssgpr_count= 128,zero= 128 andvgpr_base= 256 from the header.Validation
gfx1013_compute_clear_meta_check.pypassed on Windows: 38 cases, 8/8 mutations killed.g++and were not run locally. The Linux job on this push is the check for them.@R0Y00 on GitHub · 2026-12-03 13:39 UTC · original · approved these changes
Re-reviewed
409fa331. The updated checks recognize the named operand codes and assert their exact original values. The decoding branches still exercise literal and inline immediates. In Ubuntu 22.04 with GCC, I ran all three scripts with python3 -B: gfx1013_isa_meta_check.py (81 cases, 13/13 mutations caught), gfx1013_pixel_meta_check.py (136 cases, 13/13), and gfx1013_compute_clear_meta_check.py (38 cases, 8/8). This addresses my Linux CI change request.