Shaders: a wave64 allocation idiom is taken in its barrier-free form when that has fewer group barriers (opt-in, no frame-time gain measured) #1182
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/fxceless--victory-fork!1182
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1182"
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?
@wildheathen on GitHub · 2026-11-25 23:03 UTC · original
wildheathen:idiom-first→main· +297 −3 · 3 files · 1 commits · openOn a host with 32-lane waves, the retry ladder for a stuck wave64 compute program keeps the first of "without early-outs" / "without skips" that translates, and returns. The exact local-waves form of the allocation idiom (
lower::wave_local) is only tried later, so a program that fits the idiom but also translates in one of those two forms never gets its barrier-free form.14264103296aa43ais such a program: 64-thread groups, a ballot, the first lane's atomic add of the count, each lane storing at base + its rank. It was kept in "without skips" with 33 group barriers and 681 instructions (340 on a 64-lane host).With
VICTORY_WAVE_IDIOM_FIRST=1, before one of those two forms is kept, the idiom forms the exact pass would try are emitted too, and one is kept instead only if it has fewer group barriers and no more instructions. Otherwise the ladder's choice stands, byte for byte. Off by default; the build script reads the name, so it is part of the translation fingerprint.This is a cleanup, not a speed-up. I expected the barriers to be what
14264103296aa43acosts on the card, and they are not: see "In game" below.Measured offline
victory translateover the title's 2,682 compute programs,VICTORY_HOST_WAVE=32, emitted DXIL compared byte for byte (VICTORY_EMIT_DUMP), on9c184b3:main--validate, dxil.dll 10.0.26100)14264103296aa43a: 33 → 1 barriers, 681 → 363 instructions.03e3e26783a5799b1,442 → 1,773 instructions,b96880482a17f6321,326 → 2,503). The instruction condition leaves them as they are.In game
RTX 5080 (driver wave 32/32), one world run of 8 minutes per build with the card's time by pipeline (
VICTORY_CARD_METER_PIPELINES=1), cold shader cache for the run with the switch:14264103296aa43a, µs per binding, by 256-frame windowdx.op.barriercall (dxc -dumpbin), against 33 in the earlier runs' entry.ca8829fplus local changes outside the shader crate; the compute translations are byte-identical betweenca8829fand9c184b3.What "exact" means here
Nothing new: it is the form
mainalready uses for the 27 programs that reach the idiom pass. Each 32-lane host wave reserves its own range with its own atomic, so the slots written and the final counter are the console's, and the order within a console wave is not.Checks
wave64_tests.rs(hand-written GFX10 words): an allocation program the ladder keeps with 7 barriers is kept with 1 under the switch, with the slots and the counter of the 64-lane result on the device; a program without the idiom form is left as it is; the choice between candidates.cargo test -p victory-shaderon the RTX 5080: 219 passed, 0 failed, 3 ignored. That run was before the instruction condition went in; after it I ran the suite on WARP only (VICTORY_WARP=1): 215 passed, 4 failed, and the 4 are tests that need the device (three stop at "compute_pipeline failed", one reads a 32-lane mask) and are not touched here.cargo clippy -p victory-shader --all-targets -- -D warnings: clean.cargo xtask policyfails onmaintoo since44bff61(diagnostics/timing-run-2026-11-25.txtis over the size limit); nothing from this PR.The branch is rebased on
6d20eed;mainhas no change incrates/victory-shaderbetween9c184b3, where the numbers above were taken, and there.Windows 11, RTX 5080. No game data included; programs are named by hash only.
@Dathinel on GitHub · 2026-11-25 23:20 UTC · original · edited 2026-11-25 23:38 UTC
Independent correctness check on RTX 3050 Laptop (native wave32), head
18b1a2f. I ran both translations of the PR's synthetic allocation fixture, with the option off and on, for every threshold from 0 through 64. The fixture's barrier count went from 7 to 1. All 130 hardware dispatches matched an independent CPU expectation for the counter, the set of allocated lane IDs, and the untouched tail of the 66-dword output. This includes the empty/full cases and both sides of the 32-lane boundary. Slot order was intentionally unconstrained.The host's local Series S baseline log records a successful bind for 14264103296aa43a before this change. This is a potential performance comparison, not a missing pipeline on this machine. No per-pipeline speedup measured on the 3050 in this test. AI-assisted.
Additional RTX 3050 Laptop 4 GB, Series S baseline (local tree fccb160). In the last two consecutive 256-frame windows, the meter attributed 2,420.4 and 2,375.0 microseconds per bind to 14264103296aa43a (2.42 and 2.37 ms/frame). Total attributed pipeline time was 124.9 and 122.9 ms/frame respectively. These are bind-to-next-bind intervals. Only the baseline was timed on this adapter, so this does not establish a performance delta for the PR.
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.