Shaders: emit UAV barrier fence for global flat stores and atomics #2802
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!2802
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2802"
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?
@fuzeofficlal on GitHub · 2026-11-25 20:58 UTC · original
fuzeofficlal:fix/shader-global-store-barrier-uav-fence→main· +183 −10 · 3 files · 1 commits · openWhat
Include
Fields::Flatinstructions whose name starts withglobal_and containsstoreoratomic(global_store_*,global_atomic_*) inLower::new'swrites_uavscheck (crates/victory-shader/src/emit/lower.rs:533-539), sos_barrieremitsdx.op.barrierwithUAV_FENCE(mode = 11 = 1 | 2 | 8) instead of TGSM-only (mode = 9 = 1 | 8).Why
global_store_*andglobal_atomic_*decode asFields::Flatand lower torawBufferStore/atomicBinOpUAV writes viaLower::flat_write. Previouslywrites_uavsonly checkedFields::ImageandFields::Buffer, so a compute shader that wrote UAVs exclusively throughglobal_store_*orglobal_atomic_*and synchronized across waves withs_barrieremitteddx.op.barrier(80, 9)without a UAV memory fence.Read-only
global_load_*and non-global flat forms remain excluded (mode = 9).Verification
cargo test --locked -p victory-shader --lib emit::lower::tests: 28 passed, 0 failed (including portableglobal_writes_add_a_uav_fence_to_barriersassertingmode = 11forglobal_store_dword/global_atomic_addandmode = 9forglobal_load_dword).cargo test --locked -p victory-shader --lib --features host emit::memory_tests::global_store_values_are_visible_across_waves_after_a_barrier(Windows 11, RTX 5090 + WARP + Windows SDK10.0.26100.0dxil.dll): passed (64-thread[64, 1, 1]cross-wavelane ^ 32store ->s_barrier-> load -> store verified on both hardware and WARP);VICTORY_WARP=1fullemit::memory_tests::: 5/5 passed.cargo clippy --locked -p victory-shader --all-targets -- -D warnings(default &--features host): 0 warnings.cargo xtask policy: 184 files ok.@oni-swr on GitHub · 2026-11-25 21:23 UTC · original
Independent WARP/CPU verification of head
cdd03309c395c7d73e8cecf606ea603ad1b24479, merged ontoorigin/main13f91caee25f2fdf2c062be5f7a27f058e51cbca(clean merge).Environment: Windows 11 Pro 26200, WARP only (
VICTORY_WARP=1, which also routes theHost::new(false)hardware passes to WARP, plusVICTORY_D3D12_WARP=1), Windows SDK 10.0.26100.0 x64dxil.dll1.8.2502.11 (VICTORY_DXIL).cargo test -j 4 -p victory-shader: 269 passed, 3 failed, 3 ignored. The baseline onorigin/mainwas 267/3/3, so there are 2 new passing tests.synthetic_tests::{a_mask_joined_with_data_at_a_uniform_loop_is_its_number, permutes_read_the_lane_named_and_zero_from_lanes_left_out}(no pipeline for a wave of 32) andgathers_at_a_level_match_the_hardware.global_store_values_are_visible_across_waves_after_a_barrierran on WARP (not skipped) and passed.Fields::Flat+global_arm out ofwrites_uavs.global_writes_add_a_uav_fence_to_barriersthen fails:global_store_dword,left: [Some(9)],right: [Some(11)].cargo clippy -p victory-shader --all-targets -- -D warningswas clean, with and without--all-features.cargo fmt --all --check: 891 hunks, the same as the baseline (no new hunks).Diff review: no blocking findings. The new arm matches how instructions are dispatched: non-global
Fields::Flatis refused as"flat memory", so leaving it out ofwrites_uavsis consistent. The||and&&grouping is right:(Image | Buffer | Flat && global_) && (store | atomic). Thewritten_callsiterator refactor keepsheap_handlesthe same through.count(). The test encodings are synthetic, with no data files.Not tested: physical GPU, retail title.
AI use: Claude Code (Claude Opus 5.5)
@Marvisak on GitHub · 2026-11-25 23:24 UTC · original
Automated triage for the maintainers.
In
Lower::new(crates/victory-shader/src/emit/lower.rs)writes_uavsnow also countsFields::Flatinstructions namedglobal_*that store or are atomic, sos_barriergets the UAV fence (dx.op.barriermode1 | 2 | 8) in programs that write only throughglobal_store_*/global_atomic_*, which do lower to UAV writes. I checked the operator grouping, that non-global flat forms are refused elsewhere so leaving them out is consistent, and that theModule::written_callsiterator change keepsheap_handlesthe same; the new unit test checks mode 11 for store and atomic and mode 9 for a load. CI (check) passes.This is a recommendation for a maintainer to look, not an approval.
Generated by Claude Code
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.