GPU: implement SetPredication, SetMarker, BeginEvent, and EndEvent on command lists #859
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#859
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
@geiyiliyabumo on GitHub · 2026-11-24 12:48 UTC · original
Summary
Implements 4 missing standard
ID3D12GraphicsCommandListvtable slots incrates/victory-gpu/src/list.rsacross bothLIST_FUNCTIONSandNEWER_LIST_FUNCTIONS:31(0xf8):SetPredication56(0x1c0):SetMarker57(0x1c8):BeginEvent58(0x1d0):EndEventBecause external PR creation is currently restricted (
collaborators_only), the CI-green branch is ready on my fork for cherry-pick / review:geiyiliyabumo/VIctory@feat/list-predication-and-markersgeiyiliyabumo/VIctory@a74fe6b(based onmainffe310e)Changes (
crates/victory-gpu/src/list.rs)set_predication(0xf8):SetPredication(None, 0, D3D12_PREDICATION_OP_EQUAL_ZERO)).operation(0=EQUAL_ZERO,1=NOT_EQUAL_ZERO), 8-byteoffsetalignment, andbuffer_range(buffer, offset, 8).D3D12_RESOURCE_STATE_PREDICATIONbefore forwarding; for CPU-backed guest buffers, stages the 8-byte predicate via a list-ownedhost.upload(device, 8)filled at submission (host.defer_fill) so deferred guest writes are observed.set_marker(0x1c0),begin_event(0x1c8),end_event(0x1d0):(None, 0)before forwarding to host D3D12 and recordsdiagnosticsop notes.list::tests::predication_and_marker_slots_are_stable(verifies all 4 slots in bothLIST_FUNCTIONSandNEWER_LIST_FUNCTIONS).list::tests::set_predication_and_markers_execute_on_gpu(exercises markers/events +EQUAL_ZEROpredication skipping on0, executing on1, and disabling withnull, verifying exact GPU readback bytes and zero final refcounts).Verification (Windows 11 x64 MSVC, AMD Radeon RX 9060 XT RDNA4 + WARP)
cargo xtask policy: PASS (154 files ok)cargo clippy --workspace --all-targets --locked -- -D warnings(default +--features diagnostics): PASS (0 warnings)cargo test -p victory-gpu --locked -- predication: 2/2 PASS (live RX 9060 XT GPU readback)VICTORY_D3D12_WARP=1 cargo test -p victory-gpu --features diagnostics --locked -- predication: 2/2 PASScargo test -p victory-gpu --locked: 52 passed, 0 failed, 1 ignoredAI-assisted; synthetic tests only, no game files.
@MichaelSmithAI on GitHub · 2026-11-24 12:57 UTC · original · edited 2026-11-24 13:00 UTC
Daniel checked a predicate produced on the GPU earlier in the same command list at
a74fe6b. A host copy wrote a nonzero predicate into the ordinary guest buffer’s GPU shadow, while the corresponding CPU bytes were still zero. Binding that shadow directly through D3D12 let the dispatch write 0x22; a zero predicate preserved the 0x11 sentinel. With the same nonzero GPU value, the guest SetPredication path preserved 0x11. For an ordinary buffer it stages the CPU bytes at submission, before the GPU executes the producing command.A second synthetic comparison used a guest typed UAV clear as the producer, on a stack with #785’s written-shadow lookup. In order, the three cases were a GPU-written nonzero predicate, a CPU zero, and a CPU nonzero written after recording. The original binding produced
[0x11, 0x11, 0x22]. Selecting the tracked GPU shadow for the covered eight bytes and transitioning it to PREDICATION produced[0x22, 0x11, 0x22]. The CPU cases still used deferred staging.Daniel also isolated the transition in the direct host control on this Wine/vkd3d-proton backend. With #334’s BUFFER_READ (GENERIC_READ) transition, the nonzero case left all 16 sentinel bytes at 0x11. Changing only the transition to D3D12_RESOURCE_STATE_PREDICATION made that dispatch write 0x22 to all 16 bytes, and the zero case still skipped.
Measured on RTX 4090 with Wine/vkd3d-proton 3.2. The original predicated-copy fixture also failed on this backend, so the comparison above uses compute dispatches with independent zero/nonzero host controls. Your native AMD and WARP results cover the separate CPU-written copy case. Title use remains open.
The tested implementation is available on the combined #859/#785 branch. It uses an earlier tracked GPU write only when the same command list covers all eight predicate bytes and the resolved shadow offset is aligned. The fallback keeps deferred CPU staging. Query emulation and writes from another command list were outside this test.
@andrewpozdnakov7-jpg on GitHub · 2026-11-24 13:14 UTC · original
I ran a separate native Windows WARP check for the proposed
e9186e1fix. I extended the fork's predicated-copy test with a third predicate initialized to zero on the CPU and set to one by an earlier native copy into its GPU shadow on the same list.At
a74fe6b, the guest call left the destination at0x11, even though the predicate copied back as1after execution. Binding that same shadow with native D3D12 in the control allowed the copy to write0x22. Withe9186e1, the guest call also wrote0x22, using the list's buffer state tracker for the producer. The existing CPU-written zero, CPU-written one, and disable controls all passed.The combined branch with the local regression fixture passed 59 diagnostics library tests, with one benchmark ignored. AI-assisted. Verified with synthetic buffers on native Windows WARP.
@Marvisak on GitHub · 2026-11-25 06:55 UTC · original
Automated triage for the maintainers.
mainstill lacks these four list slots (crates/victory-gpu/src/list.rshas noSetPredication,SetMarker,BeginEventorEndEvent). The branch is open as PR #1168 ("Closes #859"), so review continues there. The follow-up in the comments, which reads a predicate written by the GPU earlier in the same list (commite9186e1, checked on Wine and on native WARP), is not in #1168 yet. Please offer it on that PR.Pull requests are open to everyone again, so new changes can go straight to a PR. Left for the maintainers.
Generated by Claude Code