GPU: blocking fence waits, feature queries, device methods, private interfaces #1955

Open
RaghavVijayanand wants to merge 4 commits from upstream-pr/1957 into main
RaghavVijayanand commented 2026-11-25 01:45:18 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by RaghavVijayanand on 2026-11-25T01:45:18Z.


Four runtime gaps in victory-gpu, one commit each.

  • Fences: blocking wait. SetEventOnCompletion with a null event returned E_NOTIMPL. It now blocks on a condition variable until the fence reaches the value, rechecking every 1 ms in case the title stores to the fence address from the CPU.
    • Bug fixed along the way: bottom-of-pipe writes to a fence's GPU address changed its value without the fence knowing, so events and waits for that value never fired. Live fences are now registered by the address of their value, and Written::write wakes them.
  • Device: feature queries. Before, only ids 0-4 were answered and everything else returned E_NOTIMPL; format support also claimed every use of every format.
    • Upstream's local console answers for shader model (7), options 1 (8) and options 4 (23) are kept, and now also get size checks.
    • Answered locally: ids 0-2 as before, GPU virtual address bits (id 6), and architecture 1 (id 16).
    • Format queries (ids 3-5) go to the host. The console's 16-bit depth formats are asked as the PC formats that stand in for them.
    • Every other id goes to the host unchanged.
    • Locally answered ids return E_INVALIDARG on a wrong size, as D3D12 does.
  • Device methods at their PC slots: MakeResident, Evict and SetStablePowerState now succeed as on PC. (Upstream already answers GetDeviceRemovedReason from the host, so that part was dropped in the rebase.)
  • SetPrivateDataInterface: stores the interface with a reference, which is handed out by GetPrivateData and released on replace, removal or free.

Tests: 14 new tests (7 for fences, 5 for the device, 2 for objects). The blocked-wait tests run on threads with a timeout, so a bug fails the test instead of hanging it. Each fix was broken on purpose to confirm its tests fail. root::tests::the_table_has_the_object_and_device_child_slots asserted that SetPrivateDataInterface returns E_NOTIMPL; it now checks the implemented behaviour instead.

Left alone on purpose: Queue Wait still never blocks. Submissions are synchronous on the calling thread, so blocking there could deadlock.

Unrelated observation: frame::tests::waits_end_on_ticks_and_count_frames failed once on its elapsed <= 50ms check under load and passed in later runs. It looks timing-sensitive.

Rebased onto current main (940d32f). On this machine, 5 tests fail on main itself, with or without this change: descriptor::host::tests::dynamic_slots_are_held_until_released, memory::tests::lists_share_a_table_and_copies_keep_their_views, the two stride_tests::a_heap_buffer_read_* tests, and synthetic_tests::gathers_at_a_level_match_the_hardware. Everything else passes, and clippy passes with -D warnings, with and without --all-features.

