Repository navigation
Conversation
…fuses for gfx1030 (a VALU destination is a VGPR)
…ne, v_readfirstlane and the compares excepted)
… readfirstlane, compares, carry and 64-bit forms still translate
Grimkaaah
left a comment
There was a problem hiding this comment.
Independent Linux CPU review
What changed: VALU destinations must be VGPRs (Unsupported otherwise), except v_cmp* / v_readlane / v_readfirstlane. New test_valu_dst_vgpr; div_fixup fixture drops invalid null dest.
Checked: tests/semantic/test_valu_dst_vgpr.py — 4 passed; test_alu_div_fixup_f32.py adjusted.
Looks correct; no game files.
|
Tested A/B on one build, only
Per-test lists identical; no translation refusals in the PR run, so none of the checked-in fixtures writes an SGPR destination with an op this now refuses. The one failure both ways is the known |
…corpus count and the llvm-mc evidence
…ination (299,759 corpus uses, none has one)
|
(Vonsek2) Thanks for the reviews and the RTX 3070 A/B. Two additions since then, both on this branch (5 commits now): the |
|
Windows check of (Note for anyone reproducing: these files Both files pass on Windows; I did not run the rest of |
|
Tested
No GPU, no game data. AI-assisted. |
|
Tested
No game files. AI-assisted (Claude Code). |
|
Tested f922561 on Windows 11 (NTFS), Python 3.12.10 (CPU only, no GPU, no game files): pass The GPU A/B above predates commits 4 and 5. This run is on the final head, CPU side only. What I ran:
Valid forms still translate. I took every Hand-written listings through the whole
Nit, not blocking: the new Overlap:
AI-assisted (Claude Code). |
EGEN-VALU-DST-CHECK (Vonsek2), claim.
What and why
A VALU instruction's destination field is a VGPR number, so
v_add_f32 s8, v1, v2cannot be encoded.Gen._insnaccepted it for 212 of the 251 VALU opcodes inrdna2_isa_tablesand translated it as a VGPR write, to a register the listing never named. It now raisesUnsupportedfor anyv_*instruction whose first operand is not a VGPR, in one place at the top of_insn. Three families keep a scalar destination by design and are excepted:v_readlane_b32,v_readfirstlane_b32(an SGPR) and thev_cmp/v_cmpxcompares (an SGPR pair, VCC or EXEC).v_add_co_u32,v_div_scaleandv_mad_u64_u32have a VGPR first operand and a scalar second one, so they are unaffected.This is the single check for the class of silent miscompile that two claims on the board narrow op by op (64-bit shifts, eight 32-bit int ops). Their per-op operand and modifier work is theirs and untouched here.
Commits
test_alu_div_fixup_f32: drops one case,v_div_fixup_f32 null, ....llvm-mc -mcpu=gfx1030answersinvalid operand for instructionfornullas the destination ofv_div_fixup_f32and ofv_add_f32(it only accepts it forv_cmpandv_readlane), so the case tested an instruction that does not exist. It passes before and after.tests/semantic/test_valu_dst_vgpr.py.Test
python -I -m unittest discover -s tests/semantic -p test_valu_dst_vgpr.py(4 tests, 2.7 s):main867d922: 3 failures; all but a handful of the 251 ops areacceptedandvcc_lo/exec_loare accepted as destinations;op s8, v1, v2, v3to a freshGen, requiresUnsupportedmentioning VGPR, and checks thatreadlane,readfirstlane, the compares, a carry form,v_lshlrev_b64andv_mad_u64_u32still translate.Whole
tests/semanticthroughscripts/run_semantic_tests.py: the only failures are intest_image_atomics_guardandtest_image_store_d16, which fail on unmodifiedmaintoo (stale after #4473 and #6805; #7284, #7608 and #7916 fix them). After commit 1,test_alu_div_fixup_f32passes.Corpus, my own 1.0.2.1 copy, counts only: of the 29,288,954 VALU instructions in the 26,503 listings, none has a scalar first operand other than the
v_cmp/v_cmpxfamily andv_readfirstlane_b32; and--shard 5/64(415 listings) translates and passesspirv-valin full (415 of 415).No GPU needed.
Notes
v_cos_f32 s8, v1, v2, v3is refused for its destination first. Operand-count validation is a separate gap (the translator also takes surplus operands) and I did not change it.nullas a destination is refused as well; see commit 1 for why that is the right call.AI-assisted.