Shaders: skip dead channel loads/conversions in format_load and vectorize memory_smem, table-CBV, and view_addresses loads #2209
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!2209
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/2209/head"
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?
@RVZO6 on GitHub · 2026-11-25 07:59 UTC · original
RVZO6:rvzo/format-smem-vec→main· +865 −38 · 1 files · 1 commits · closed without mergingIn
crates/victory-shader/src/emit/lower.rs:format_loadcurrently loads all dwords of a buffer format and converts every channel even when the instruction requests fewer channels (e.g.,tbuffer_load_format_x/_xy), discarding the unused results afterward.format_load,memory_smem, and the table-CBV path ofbuffer()emit one 1-dwordrawBufferLoad.f32per dword instead of vectorizing contiguous reads up to 4 dwords.view_addressesloads each descriptor's 64-bit address as two separate 4-byterawBufferLoad.f32calls instead of one 8-byte-aligned 2-dword load.Claimed on #1633 (
https://github.com/Marvisak/VIctory/issues/1633#issuecomment-7155420630).The change
crates/victory-shader/src/emit/lower.rs:Lower::raw_dwords(h, off, count)emitting vectorizeddx.op.rawBufferLoad.f32calls in chunks of up to 4 dwords (align = 4).format_load: slice format bit widths to the requested channel count, load onlyneed_bits.div_ceil(32)dwords (returning early whenneed_bits == 0) viaraw_dwords, and convert only the requested channels while preserving missing-channel(0, 0, 0, 1)fill andd16packing.raw_dwordsinmemory_smem(which already performs a singlememory()lookup for the whole access) and in the table-CBV path ofbuffer().(word 0, word 1)descriptor address pairs inview_addressesinto a single 8-byte-aligned 2-dwordrawBufferLoad.f32(mask = 3, align = 8).dxil.dllvalidation tests (format_load_skips_dead_channels_and_loads,table_cbv_buffer_load_vectorizes_to_single_raw_load,memory_smem_vectorizes_loads_into_four_dword_chunks,view_addresses_coalesces_consecutive_address_pairs) plus GPU/WARP execution testformat_load_xy_and_table_cbv_x4_execute_on_gpu.Not a duplicate of
No open PR or
CLAIMS.mdentry skips dead channels informat_load, vectorizesmemory_smem/ table-CBVrawBufferLoads, or coalescesview_addressespairs.Tested
windows-latestMSVC + Windows WARP SM 6.6 CI run45570823602(Clippyclean,Clippy, diagnostics buildclean,Tests:731 passed; 0 failed; 10 ignored,victory-shader:262 passed; 0 failed; 3 ignored,xtask:6 passed; 0 failed):format_load_skips_dead_channels_and_loads ... oktable_cbv_buffer_load_vectorizes_to_single_raw_load ... okmemory_smem_vectorizes_loads_into_four_dword_chunks ... okview_addresses_coalesces_consecutive_address_pairs ... okformat_load_xy_and_table_cbv_x4_execute_on_gpu ... ok(executed on Windows WARP SM 6.6)Not run: the title; any hardware GPU. The title was not used in these tests.
AI-assisted: T3 Code (Antigravity, gemini-4-neon)
@sinan-cmyk on GitHub · 2026-11-25 10:47 UTC · original
Offline measurement on a retail dump
Result: no count change against
main.I merged head
fa12c2cbontomain940d32f(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).
@Marvisak on GitHub · 2026-11-25 13:29 UTC · original · edited 2026-11-25 16:03 UTC
Automated triage for the maintainers.
This pull request no longer merges cleanly into
main(conflicts incrates/victory-shader/src/emit/lower.rs). It will be reviewed once it is rebased onto the currentmain. The earlier verdict (needs-work) was for an older state ofmain.Generated by Claude Code
@RVZO6 on GitHub · 2026-11-25 17:30 UTC · original
Closing to keep the queue clean:
286a00ealready drops unreadReadOnlyloads inbitcode.rs, and this PR bundled four changes + a large bitcode reader that now conflicts inlower.rs.Pull request closed