Shaders: index Lower value/descriptor uses and avoid quadratic BDD walks in structure #226
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Belobug--VIctory-Belobug-AMD!226
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-226"
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?
@zaixiakongyiji on GitHub · 2026-11-26 04:55 UTC · original
zaixiakongyiji:perf/shader-precompile→a-publier· +643 −197 · 2 files · 1 commits · openSummary
Rebases the shader translation speedups cleanly onto
a-publier(4eb6cfd, preservingf962387non-reusedgetDimensions,3920dc2VICTORY_PORT_CBVraw constant buffers,ad0f9ddLDS flag regions, and06fe22apartial_activemasks) with zero change to emitted DXIL /HostShaderbytes:crates/victory-shader/src/emit/lower.rs:value_uses), move def chains (move_defs), first resource use per descriptor load (load_use), address-grouped scalar loads (twin_loads), sampler load sites (sampler_loads),lane_copiedsites (lane_copied_sites), and integer-atomic counter table entries (counter_entries) once inLower::new/find_coherent, replacing repeated whole-program and whole-descriptor-list linear scans insidedescriptor_data,read_as_number,computed_with,sized_view,unused_descriptor_kind, andis_counter.crates/victory-shader/src/structure.rs:u64with full 64-bit avalanche finalization inFx::finish, makeBools::varssub-quadratic viaSeen, evaluateBools::impliesread-only with memoization instead of allocatingnot/andnodes, reuseforgetmemo maps inpaths, and replace per-variablegivenwalks with a persistent cons-list forced-literal cache (forced_id) shared across the shader plus fast-path guard reduction inLanes::finish.Benchmark & Equivalence
HostShader/ DXIL output across all 25,689 emitted title shaders (~40.6M IR instructions).--jobs 16(Ryzen 7 5800X):128.0s -> 70.8s(-44.7%;emitCPU1085.8s -> 382.9s,structureCPU690.0s -> 488.1s).--jobs 4(verified by @adrianmjim on RX 7900 XT):194.8s -> 118.2s(1.65xfaster;CS_ScreenProbes_ActivateRays5.47s -> 0.46s,0differences across all 25,689 programs under default,VICTORY_SHADER_OPT=0,VICTORY_HOST_MAX_WAVE=32, andVICTORY_HOST_RDNA=1).cargo clippy --workspace --all-targets [--all-features] --locked -- -D warnings, randomized ROBDD equivalence tests (vars_implies_and_given_match_reference), WARPsize_tests, and hardwarewave64_tests/ Port 5constants_rawtests.@adrianmjim on GitHub · 2026-11-26 19:54 UTC · original
Tested at base
81ebb7b.rx9070xthas since moved tocd8dfc0, which changes emit/lower.rs. The PR still merges into it without conflicts, but I have not re-run oncd8dfc0.Tested
e41cf0fagainst its baserx9070xt@81ebb7bon a different machine: RX 7900 XT, Windows 11, release builds,victory translate --validate --listover the whole shaders.rpf, dxil.dll 10.0.26100.Output, per program:
emitted <hash>from--listfor each program. That hash covers the wholeHostShaderDebug output (DXIL plus user data, samplers and root tables), not only the DXIL.VICTORY_SHADER_OPT=0(changes all 25,689 programs vs the default): 0 differences.VICTORY_HOST_MAX_WAVE=32(changes 362): 0 differences.VICTORY_HOST_RDNA=1(changes 23,734): 0 differences.Time,
--jobs 4, base and PR run alternately. Both binaries had the same small local per-program timing patch. Other jobs may have been running on the machine.Tests:
emit::size_tests::the_record_count_of_a_structured_buffer_read_by_indexpasses here on both base and PR (driver 32.0.32029.2010).cargo clippy -p victory-shader --lib --tests -- -D warnings: clean.I did not run the game, and I did not try
--jobs 16.e41cf0ff82to5791655f8b@zaixiakongyiji on GitHub · 2026-11-27 15:14 UTC · original
Thank you @adrianmjim for running the full 25,689-shader validation and timing across all four flag combinations!
Rebased cleanly onto
a-publier(4eb6cfd— preserving #324's non-reusedgetDimensions, Port 5'sVICTORY_PORT_CBV/constants_raw,ad0f9ddLDS flag regions, and06fe22apartial_activemasks), retargeted the base branch fromrx9070xttoa-publier, and fixed the escaped control characters in the commit message. Re-verifiedclippy --workspace --all-targets [--all-features] --locked -- -D warningsand thevictory-shadertest suite.@adrianmjim on GitHub · 2026-11-27 15:14 UTC · original
Thanks @zaixiakongyiji. Retargeting to
a-publieris the right call, since that's the line being developed now, and keeping #324'sgetDimensionsand the other a-publier changes through the rebase is what mattered. Nothing further from me.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.