<!-- greyfinch-sync:Marvisak/VIctory:issue:6595222426 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1957). Originally posted by [RaghavVijayanand](https://github.com/RaghavVijayanand) on 2026-11-25T01:45:18Z. --- Four runtime gaps in victory-gpu, one commit each. - **Fences: blocking wait.** `SetEventOnCompletion` with a null event returned E_NOTIMPL. It now blocks on a condition variable until the fence reaches the value, rechecking every 1 ms in case the title stores to the fence address from the CPU. - **Bug fixed along the way:** bottom-of-pipe writes to a fence's GPU address changed its value without the fence knowing, so events and waits for that value never fired. Live fences are now registered by the address of their value, and `Written::write` wakes them. - **Device: feature queries.** Before, only ids 0-4 were answered and everything else returned E_NOTIMPL; format support also claimed every use of every format. - Upstream's local console answers for shader model (7), options 1 (8) and options 4 (23) are kept, and now also get size checks. - Answered locally: ids 0-2 as before, GPU virtual address bits (id 6), and architecture 1 (id 16). - Format queries (ids 3-5) go to the host. The console's 16-bit depth formats are asked as the PC formats that stand in for them. - Every other id goes to the host unchanged. - Locally answered ids return E_INVALIDARG on a wrong size, as D3D12 does. - **Device methods at their PC slots:** MakeResident, Evict and SetStablePowerState now succeed as on PC. (Upstream already answers GetDeviceRemovedReason from the host, so that part was dropped in the rebase.) - **SetPrivateDataInterface:** stores the interface with a reference, which is handed out by GetPrivateData and released on replace, removal or free. **Tests:** 14 new tests (7 for fences, 5 for the device, 2 for objects). The blocked-wait tests run on threads with a timeout, so a bug fails the test instead of hanging it. Each fix was broken on purpose to confirm its tests fail. `root::tests::the_table_has_the_object_and_device_child_slots` asserted that SetPrivateDataInterface returns E_NOTIMPL; it now checks the implemented behaviour instead. Left alone on purpose: Queue Wait still never blocks. Submissions are synchronous on the calling thread, so blocking there could deadlock. Unrelated observation: `frame::tests::waits_end_on_ticks_and_count_frames` failed once on its `elapsed <= 50ms` check under load and passed in later runs. It looks timing-sensitive. **Rebased onto current main (940d32f).** On this machine, 5 tests fail on main itself, with or without this change: `descriptor::host::tests::dynamic_slots_are_held_until_released`, `memory::tests::lists_share_a_table_and_copies_keep_their_views`, the two `stride_tests::a_heap_buffer_read_*` tests, and `synthetic_tests::gathers_at_a_level_match_the_hardware`. Everything else passes, and clippy passes with `-D warnings`, with and without `--all-features`.
copilot-pull-request-reviewer[bot commented 2026-11-25 02:05:42 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by copilot-pull-request-reviewer[bot] on 2026-11-25T01:45:33Z.

Review: COMMENTED


Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

<!-- greyfinch-sync:Marvisak/VIctory:review:6050344700 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1957#pullrequestreview-6050344700). Originally posted by [copilot-pull-request-reviewer[bot]](https://github.com/copilot-pull-request-reviewer%5Bbot%5D) on 2026-11-25T01:45:33Z. **Review:** COMMENTED --- Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
catminou4 commented 2026-11-25 03:03:01 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-25T02:10:30Z.

Review: COMMENTED


Static review only: victory-gpu is Windows-only (D3D12/windows_sys) — nothing compiles or runs on macOS; source review of the diff.

Blocking fence waits + feature queries: fence-wait implementation — pairs with #1734's fence tests.

<!-- greyfinch-sync:Marvisak/VIctory:review:6050613375 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1957#pullrequestreview-6050613375). Originally posted by [catminou4](https://github.com/catminou4) on 2026-11-25T02:10:30Z. **Review:** COMMENTED --- Static review only: victory-gpu is Windows-only (D3D12/windows_sys) — nothing compiles or runs on macOS; source review of the diff. Blocking fence waits + feature queries: fence-wait implementation — pairs with #1734's fence tests.
Marvisak commented 2026-11-25 03:03:23 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T02:19:20Z.


Automated triage for the maintainers.

This pull request no longer merges cleanly into main (conflicts in crates/victory-gpu/src/fence.rs). It will be reviewed once it is rebased onto the current main. The earlier verdict (needs work) was for an older state of main.


Generated by Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:comment:7150576182 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1957#issuecomment-7150576182). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T02:19:20Z. --- <!-- victory-triage v1 head=7fb320fe477f358742bb31d0f252e8760355ebbe verdict=needs-rebase at=2026-11-25T16:15:30Z --> Automated triage for the maintainers. This pull request no longer merges cleanly into `main` (conflicts in `crates/victory-gpu/src/fence.rs`). It will be reviewed once it is rebased onto the current `main`. The earlier verdict (needs work) was for an older state of `main`. --- _Generated by [Claude Code](https://claude.ai/code)_
RaghavVijayanand commented 2026-11-26 11:04:06 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by RaghavVijayanand on 2026-11-26T10:58:07Z.


Rebased onto main 63bcca4. fence.rs merged with main's held-work changes: waiters keep the time they started waiting, and reached() (shared by queue/title signals and bottom-of-pipe writes) adds to WAITED as set did. main's rewind check (#2164) is kept in signals_set_waiting_events, using this branch's test helpers. On an RTX 5060 Laptop: the fence/device/object/queue tests pass (45), and clippy is clean with and without features. Two victory-gpu tests fail, but they fail the same way on unmodified main there (NVIDIA's 1M-view heap cap): dynamic_slots_are_held_until_released and lists_share_a_table_and_copies_keep_their_views.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7190080510 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1957#issuecomment-7190080510). Originally posted by [RaghavVijayanand](https://github.com/RaghavVijayanand) on 2026-11-26T10:58:07Z. --- Rebased onto `main` 63bcca4. `fence.rs` merged with `main`'s held-work changes: waiters keep the time they started waiting, and `reached()` (shared by queue/title signals and bottom-of-pipe writes) adds to `WAITED` as `set` did. `main`'s rewind check (#2164) is kept in `signals_set_waiting_events`, using this branch's test helpers. On an RTX 5060 Laptop: the fence/device/object/queue tests pass (45), and clippy is clean with and without features. Two `victory-gpu` tests fail, but they fail the same way on unmodified `main` there (NVIDIA's 1M-view heap cap): `dynamic_slots_are_held_until_released` and `lists_share_a_table_and_copies_keep_their_views`.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/1957:upstream-pr/1957'
git switch 'upstream-pr/1957'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/1957'
git switch 'upstream-pr/1957'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/1957'
git switch 'upstream-pr/1957'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/1957'
git switch 'main'
git merge --squash 'upstream-pr/1957'
git switch 'main'
git merge --ff-only 'upstream-pr/1957'
git switch 'main'
git merge 'upstream-pr/1957'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
Marvisak/VIctory!1955
No description provided.