Shaders: rebuild all descriptor slices of merged s_load_dwordx8/x16 loads #2044
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2046"
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 fuzeofficlal on 2026-11-25T04:06:16Z.
Summary
s_load_dwordx8ors_load_dwordx16load inLower::descriptor_data(crates/victory-shader/src/emit/lower.rs):main,descriptor_datastops at the firstuse_ofmatch and sets all other loaded dwords toVal::Missing, so any shader reading dimensions or record counts from a second slice of a mergeds_load_dwordx8/s_load_dwordx16(or across split reloads from the same base) fails lowering.load == site) with same-base reload slices (same_basewithdeltainside[0, 4 * count)), ranking image and indexed-buffer uses above raw/scalar buffer uses.0..spanregisters so an unread failing slice (such as a CBV) does not poison sibling SRV/UAV slices.dim == 3,!uav,kind = 5, GFX10TYPE = 11in dwords 1..3) alongside 1D/2D/3D/array views, while keepingmain's buffer dword 0..3 andNUM_RECORDSsemantics unchanged.Verification
emit::descriptor_tests::merged_loads_and_split_reloads_rebuild_all_buffer_slices(dxil.dllvalidated, hardware GPU + WARP): coverss_load_dwordx8multi-slice buffer rebuilding,s_load_dwordx16split same-base reloads, and unread buffer dword refusal.emit::descriptor_tests::merged_cube_and_2d_slices_sample_and_read_dimensions(dxil.dllvalidated, hardware GPU + WARP): covers mergeds_load_dwordx16with 4x4 cube (dim == 3) + 6x3 2D (dim == 1) slices and per-slice CBV refusal isolation.cargo clippy -p victory-shader --tests --locked -- -D warningsandcargo xtask policy: passed.Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-25T04:26:02Z.
Review: APPROVED
Tested locally: macOS arm64, rustc 1.98.1, PR head merged into main
940d32f69b,cargo test -p victory-shader --locked.145 passed / 0 failed / 2 ignored. Buffer descriptor stride bits, merged loads and 64-bit… (+1 test) — structured-buffer descriptor decoding completeness.
Imported from Marvisak/VIctory. Originally posted by jeremygold02 on 2026-11-25T04:09:19Z.
Triage verdict — Keep, cover split reloads and mixed descriptor slices (
8df2ae4)Evidence
Checks and limits
Next step
s_load_dwordx8pair with one distinct resource consumer per reload and a scalar read of the other slice’s record count. Also cover a merged 2D metadata read plus a cube handle used only for sampling. These cases check that recovery combines compatible evidence without imposing metadata restrictions on unrelated slices.This verification was AI-assisted.
Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-25T05:02:15Z.
Updated in
51eecad4— thanks @jeremygold02 for catching both cases:descriptor_datanow scans everyRole::Resourceslice whose load matchessiteor sharessame_base(a, b)with an offset inside[b.offset, b.offset + 4 * count), merging slices by relative dword offset andrankrather than stopping at the first reload.dim == 3,!uav) now map tokind = 5(TextureCube,TYPE = 11indwords 1..=3), and per-slice refusals (such as an unread CBV or unsupported image slice inside a mergeds_load_dwordx16) mark only that slice's span asVal::Missingso sibling slices still reconstruct.dxil.dll-validated testsmerged_reload_slices_supply_all_record_counts_and_strides_on_all_gpusandmerged_cube_and_2d_slices_sample_and_read_dimensions_on_all_gpus.Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T09:18:38Z.
Automated triage for the maintainers.
Needs work. It is close now.
On your reply:
b329b1fdoes narrow the PR to the merged-load part.Val::Bits/bits_op, the 64-bit select merge, the readfirstlane flag and the buffer stride/NUM_RECORDSchanges are all gone from the diff, andcrates/victory-shader/src/emit/lower.rsnow differs from main only indescriptor_data. I read the rewrite:Role::Resourceleaf loaded atsite, or from asame_baseload whose dword offset falls inside the loaded range, gives a slice. Image beats buffer beats SMEM viarank.Val::Missing(why).What is still missing is the evidence the earlier review asked for: that the title reaches these paths. The only measurement in the thread (sinan-cmyk, on the earlier and larger head) shows no change in
translate --validatecounts, and a validation count would not show whether the output changed anyway. Please give counts only, no shader names or data:s_load_dwordx8/x16where a slice other than the first used one is now rebuilt,If those programs exist, this is a reasonable merge. The two descriptor tests do check rebuilt values against the host view's dimensions on GPU and WARP, not just against what the code emits. CI: passing (
check).Generated by Claude Code
Imported from Marvisak/VIctory. Originally posted by sinan-cmyk on 2026-11-25T09:33:36Z.
Offline measurement on a retail dump
Result: no count change against
main.I merged head
51eecad4ontomain940d32f(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).
[PR #2046] Shaders: buffer descriptor stride bits, merged loads and 64-bit selectsto [PR #2046] Shaders: rebuild all descriptor slices of merged s_load_dwordx8/x16 loadsImported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-25T10:08:57Z.
Updated in
b329b1f9per triage feedback:Lower::descriptor_datarebuilding all consumed slices of mergeds_load_dwordx8/s_load_dwordx16loads, including across same-base reloads and sampled/sizeddim == 3cube slices, with per-slice refusal isolation).Val::Bits/bits_op, thev_readfirstlane_b32wave-ops flag change, the merged 64-bit select changes, and all buffer dword-1 stride /NUM_RECORDSchanges (main's buffer record-count behaviour is preserved unchanged).descriptor_tests.rsto the two focused GPU + WARP (dxil.dllvalidated) tests covering merged buffer slices, split reloads, mixed cube + 2D image slices, and per-slice CBV refusal isolation.Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-25T17:20:19Z.
Closing this PR: as noted in triage, confirming a measurable hit on real title shader corpora is needed before merging, and I only test with synthetic shaders locally.
Pull request closed