perf(shader): per-barrier UAV fence elision, aligned 16-bit buffer fast path, and exact integer peepholes #29
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/vix0e0e--VIctory-LITE!29
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-29"
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?
@jarvixaiassistant-glitch on GitHub · 2026-11-30 15:09 UTC · original
jarvixaiassistant-glitch:perf/shader-barrier-uav-aligned16-peepholes→main· +535 −9 · 3 files · 1 commits · openSummary
Three self-contained, exact
victory-shadercompiler optimizations (zero floating-point behavior changes, zero runtime coupling, minimal diff inlower.rs):Per-barrier UAV memory-fence reachability (
emit/barrier_uav.rs)s_barrieremitteddx.op.barrierbit2(UAVMemoryFence) on everys_barrierwhenever whole-shaderwrites_uavswas true.barrier_needs_uav_fence) computing the exact(block, inst)s_barriersites reachable from any UAV store/atomic (Image/Buffer/Smemstore/atomic,global_*non-load,flat_*store/atomic) without crossing an intervening emitteds_barrier.1 | 8(GroupSync | TGSMFence) instead of1 | 2 | 8, while preserving bit2across loops, branch joins, and suppressedno_barrierblocks.Single-dword fast path for 2-byte aligned 16-bit buffer loads/stores (
lower.rs,bitcode/opt.rs)Module::maybe_set(v, depth)conservative known-bits analysis (preserving guaranteed trailing zero bits throughAdd,Sub, andMuleven across modular wrap-around, e.g.(idx << 1) + 4,(idx * 6) + 2).bits == 16andmaybe_set(byte, 6) & 1 == 0,within = byte & 3is guaranteed0or2(never3), so a 16-bit access cannot straddle a 4-byte boundary:buffer_load_ushort/sshortomits the secondrawBufferLoad+ select, andbuffer_store_shortomits the second guardedatomicBinOppair.Exact bit-level unpack-of-pack & equality-compare peepholes (
bitcode/opt.rs)maybe_set: drops dead sides of(x | y)/(x ^ y)underAnd,LShr,Shl, andTrunc(e.g.((x & 0xFFFF) | (y << 16)) & 0xFFFF -> x & 0xFFFF,>> 16 -> y & 0xFFFF,trunc(x | (y << 16), i16) -> trunc(x, i16)).Cmp(EQ|NE)folding overXor/Sub/Add:(x ^ y) ==/!= 0 -> x ==/!= y,(x - y) ==/!= 0 -> x ==/!= y,(x ^ k1) ==/!= k2 -> x ==/!= (k1 ^ k2),(x + k1) ==/!= k2 -> x ==/!= (k2 - k1).Verification (Windows 11,
VICTORY_WARP=1)cargo clippy -p victory-shader --lib: 0 warnings.VICTORY_WARP=1 cargo test -p victory-shader --lib -- barrier_uav maybe_set_alignment_and_unpack_cmp_peepholes opt::tests: 16/16 passed (including all 4barrier_uavCFG unit tests,maybe_set_alignment_and_unpack_cmp_peepholes, andevery_pass_leaves_what_random_programs_storerandomized parity fuzzing).GPL-3.0-or-later, zero game data / zero RVAs.AI-assisted: yesView 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.