GPU: confirm the host fence before copying results back #2899
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!2899
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2899"
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?
@andrewpozdnakov7-jpg on GitHub · 2026-11-25 23:25 UTC · original
andrewpozdnakov7-jpg:codex1/confirm-host-fence-completion→main· +98 −14 · 1 files · 1 commits · openChange
The synchronous host submission path uses a shared auto-reset event. A previous notification can wake a later wait while that submission's fence value is still pending. The old path also continued on an event-registration error or a failed Win32 wait. The work that copies GPU data back to guest memory relies on confirmed completion.
Check the completed value after the event wakes. Continue waiting on the registered event if an earlier signal woke it. If registration or the native wait fails, poll the fence at 1 ms intervals. A failed queue signal or the device-removed value goes through the submission failure path before copy-back. This is the standalone fence change suggested in the closing note on #2158.
Verification
The WARP test gives a private D3D12 queue a fence signal behind a closed gate and supplies an already-signalled auto-reset event. On
842b0cb76f8f5fa9289bd779783c51ec24d75302, the test extracts the existing wait without changing its decision. It returned the still-pending value0in six runs. Withfde6a92694cd5b61891e17ca4100a526384a6e4f, the same test stays blocked and sees1after the gate opens in all six runs.Full native WARP GPU suite passed with 247 tests and one ignored under each D3D12 debug setting, and again with GPU timing enabled. Strict GPU Clippy in both configurations and asset policy passed. The paired test uses synthetic data and exercises the early wake. Device removal was not induced.
Coordination · Win32 event wait · D3D12 fence completion
Please retain the Git author if cherry-picking the fix or test. If folding this change into another commit, please retain
Co-authored-by: andrewpozdnakov7-jpg <[email protected]>.AI-assisted with Codex.
@Marvisak on GitHub · 2026-11-26 04:31 UTC · original
Automated triage for the maintainers.
Merge candidate. The synchronous wait in
Host::submit(host.rs) becomeswait_for_fence_value, which re-checksGetCompletedValueafter every wake, falls back to 1 ms polling if event registration or the wait fails, and stops on the device-removed value; a failedSignalgoes throughfailbefore any copy-back. This closes a real gap on main, where a failedSetEventOnCompletionlet copy-back run before the GPU finished. The WARP test with a gated queue checks that the wait does not return early.CI: passing.
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.