GPU: order shader writes on command list pipeline syncs (#732) #1228
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!1228
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1228"
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?
@Ctrl-Alt-Haze on GitHub · 2026-11-24 16:35 UTC · original
Ctrl-Alt-Haze:fix/gpu-sync-uav-barrier→main· +368 −15 · 1 files · 2 commits · openSummary
Console command-list pipeline syncs (
LIST_FUNCTIONSslots 129/130 andNEWER_LIST_FUNCTIONSslots 131/132/146) previously resolved to an empty no-opsyncwith a comment stating that host lists order their own work and every submission is waited for. While submissions are waited for between command lists, D3D12 does not implicitly synchronize dependent UAV reads/writes between consecutiveDispatch/Drawcalls recorded within the same command list without an explicit UAV barrier (D3D12_RESOURCE_BARRIER_TYPE_UAV).This PR makes
syncemit a globalUAV_BARRIERvia the samewait_for_shader_writes(this)helper used bybarrier_groups(related to #732, though not yet measured in-world).Changes
crates/victory-gpu/src/list.rs:wait_for_shader_writes(this)shared bysyncandbarrier_groups, emittingUAV_BARRIERonhost_list(this)while safely no-oping whenthisis null,hostisNone, or on non-Windows targets.barrier_groupsandresource_barrierby not decoding undocumented consoleflags/controlbitfields without title measurements.list::tests::sync_is_safe_on_null_and_non_host_lists(verifiesLIST_FUNCTIONSslots 129/130,NEWER_LIST_FUNCTIONSslots 131/132/146, nullthis, andhost: Nonelists).list::tests::sync_orders_dependent_compute_uav_dispatches(live D3D12cs_5_14-stage dependent compute dispatches throughsync/barrier_groupsunder the D3D12 Debug Layer — verifies API validity, slot wiring, and end-to-end correctness; does not force hardware overlap on drivers that serialize compute work by default).Verification
VICTORY_D3D12_WARP=1), D3D12 Debug Layer (VICTORY_D3D12_DEBUG=1), rebased ontoupstream/main(940d32f) at42b6c9e(1d05911,42b6c9e,0behind /2ahead).cargo xtask policy: passed (182 files ok)cargo clippy --workspace --all-targets --locked -- -D warnings(default &--all-features): passedcargo test --workspace --exclude victory-gpu --exclude victory-shader --locked -- --test-threads=1: all passed (victory12 [10 unit + 2census],victory-core13,victory-formats38 / 5 ignored,victory-game15,victory-hle145 [143 unit + 1fidelityfx+ 1no_dll_planting],victory-loader38 [34 unit + 1crash_log+ 2load_probe+ 1title_dlls],victory-pe36,victory-pipeline7,xtask6)cargo test -p victory-gpu --locked -- --test-threads=1(RTX 5070 Ti):143 passed; 2 failed; 2 ignored(pre-existing940d32ffailures:descriptor::host::tests::dynamic_slots_are_held_until_released,memory::tests::lists_share_a_table_and_copies_keep_their_views)VICTORY_D3D12_DEBUG=1 cargo test -p victory-gpu --features diagnostics --locked -- --test-threads=1(RTX 5070 Ti):146 passed; 2 failed; 2 ignored(same 2 pre-existing failures;resolve_queries_rejects_overflowing_offset,sync_is_safe_on_null_and_non_host_lists,sync_orders_dependent_compute_uav_dispatchespassed)VICTORY_D3D12_DEBUG=1 VICTORY_D3D12_WARP=1 cargo test -p victory-gpu --features diagnostics --locked -- --test-threads=1:148 passed; 0 failed; 2 ignoredcargo test -p victory-shader --features host --locked -- --test-threads=1(RTX 5070 Ti):244 passed; 3 failed; 3 ignored(pre-existing940d32ffailures:stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride,stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros,synthetic_tests::gathers_at_a_level_match_the_hardware)AI use: Written and rebased locally with AI assistance, independently audited and verified on RTX 5070 Ti + WARP.
@Zipettte on GitHub · 2026-11-24 17:59 UTC · original
Tested on AMD Radeon RX 7700 XT (RDNA3, gfx1101), driver 32.0.32029.2010, Windows 11, Rust 1.98.1 MSVC at 038503c:
cargo test -p victory-gpupasses, 52 passed / 0 failed. Workspace baseline on main (ffe310e) is green on the same machine (342 passed).Tested with AI assistance (Claude).
@neonbyte1 on GitHub · 2026-11-24 18:12 UTC · original
On Linux under Wine (vkd3d-proton, RTX 5090) the new
sync_orders_dependent_compute_uav_dispatchestest cannot build its shader. Wine'sd3dcompiler_47is vkd3d-shader, and it rejectsRWByteAddressBuffer.Load:#346 hit the same limit. It reads and writes
RWStructuredBuffer<uint>and serializes its root signature in code instead of using[RootSignature(...)], and its compute tests then pass under Wine. The same change here would let this test run on Linux, which #1218'scargo xtask wine-testis meant to cover.A stacking note: #190 removes
Win32_Graphics_Direct3D_Fxcfromvictory-gpu'swindowsfeatures because nothing on that branch used it any more. With both merged, theD3DCompileimport here does not resolve until the feature is added back.Locally I skip the test when Wine is detected (
wine_get_versionin ntdll). With that, the full workspace passes under Wine: 395 passed, 0 failed, 6 ignored.AI-assisted (Claude).
@Ctrl-Alt-Haze on GitHub · 2026-11-24 18:28 UTC · original
@neonbyte1 Thank you for catching that
vkd3d-shadercompatibility gap under Wine!Updated
sync_orders_dependent_compute_uav_dispatchesin63e6c9eto:RWByteAddressBuffer(.Load/.Store) withRWStructuredBuffer<uint>indexing (buf_a[idx]/buf_b[idx]).[RootSignature(...)]from the HLSL source and serialize the 3-parameter root signature (b02x32-bit constants,u0UAV,u1UAV) viaD3D12SerializeRootSignature(D3D_ROOT_SIGNATURE_VERSION_1_0).(Good catch on the
#190stacking note regardingWin32_Graphics_Direct3D_Fxcas well —Fxcis already enabled incrates/victory-gpu/Cargo.tomlonmain, so if#190lands first this test will just need that feature kept ordxcompiler.)@Zipettte Thanks for verifying
038503con the RX 7700 XT as well!Re-verified on
63e6c9e:cargo xtask policy:154 files okcargo clippy --workspace --all-targets --locked -- -D warnings(default &--all-features): passcargo test --workspace --locked:344 passed, 0 failed, 6 ignoredVICTORY_D3D12_DEBUG=1 cargo test -p victory-gpu --features diagnostics --locked(RTX 5070 Ti &VICTORY_D3D12_WARP=1):55 passed, 0 failed, 1 ignoredeach (0 D3D12 debug errors)@Ctrl-Alt-Haze on GitHub · 2026-11-25 00:22 UTC · original
Rebased onto upstream
main(ce2d91f) at5a1556e(5215b2e,5a1556e), resolving thecrates/victory-gpu/src/list.rstest-module conflict cleanly while preservingresolve_queries_rejects_overflowing_offset.Re-verified locally on
5a1556e(Windows 11 x64 / NVIDIA GeForce RTX 5070 Ti + WARP):cargo xtask policy: passed (178 files ok)cargo clippy --workspace --all-targets --locked -- -D warnings(default &--all-features): passedcargo test --workspace --exclude victory-gpu --exclude victory-shader --locked -- --test-threads=1: all passed (victory12 [10 unit + 2census],victory-core11,victory-formats23 / 4 ignored,victory-game15,victory-hle126 [124 unit + 1fidelityfx+ 1no_dll_planting],victory-loader26 [22 unit + 1crash_log+ 2load_probe+ 1title_dlls],victory-pe10,victory-pipeline4,xtask6)cargo test -p victory-gpu --locked -- --test-threads=1(RTX 5070 Ti):88 passed; 2 failed; 1 ignored(only the 2 pre-existing70564ae/ce2d91ffailures:descriptor::host::tests::dynamic_slots_are_held_until_released,memory::tests::lists_share_a_table_and_copies_keep_their_views)VICTORY_D3D12_DEBUG=1 cargo test -p victory-gpu --features diagnostics --locked -- --test-threads=1(RTX 5070 Ti):91 passed; 2 failed; 1 ignored(same 2 pre-existing failures;resolve_queries_rejects_overflowing_offset,sync_is_safe_on_null_and_non_host_lists, andsync_orders_dependent_compute_uav_dispatchesall passed)VICTORY_D3D12_DEBUG=1 VICTORY_D3D12_WARP=1 cargo test -p victory-gpu --features diagnostics --locked -- --test-threads=1:93 passed; 0 failed; 1 ignoredcargo test -p victory-shader --features host --locked -- --test-threads=1(RTX 5070 Ti):206 passed; 3 failed; 2 ignored(pre-existing70564ae/ce2d91ffailures:stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride,stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros,synthetic_tests::gathers_at_a_level_match_the_hardware)@Marvisak on GitHub · 2026-11-25 01:26 UTC · original · edited 2026-11-25 16:02 UTC
Automated triage for the maintainers.
This pull request no longer merges cleanly into
main(conflicts incrates/victory-gpu/src/list.rs). It will be reviewed once it is rebased onto the currentmain. The earlier verdict (merge-candidate) was for an older state ofmain.Generated by Claude Code
@Ctrl-Alt-Haze on GitHub · 2026-11-25 01:48 UTC · original
Thanks for the review and clear feedback. Addressed both items and updated the PR description at
42b6c9e:Rebase onto current
upstream/main(940d32f):940d32fwith only the 2 PR commits remaining (1d05911,42b6c9e;git rev-list --left-right --count upstream/main...HEADis0 2, no merge commits carried).42b6c9e(Windows 11 x64 / RTX 5070 Ti + WARP):cargo xtask policy: passed (182 files ok)cargo clippy --workspace --all-targets --locked -- -D warnings(default &--all-features): passed--locked -- --test-threads=1): all passed (victory12,victory-core13,victory-formats38 / 5 ignored,victory-game15,victory-hle145,victory-loader38,victory-pe36,victory-pipeline7,xtask6)cargo test -p victory-gpu --locked -- --test-threads=1:143 passed; 2 failed; 2 ignored(pre-existing940d32ffailures:descriptor::host::tests::dynamic_slots_are_held_until_released,memory::tests::lists_share_a_table_and_copies_keep_their_views)VICTORY_D3D12_DEBUG=1 cargo test -p victory-gpu --features diagnostics --locked -- --test-threads=1:146 passed; 2 failed; 2 ignored(same 2 pre-existing failures; all 3list::tests::{resolve_queries_rejects_overflowing_offset, sync_is_safe_on_null_and_non_host_lists, sync_orders_dependent_compute_uav_dispatches}passed with 0 D3D12 debug errors)VICTORY_D3D12_DEBUG=1 VICTORY_D3D12_WARP=1 cargo test -p victory-gpu --features diagnostics --locked -- --test-threads=1:148 passed; 0 failed; 2 ignoredcargo test -p victory-shader --features host --locked -- --test-threads=1:244 passed; 3 failed; 3 ignored(same 3 pre-existing RTX 5070 Ti940d32ffailures)Evidence &
flags/control:flags/controlaren't decoded here: Underdocs/asset-policy.md,list.rsavoids baking in unverified console register/cache-flush bitfields; this follows the same pattern already used bybarrier_groups(which emitsUAV_BARRIERwhenevercount > 0without decoding_groups) andresource_barrier(which emits a globalUAV_BARRIERfor buffer barriers).Dispatch/Drawcalls accessing the same UAV in a single list require an explicitD3D12_RESOURCE_BARRIER_TYPE_UAVbarrier under D3D12 rules.#732impact, and noted thatsync_orders_dependent_compute_uav_dispatcheschecks API validity and slot routing rather than forcing overlap on drivers that serialize dispatches by default. Happy to add adiagnosticshit counter or narrow on specificflags/controlbits if someone running an in-world capture observes unwanted barrier overhead.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.