Repository navigation
rdna2spirv: a compare or a lane mask into a VGPR or vcc_hi stores the -1/0 word (RT-5) - #9474
glitterfartz wants to merge 1 commit into
Conversation
… -1/0 word (RT-5) `v_cmp_*`/`v_cmp_class_*` (and the lane-mask writers: `v_cmpx`, `v_mbcnt`, `v_mad_u64_u32`'s sdst) refused a VGPR destination with `v_cmp destination` / `mask destination`, and `vcc_hi` with the same messages. A VGPR destination is the hardware's `v_cmp_* vN, ...` form: the comparison result per lane as -1/0, which is exactly the all-ones/zero word the translator already builds for the mask, so it stores that word (a 64-bit mask destination takes the pair at r and r+1). `vcc_hi` is the upper half of VCC: bits 32..63 of the wave mask in wave64 (`put_mask` keeps the low half) and the scratch SGPR a wave32 shader uses for a second live mask, so `OpStore %vcc_hi` follows the mask update. Counted over the 2,684 compute programs of 1.0.2.1's pipeline library (`tools/shader_library.py`), gfx1013 listings from the retail package: 1,773 of 2,684 translated and passed `spirv-val` before, 2,405 after (603 + 592 + 609 + 601 over four shards, every one `spirv-val` valid). The 606 `v_cmp destination` and 66 `mask destination` refusals are gone; the next bucket (`s_load_dwordx4 operands sgpr vcc`) grows 34 -> 73 because programs that used to stop at the compare now get that far. Four of the programs this unblocks are the ones the retail executable asks for through device slot 67 while booting (RT-5). Those four still refuse for the unrelated reason in the last hunk's comment (`CS thread-group-size SGPR`). Tests: tests/semantic/test_v_cmp_vgpr_destination.py (new: the four stores of v_cmp_lt_u32/v_cmp_eq_u32/v_cmp_lt_f32 into VGPRs on the interpreter in wave32 and wave64, a whole-wave v_cmp_eq_u32_e64 into a VGPR, and the wave64-emulated module translating) and tests/semantic/test_cmp_f64.py (the f64 VGPR destination moved from test_rejected_forms to test_vgpr_destination). python -I scripts/run_semantic_tests.py tests/semantic: 448 files, 5,961 tests, 2 files failed (test_image_atomics_guard, test_image_store_d16), both of which fail identically on origin/main without this change.
|
Tested
|
|
Review of The PR's own tests pass here: The The VGPR-destination half: I could not find that form in the ISA.
So with this LLVM, Suggestion: split the PR. Merge the Not tested: a GPU run (the form can't be assembled), and the full translator suite with this PR on my machine. AI-assisted (Claude Code). Every result above comes from real |
|
Tested
AI-assisted. |
|
Tested
I'd agree with splitting out the |
|
Tested
AI-assisted check (Claude Code); I reviewed the diff and the results. |
|
Tested
AI-assisted (Claude Code). |
|
checked: #9474ae34b15 | with: PR diff applied on main 5d74c27, |
|
Tested
No game files. AI-assisted (Claude Code). |
|
Full-corpus counts for this PR (head
So nothing regresses on the game corpus, and on the library's compute programs this clears every Why it matters for the boot: with a stack of open runtime PRs (listed in #7232), the retail executable under Wine 11.22 (AMD RX 9070 XT, RADV) gets to its pipeline-library compute pipelines (device slot 67). With the library translated by Counts only; no game data. AI-assisted (Claude Code), run and checked by me. |
|
Code review of The VGPR-destination half doesn't match what llvm-mc can produce for GFX10. A VOP3 VOPC's destination is the 8-bit SDST field, which can't name a VGPR. I assembled and disassembled every class of SDST byte for So The The added comment on |
Claimed in the coordination issue as: RT-5 (#7599)
What and why
v_cmp_*/v_cmp_class_*with a VGPR destination, andvcc_hias any mask destination, wereUnsupported(v_cmp destination/mask destination).v_cmp_* vN, ...form: it writes the comparison result per lane as -1/0, not a wave mask. That is the same all-ones/zero word the translator already builds for the mask, so it now stores it (store_reg("vgpr", r, …)); a 64-bit mask destination takes the pair atrandr + 1.vcc_hiis the upper half of VCC: bits 32..63 of the wave mask in wave64 (put_maskkeeps the low half) and the scratch SGPR a wave32 shader uses for a second live mask. It now does the mask update and thenOpStore %vcc_hi.Four of the programs this unblocks are the ones the retail executable asks for through device slot 67 while booting (RT-5): with the change, 632 more pipeline-library programs translate, and the boot's remaining
slot 67 … 0x80070057comes from theCS thread-group-size SGPRbucket alone, which the last hunk only documents (evidence for the packing in the comment; not fixed here).Tested
tools/shader_library.py, gfx1013 listings carved from the retail package), same command before and after (tools/rdna2spirv.py <work>/shaders/library/disasm --no-asm --shard i/4×4, then--merge): 1,773 of 2,684 translated and passedspirv-valbefore, 2,405 after (603 + 592 + 609 + 601, every onespirv-valvalid). The 606v_cmp destinationand 66mask destinationrefusals are gone; the next bucket (s_load_dwordx4 operands sgpr vcc) grows 34 → 73 because programs that used to stop at the compare now get that far.tests/semantic/test_v_cmp_vgpr_destination.py(new): the four stores ofv_cmp_lt_u32/v_cmp_eq_u32/v_cmp_lt_f32into VGPRs on the interpreter in wave32 and wave64, a whole-wavev_cmp_eq_u32_e64into a VGPR (s_bcnt1_i32_b32of its word must see all lanes set), and the wave64-emulated module translating.tests/semantic/test_cmp_f64.py: the f64 VGPR destination moved out oftest_rejected_formsintotest_vgpr_destination.python -I scripts/run_semantic_tests.py tests/semantic: 448 files, 5,961 tests, 2 files failed —test_image_atomics_guardandtest_image_store_d16, which fail identically onorigin/mainwithout this change (git stashbaseline, same 47 + 1 failures).AI-assisted: yes
Checklist
.codefile names of my own work folder are quoted; no bytes, no addresses.)docs/design.md, with how it was confirmed ("Compare into a VGPR orvcc_hi": corpus count over the pipeline library, plus the two test files).