Repository navigation
Conversation
Support MUBUF sub-dword _d16 and _d16_hi loads while preserving the untouched 16-bit half of the destination VGPR, reading the next aligned dword when a 16-bit load crosses at byte 3 mod 4, refusing constant-buffer sub-dword reads, and adding hardware/WARP coverage. Co-authored-by: OpenBot <335604065+openbotgit[bot]@users.noreply.github.com>
catminou4
left a comment
There was a problem hiding this comment.
Tested locally: macOS arm64, rustc 1.98.1, PR head merged into main 940d32f, cargo test -p victory-shader --locked.
144 passed / 0 failed / 2 ignored. MUBUF sub-dword _d16/_d16_hi loads — extends the sub-dword load path; relates to the LDS sub-dword cluster (#632/#116/#101/#571/#996) but on the buffer side. Suite green.
|
Automated triage for the maintainers. Needs rebase. This PR no longer merges cleanly into Previous verdict for this head: merge candidate. Generated by Claude Code |
Offline measurement on a retail dumpResult: no count change against I merged head d9b823c onto No program changes its failure reason. The count shows that the change rejects nothing on this data. It does not show whether the output is right. No shader names or data are included, per the asset policy. AI-assisted (Claude Code). |
What's wrong
Following closed PR #1572 and the triage comment,
mainlowers the 32-bit-destination sub-dword MUBUF loads (buffer_load_ubyte,buffer_load_sbyte,buffer_load_ushort,buffer_load_sshort) and sub-dword stores, leaving the 6 untyped MUBUF sub-dword_d16and_d16_hiloads unsupported:buffer_load_ubyte_d16buffer_load_ubyte_d16_hibuffer_load_sbyte_d16buffer_load_sbyte_d16_hibuffer_load_short_d16buffer_load_short_d16_hiTwo sub-dword edge cases were also missing in
crates/victory-shader/src/emit/lower.rs:3 mod 4).ResourceType::Cbv) fell through to the dword CBV lowering path instead of failing cleanly.What the fix does
crates/victory-shader/src/emit/lower.rs(+111/-28):Lower::bufferto recognize the 6 untyped MUBUF_d16and_d16_hiload variants and record their bit width, signedness, and destination VGPR half (lowvshigh).inst.read(Reg::V(reg)), matching the existing LDS_d16/_d16_hilowering pattern (ir.rsalready records written vector destination dwords as reads).3 mod 4by fetching the next aligned dword under abegin_guarded/end_guardedbranch only for crossing lanes and merging its low byte before sign/zero extension."a sub-dword read of a constant buffer".crates/victory-shader/src/emit/valu_tests.rs(+62/-1):emit::valu_tests::d16_sub_dword_buffer_loads_preserve_the_other_half, encoding all 6 MUBUF_d16/_d16_hiopcodes (0x20..=0x25) across every byte offset in two adjacent dwords (4..=11for bytes,4..=10for halfwords including dword-crossing at byte7), verifying sign/zero extension and preservation of the untouched half of0xA5B6_C7D8on both hardware GPU and WARP.Branch
mubuf-d16-loads(commitd9b823conorigin/main42363ab):2 files changed, 145 insertions(+), 28 deletions(-).How it behaves after
Verified on Windows 11 with NVIDIA RTX 4070 + WARP (no changes to
victory-gpuorvictory-hle):cargo clippy --workspace --all-targets -j 4 -- -D warnings: passed (0 warnings, 0 errors).cargo test -p victory-shader -j 4: 244 passed; 3 failed; 3 ignored — new testemit::valu_tests::d16_sub_dword_buffer_loads_preserve_the_other_halfpassed on both hardware GPU and WARP (+1 passedover untouchedorigin/main42363ab's243 passed; 3 failed; 3 ignoredwith the exact same 3 pre-existing hardware failures:emit::stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride,emit::stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros,emit::synthetic_tests::gathers_at_a_level_match_the_hardware).cargo test --workspace --exclude victory-shader --no-fail-fast -j 4: all other workspace crates passed (victory: 10 unit + 2census,victory-core: 13,victory-formats: 38 passed / 5 ignored,victory-game: 15,victory-loader: 34 unit + 1crash_log+ 2load_probe+ 1title_dlls,victory-pe: 36,victory-pipeline: 7,xtask: 6,victory-hlefidelityfx: 1 +no_dll_planting: 1), with only the identical pre-existingorigin/main42363abfailures in untouchedvictory-gpu(139 passed; 2 failed; 2 ignored:descriptor::host::tests::dynamic_slots_are_held_until_released,memory::tests::lists_share_a_table_and_copies_keep_their_views) and untouchedvictory-hle(142 passed; 1 failed; 0 ignored:modules::lifecycle::tests::showing_a_title_window_shows_its_stand_in).cargo xtask policy: passed (asset policy: 182 files ok).