Shaders: MUBUF sub-dword _d16 and _d16_hi loads #2001
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2003"
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 Marvisak/VIctory. Originally posted by iurysf on 2026-11-25T02:41:38Z.
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).Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-25T02:56:53Z.
Review: APPROVED
Tested locally: macOS arm64, rustc 1.98.1, PR head merged into main
940d32f69b,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.
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T09:17:20Z.
Automated triage for the maintainers.
Needs rebase. This PR no longer merges cleanly into
main:mainhas moved since the last triage, and the branch now conflicts incrates/victory-shader/src/emit/valu_tests.rs. It will be reviewed again once it is rebased onto currentmain.Previous verdict for this head: merge candidate.
Generated by Claude Code
Imported from Marvisak/VIctory. Originally posted by sinan-cmyk on 2026-11-25T09:59:36Z.
Offline measurement on a retail dump
Result: no count change against
main.I merged head
d9b823c3ontomain940d32f(clean merge) and ranvictory translate --validate --listonshaders.rpf(1.0.2.1), with dxil.dll 1.8.2502.11. I compared the result withmainprogram by program (25,889 programs). Validated: 23,918 onmain, 23,918 with this PR.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).
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.