Lower GFX7 v_cvt_pkaccum_u8_f32 onto v_cvt_pk_u8_f32 #141
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/141"
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 omonkeyz/xbox-emulator. Originally posted by Yeetbot159 on 2026-11-22T15:16:46Z.
Summary
v_cvt_pkaccum_u8_f32is the two-source form ofv_cvt_pk_u8_f32. The integer source is repeated: its low two bits select the byte, and that byte of the same dword is replaced by the converted float.v_cvt_pk_u8_f32already does. Clamp, an output modifier, or abs/neg on the integer source is refused, because the packed byte would not match.Vop2Maparm, so this needs a rebase if that pull request merges first.Test plan
cargo test -p tombox-xshader --lib gcn::testspassed (20 tests).pkaccum_u8_updates_the_byte_selected_by_its_integer_sourcechecks the VOP2 form, the VOP3 form, and that a clamp modifier is an error.Imported from omonkeyz/xbox-emulator. Originally posted by omonkeyz on 2026-11-22T15:19:02Z.
Thanks! The lowering is close, but the accumulator is the wrong register.
v_cvt_pkaccum_u8_f32packs the converted byte into the existing destination (D keeps its other three bytes). In RDNA2v_cvt_pk_u8_f32, src2 is the value whose other bytes are kept, so src2 must be vdst, not the byte-select source. With[src0, vsrc1, vsrc1]the other bytes come from the selector register instead of D.Please change both the VOP2 and VOP3 paths to
[src0, src1, vdst]. Update the test to expectVgpr(1)as src2, and add an exec test that packs four bytes into one register in sequence.Also: #139 adds
psv_numthreadstoShaderExtract, so after it landstranslate_loweredhere will needpsv_numthreads: None.Imported from omonkeyz/xbox-emulator. Originally posted by Yeetbot159 on 2026-11-22T15:52:47Z.
Both the VOP2 and VOP3 paths now pass the destination as src2, so the other three bytes stay in D.
translate_loweredsetspsv_numthreads: None.pkaccum_u8_packs_four_bytes_into_one_registerpassed on WARP: 1.0, 2.0, 3.0 and 4.0 pack to0x04030201.Imported from omonkeyz/xbox-emulator. Originally posted by MiguelMatMar on 2026-11-22T16:03:35Z.
Independent hardware run:
pkaccum_u8_packs_four_bytes_into_one_registerpasses on WARP and on hardware (TOMBOX_EXEC_HW=1, NVIDIA Ada / RTX 40-series), PR headbf64545.opcodes,syntheticandgcn_dimsalso pass.Imported from omonkeyz/xbox-emulator. Originally posted by omonkeyz on 2026-11-22T16:11:01Z.
Applied in
fcb99ba(merged in1a1e283) with your authorship kept, thanks! I squashed both commits into one, and fixed a merge conflict with #140 in gcn.rs and exec.rs, keeping both lowerings and all tests.Pull request closed