Shaders: descriptors chosen by uniform trees of joins and selects #2342
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!2342
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2342"
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?
@RomainKH on GitHub · 2026-11-25 11:08 UTC · original
RomainKH:shader/uniform-descriptor-trees→main· +414 −65 · 3 files · 3 commits · openRebased on current
main(67e8ae1) after the triage. #1012's recursive heap index is now onmain(59c78bb,54ab406), so its commit is gone from here. TheHEAP_VIEWS - 1clamp moved to its own PR, #2558. This branch is stacked on it: the first two commits are #2558's, the last is this PR's own. NEW-118 in #1633.On current
main, the offline census in #2045 has 1 program of this title refused witha descriptor chosen by control flow. So the shapes below unblock little here today; they are for programs that reach them, in this title or another.Change (last commit)
uniform_heap_index(nested joins of loads, #1012) also takes SCC selects, so either may hold the other: a select on an edge into a join, a join on an arm of a select.pending_descriptors, andfill_phisfills it once every predecessor has a tail. An edge no lane takes brings 0, as onmain.view_stridetakes the same trees. Onmaina structured read through a join is refused witha structured buffer of unknown stride.sampler_choices).main's one handle per join (850b66f): a join at the top still gets its handle made and kept at the join.Testing
Synthetic GFX10 programs in
emit/lower.rs:mainnested_uniform_phis_and_selects_choose_descriptors(a select inside nested joins; raw and structured read)a descriptor chosen by control flowa_descriptor_phi_at_a_loop_header_lowers_its_back_edge(raw and structured read)a descriptor chosen by control flowan_immediate_sampler_selected_by_scc_samples_with_botha descriptor chosen by a conditionview_strideleft as onmain, the structured variants fail witha structured buffer of unknown stride.dxil.dllthroughvalidate(#2558's first commit). WhereCIis set, a validator that does not load fails the test instead of skipping it. So this PR's green Windows CI run is the confirmation that the loop-header DXIL validates. Before, DenRakEiw had run the earlier head on Windows 11 with an RTX 5090 and WARP (26/26 lowering tests).cargo test -p victory-shader --locked --libgives 162 passed, 0 failed, 2 ignored. rustfmt reports nothing new on the changed lines.victory translate --validateon the title's files (I have none).AI-assisted (Claude Code).
🤖 Generated with Claude Code
@RomainKH on GitHub · 2026-11-25 14:26 UTC · original
A data point for whoever weighs this PR: the offline census posted in #2045 (
main940d32f+ #1936, the whole shader archive, officialdxil.dll) now has 1 program refused witha descriptor chosen by control flow. #1012's A/B had 40 before the recent merges. So on this title the shapes added here unblock at most a handful of programs today. Most of the value is theHEAP_VIEWS - 1clamp on theVIEW_STRIDESand view-address reads, and not refusing these shapes when other titles or compiler versions produce them.On macOS, this branch merges cleanly with #2324, #2388, #2046 and #2078 together, and
cargo test -p victory-shader --lockedpasses on the merge (158 passed, 0 failed). #1847 conflicts only on test functions added at the same spot at the end oflower.rs; keeping both sides resolves it.AI-assisted (Claude Code).
@Marvisak on GitHub · 2026-11-25 15:27 UTC · original · edited 2026-11-25 22:18 UTC
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-gpu/src/descriptor/host.rsandcrates/victory-shader/src/emit/lower.rs. It will be reviewed again once it is rebased onto currentmain.Previous verdict for this head: merge candidate.
Generated by Claude Code
@RomainKH on GitHub · 2026-11-25 16:00 UTC · original
Thanks for the triage. I've done the three things it asked for:
main(67e8ae1). #1012's recursive index is onmainnow (59c78bb,54ab406), so its commit is gone from here. The last commit is this PR's work, ported ontomain's one handle per join (850b66f).HEAP_VIEWS, so a clamped index could still read past it. #2558 sizes that buffer as the view-stride table already is. This PR is stacked on #2558 for now.CIis set anddxil.dlldoes not load, instead of skipping. This PR's run on278a49dis green, witha_descriptor_phi_at_a_loop_header_lowers_its_back_edgeand the other new tests passing onwindows-latest, so their DXIL validated. That helper also fixes three tests onmainthat called the Windows-only validator without acfgand no longer built on Linux or macOS.AI-assisted (Claude Code).
@Slay326 on GitHub · 2026-11-25 16:25 UTC · original · edited 2026-11-25 16:36 UTC
Correction (thanks, RomainKH): the strip fix comes from #1012's recursive heap index, which is on
mainsince54ab406. My base was940d32f, from before it landed, and this PR carried #1012 along. So this run credits #1012 /54ab406, not the shapes this PR adds on top.Hardware test on an RTX 3070 (it includes #1012). RTX 3070 (8 GB, 32-lane waves), Windows 11, Series X mode, 480 s runs into the world of Grand Theft Auto VI 1.0.2.1. Local test branch: main
940d32fplus #1906, #1890, #1883, #1962, #1779, #1763, #1762, a page-mark guard like #2167 and the memory PRs #2129, #2180, #1873, #1969, #2161.Before:
indirect_diffuse_lighting:CS_ScreenProbes_ActivateRays(39f0e9ae) did not translate ("a descriptor chosen by control flow"), and the screen-probe chain after it (CS_FinalGather,CS_ScreenProbes_TemporalResolve,sr_denoising:CS_BilateralBlur) ran without it; the bottom of the screen showed blocky pixel strips.With this PR (merged with #2366, #158, #2324, #2363, #2348, #1014): the program translates, and most of the blocky strips are gone; a few small blocks remain near the bottom edge. 480 s run, no device removal, world median 1.9 fps. Merge note on top of #1962: four conflicts in
lower.rs; I took this PR's descriptor trees and kept #1962's heap-use marks and the heap cap inbuffer_guard(clamp throughheap_views()).victory-shader270 passed, 0 failed.AI-assisted.
@RomainKH on GitHub · 2026-11-25 16:32 UTC · original
Thanks for the run. One correction so this PR doesn't get credit it hasn't earned:
CS_ScreenProbes_ActivateRays(39f0e9ae) is the program that #1012's recursive heap index lets through. That index is onmainsince54ab406, whose message names this program. Your base was940d32f, from before it landed. So on currentmainthe program should translate without this PR, and the fix for the strips belongs to #1012 /54ab406.What this PR adds on top of
mainis the shapes #1012 does not take: a select inside a join, a join at a loop header, a structured read through a join, and an SCC select of two immediate samplers. On currentmainthey cover about one program of this title, as the PR body says.On your merge note: if #1962's
heap_views()cap lands, #2558'sclamp_view_indexshould take the same cap asbuffer_guard. It shares the helper, so it is a one-line change there.AI-assisted (Claude Code).
@r4tedx on GitHub · 2026-11-26 07:07 UTC · original
Thanks for the rebase. The new head (
278a49df, on67e8ae1: the test helper, the clamps, the joins) covers what my earlier branch offered, plus the view-address buffer sized toHEAP_VIEWS, so please disregardshader/2342-on-1012. It conflicts with currentmain(842b0cb) in two files:lower.rs, test side only:mainaddeduses_lane_indexandhas_half_wave_masktoLoweredand twods_bpermutetests at the place where thevalidatehelper goes. Keeping both sides is enough.descriptor/host.rs:main's #1906 (2bba7921) sizes the view addresses to the title's slots plus the dynamic ones (address_slots). This PR sizes them to the larger of the title's count andHEAP_VIEWS. Both are needed, so the size isaddress_slots().max(HEAP_VIEWS). #1906's testview_addresses_cover_tables_made_afreshthen fails (address_at(end):Some(0)againstNone), because it asserts that the buffer ends right after the last dynamic slot. With this PR, the slots past it up toHEAP_VIEWSexist and read 0. The test needs to check that instead. In the copy below it does, in one extra commit of mine: the entries past the dynamic slots read 0 and are not written, and there is no entry pastHEAP_VIEWS. Its mark past the buffer's end is written only where the allocation has room. AtHEAP_VIEWS× 16 bytes (32 MiB) the buffer fills its allocation, so the old "room for the mark" assertion would fail.A rebased copy with both resolutions, your three commits under your authorship, plus that test change: r4tedx/VIctory
shader/2342-on-842b(b5d6cf7d). It is offered only as a reference for the conflict resolution.Census (
main842b0cb, 64-lane target): 24,850 → 24,850 validated, 0 lost, 0 gained. Onmainno program stops at "a descriptor chosen by control flow" or "a descriptor chosen by a condition". So on currentmainthe value of this PR is the clamps before the unboundedVIEW_STRIDESand view-address reads, plus the shapes for other titles and compiler versions. The new tests pass on Windows withdxil.dllpresent, so their DXIL is validated.Tests (WARP), on the rebased copy:
victory-shaderlib 301 passed, 4 failed, the same 4 that fail onmainon this machine's WARP.victory-gpudescriptortests: 22 passed, 0 failed, includingview_addresses_cover_tables_made_afreshas changed below. Clippy (victory-shaderandvictory-gpu, with and without--features diagnostics): clean.The unit tests are synthetic. Local title data was used offline for the census: a translation of the title's shader pack, with only counts and refusal reasons reported.
AI-assisted
View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.