Shaders: lane conditions along live phi edges are values, and each set is met once #2062
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!2062
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/2062/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?
@0xkn0wh3r3 on GitHub · 2026-11-25 04:18 UTC · original
0xkn0wh3r3:shader/live-edges-inline→main· +41 −11 · 1 files · 1 commits · merged 2026-11-25 21:54 UTCThe problem
Translating shaders with control flow spends time and allocations in one step that keeps repeating the same work.
Lower::live_edgeswalks every phi a lane reads, back through its incoming edges, carrying the last few branch conditions known along the path. Two costs:Vecfor those conditions, cloned for every edge and for the seen list.meet) whether some lane meets the conditions. Paths into one join ask again for the same sets.On a synthetic program of 256 blocks, 4,915 work items asked 3,047 times for 883 distinct sets.
The fix
Copyvalue (Known), not aVec.The walk and its answers are unchanged.
Measured with synthetic wave32 compute programs (divergent ifs, uniform loops, gathers) through
range::build,resource::track,io::raiseandemit_with, release build, two rounds each:emit_withon mainAllocations in
emit_withare down about 40%. The DXIL is byte-identical for every program (FNV hash of the output).Testing
cargo test -p victory-shader --lib -- --test-threads=1on an RTX 5070 Ti (driver 621.24): all pass exceptemit::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_zerosandemit::synthetic_tests::gathers_at_a_level_match_the_hardware. Those fail the same way onmainon NVIDIA (the test host's views, #1835; #1887 fixes two of them here).cargo clippy -p victory-shader --all-targets: clean.Related
#999 changes
meetitself and other parts oflower.rs. This change touches onlylive_edges.@sinan-cmyk on GitHub · 2026-11-25 09:22 UTC · original
Offline measurement on a retail dump
Result: no count change against
main.I merged head
a0163c26ontomain940d32f(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 09:25 UTC · original
Automated triage for the maintainers.
Merge candidate.
This is a performance-only change to
Lower::live_edgesincrates/victory-shader/src/emit/lower.rs. The list of known branch conditions becomes a fixedCopyarray (Known, at mostMAX_KNOWN) instead of aVec. The result ofBools::meetis also cached per condition set for the walk.I checked that it behaves the same as before:
Known::anddrops the oldest condition just as the olddraindid.lenalways keep their initial value, so the derivedEq/Hashmatch the oldVeccontents.meet(structure.rs) takes&selfand starts a fresh budget on each call, so caching its answer cannot change results.The author reports byte-identical DXIL and about 5–10% faster
emit_with. A separate offline run in the thread found no change in validation counts. No other open PR changeslive_edges.CI: not run (no check runs on this head). A maintainer may need to approve the workflow run.
Recommending a look, not approving.
Generated by Claude Code