Shaders: lower unlisted table constant buffer loads as guarded raw SRVs #2068
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!2068
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/2068/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?
@fuzeofficlal on GitHub · 2026-11-25 04:20 UTC · original
fuzeofficlal:fix/shader-dynamic-heap-cbv-slot0-1595→main· +511 −38 · 4 files · 1 commits · closed without mergingCloses #1595.
Summary
s_buffer_load_dword*) fromRootType::Tabledescriptors with no matchingUsedResourceentry (kind.is_none()) as guarded raw buffer SRVs(11, 0)instead ofcbufferLoadLegacyCBV handles(13, 0x1_0000).heap_constants, unlisted-tableself.heaptracking, andLower::buffer_guardstrictly to descriptors whose leaves are all tracked loads fromRootType::ResourceHeaporRootType::Table(is_view_heap/is_unlisted_table), leavingSource::Constant,Source::Built, other root parameters, andVIEW_STRIDESbuffer-vs-non-buffer (stride == 0) semantics unchanged.Verification
emit::stride_tests::an_unlisted_table_constant_load_reads_as_a_raw_buffer: tests unlistedRootType::Tables_buffer_load_dwordagainstView::NullTexture1d(slot 0 -> 0),View::Texture(slot 1 -> 0), andView::Buffer(slot 2 -> 9) across NVIDIA GeForce RTX 5090, AMD Radeon(TM) Graphics, and D3D12 WARP.emit::stride_tests::unlisted_table_constant_lowering_rejects_non_heap_sources: verifiesSource::Constant,RootType::Constants, and mixedTable+Constantphis remain rejected while pureTablephis lower and validate viadxil.dll.cargo clippy -p victory-shader --tests --locked -- -D warningsandcargo xtask policy: passed.@jeremygold02 on GitHub · 2026-11-25 04:27 UTC · original
Triage verdict — Keep the descriptor-kind fixes, leave #1595 open for typed-null coverage (
cba3f26)Evidence
Checks and limits
Next step
This verification was AI-assisted.
@fuzeofficlal on GitHub · 2026-11-25 05:10 UTC · original
Thanks @jeremygold02 — pushed
421de01caddressing all three points:#2030texture D16 rounding tags: movedVIEW_STRIDE_UAVdown to1 << 28(VIEW_BUFFER_STRIDE_MASK = (1 << 28) - 1), leaving bits29..=31untouched for texture metadata while covering the 14-bit GFX10 buffer stride range (0..=16383).RootType::Tablebuffer handles: whenself.used_kind(src).is_none(),buffer_guardandself.heap[0] = truenow run alongside the dynamic-heap path so unlisted table constant loads get the exact SRV byte-length guard and refresh the stride table.View::NullTexture1dat heap slot0alongside normalized texture tag bits (0xC000_0000/0xE000_0000) and SRV vs. UAV stride separation.@sinan-cmyk on GitHub · 2026-11-25 09:18 UTC · original
Offline measurement on a retail dump
Result: no count change against
main.I merged head 421de01c onto
main940d32f(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 10:25 UTC · original · edited 2026-11-25 16:17 UTC
Automated triage for the maintainers.
Recommended for a look (merge candidate). After the rebase, scalar buffer loads whose descriptor comes from a table slot with no used-resource entry are lowered as raw buffer SRV reads, guarded through the view-stride table, instead of
cbufferLoadLegacy(Lowerincrates/victory-shader/src/emit/lower.rs:heap_constants,buffer_guard, and the newis_view_heap/is_unlisted_table). Such reads also mark the program as heap-reading. I checked that the new predicate only accepts descriptors whose leaves are all loads fromResourceHeap/Tableparameters, so constants, built descriptors and mixed phis keep the old path (the newunlisted_table_constant_lowering_rejects_non_heap_sourcestest covers this).View::NullTexture1dinemit/host.rsis used only by the test fixture. This head no longer contains the polarity and bit-31 changes discussed above, and #1595 supplies the behaviour being fixed. A retail offline run reported no change in validated programs. CI:checkpassing on this head.Generated by Claude Code
@fuzeofficlal on GitHub · 2026-11-25 11:02 UTC · original
Updated in
7c8c0f7dper triage feedback:VIEW_STRIDE_UAV/Lower::buffer_guardSRV-vs-UAV polarity changes (crates/victory-gpu/src/descriptor/host.rsandshader.rsare untouched relative tomain, andbuffer_guardonly redirectsstride == 0non-buffer slots as onmain).smem'sheap_constantsexpansion and unlisted-tableself.heap/buffer_guardhandling strictly to descriptors whose leaves are all tracked loads fromRootType::ResourceHeaporRootType::Table(is_view_heap/is_unlisted_table), addingunlisted_table_constant_lowering_rejects_non_heap_sourcesto lock outConstant,RootType::Constants, and mixedTable+Constantphis.#2030's normalized-format tag encoding.@Marvisak on GitHub · 2026-11-25 22:05 UTC · original
Automated triage for the maintainers, second look (a review against current
main, with builds and tests where they could change the verdict).Closing because the issue it closes, #1595, is fixed in
mainat the source: heap-direct constant data is read through raw views (c75fdba3), and a zero view-stride entry selects a null buffer view (d71c3889). What this adds is the case of a table descriptor that no used-resource entry covers, and no title program has one (a whole-set run onmainreports "0 traced parameters not listed"). The tests also add their own adapter enumeration and a newVICTORY_WARPswitch beside the existingHost::new(warp).If this is mistaken, reply here with what was missed and it will be looked at again. Thank you for the contribution.
Pull request closed