Repository navigation
gpu,shader: run multi-wave and globally coherent compute builders - #15
Merged
Merged
Conversation
Enable compute shaders that combine wave64 console-flow lowering with
workgroup barriers or lock-free cross-threadgroup UAV synchronization,
and lift the temporary dispatch drop for shaders reading a fifth root
constant.
Changes:
- Multi-wave console-flow lowering (victory-shader): allow console-flow
for multi-wave compute groups when every s_barrier sits in a uniform
block, allocate per-wave exchange slots in LDS, and skip redundant
exchange barriers inside divergent branch bodies.
- Global UAV coherence (victory-shader):
- Bind the raw UAV view (view + 1) instead of the read-only SRV for
UAV and globally coherent reads through title memory while keeping
dirty-page bitmap marking restricted to writes.
- Propagate DXIL IsGloballyCoherent (0x4000) on coherent (glc/dlc or
atomic) UAV handles and root UAV resource metadata.
- Retain s_waitcnt_vscnt in the IR and lower s_waitcnt_vscnt null, 0
(and buffer_gl0_inv/buffer_gl1_inv) to dx.op.barrier(2)
(UAVFenceGlobal / DeviceMemoryBarrier) in compute/mesh stages that
write UAVs, and include global_store/global_atomic in writes_uavs.
- Lift the temporary fifth-root-constant dispatch drop in
victory-gpu/src/draw.rs.
- Add unit and GPU tests covering multi-wave LDS barrier isolation and
cross-threadgroup lock-free handoff through a title-memory root UAV.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Enables compute shaders that use multi-wave console-flow lowering with barriers or lock-free cross-threadgroup UAV synchronization, and lifts the temporary fifth-root-constant dispatch drop so BVH builder dispatches execute instead of being dropped.
Changes
victory-shader)s_barrieris in a uniform block (multi_wave_safe_blocks), allocate per-wave LDS exchange slots, and omit redundant barriers inside divergent branch bodies.victory-shader)write) from UAV view selection (uav/coherent) in title-memory lowering so UAV andglc/dlcloads bind the raw UAV (view + 1) rather than the read-only SRV (view), preventing stale L1/SRV reads after writes in the same dispatch.IsGloballyCoherent(0x4000) on coherent (glc/dlc/atomic) UAV handles (buffer,flat,smem,raw_view,root_view) and root UAVdx.resourcesmetadata.s_waitcnt_vscntin the IR (ir.rs) and lowers_waitcnt_vscnt null, 0(plusbuffer_gl0_inv/buffer_gl1_inv) todx.op.barrier(2)(UAVFenceGlobal/DeviceMemoryBarrier) in compute/mesh shaders that write UAVs, and includeFields::Flatstores/atomics inwrites_uavs.victory-gpu)crates/victory-gpu/src/draw.rs.multi_wave_group_with_lds_barrier_and_readlane_keeps_waves_isolated(split_tests.rs)root_uav_title_memory_coherence_across_groups(memory_tests.rs, DXIL validation + hardware & WARP execution)Verification
cargo clippy -p victory-shader -p victory-gpu --all-targets -- -D warnings: cleancargo clippy -p victory --features diagnostics --all-targets -- -D warnings: cleancargo xtask policy: 186 files okcargo test -p victory-shader: 299 passed, 0 failedcargo test -p victory-gpu -- --test-threads=1: 188 passed, 0 failed