GPU: a pipeline a list binds again is not kept and named again #3165

Open
pablogonz12 wants to merge 1 commit from upstream-pr/3167 into main
pablogonz12 commented 2026-11-26 10:49:54 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by pablogonz12 on 2026-11-26T10:49:54Z.


What

draw::State::bind keeps a host pipeline and its root signature so the title may release them
before it submits the list, and notes the pipeline's name. It did that at every change of
pipeline
, even when the list had already kept that same pipeline: two QueryInterfaces, three
lock/unlocks and a String hash on the submitting thread for nothing.

Now HostList::bind_pipeline (crates/victory-gpu/src/host.rs) keeps and names a host pipeline the
first time the list binds it. The set of kept addresses is its own type
(crates/victory-gpu/src/bound.rs) with tests that need no device, and it is cleared with the rest of
the list's deferred state, so a list that is reset binds (and keeps) them again. Two host pipelines
one address apart are two: the list keeps the old one, so its address names no other.

SetPipelineState itself is unchanged (it was already only called when the host pipeline changes);
this removes the redundant keeps and name lookups around it.

Credit

From avatarmanz/VIctory-7900XTX ab86ef7f3
("A pipeline a list binds again is not kept and named again"), which is from
Belobug/VIctory-Belobug-AMD 92d353f8 (romainhedouin), GPL-3.0.

Numbers

Offline, no game run (cargo xwin test -p victory-gpu --lib bound, Wine):
10,000 binds of five pipelines keep and name 5 (not 10,000); a reset binds them again; pipelines an
address apart are two. What a repeat no longer costs is two interface queries, three lock/unlocks and
one name lookup on the submitting thread per repeated bind; how many of those a frame has is not
measured
here.

Off switch

None: the list still keeps and names every pipeline it binds, just once each instead of once per bind.

Other hardware

This is host-side bookkeeping: no shader, no D3D12 call and no default path changes, so the path on
NVIDIA and on Windows is the same as before minus redundant keeps. Checked here on RX 9070 XT / Mesa
RADV / Wine only. Not tested on NVIDIA hardware - a Windows or NVIDIA test run would be welcome.

Gates

  • cargo xwin clippy --target x86_64-pc-windows-msvc -p victory-gpu --all-targets -- -D warnings: clean.
  • cargo xwin test --target x86_64-pc-windows-msvc -p victory-gpu --lib bound (Wine): 3 new tests pass.
  • cargo xtask policy: 192 files ok.

Not tested in a game run.

<!-- greyfinch-sync:Marvisak/VIctory:issue:5508623210 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3167). Originally posted by [pablogonz12](https://github.com/pablogonz12) on 2026-11-26T10:49:54Z. --- ## What `draw::State::bind` keeps a host pipeline and its root signature so the title may release them before it submits the list, and notes the pipeline's name. It did that at **every change of pipeline**, even when the list had already kept that same pipeline: two `QueryInterface`s, three lock/unlocks and a `String` hash on the submitting thread for nothing. Now `HostList::bind_pipeline` (`crates/victory-gpu/src/host.rs`) keeps and names a host pipeline the first time the list binds it. The set of kept addresses is its own type (`crates/victory-gpu/src/bound.rs`) with tests that need no device, and it is cleared with the rest of the list's deferred state, so a list that is reset binds (and keeps) them again. Two host pipelines one address apart are two: the list keeps the old one, so its address names no other. `SetPipelineState` itself is unchanged (it was already only called when the host pipeline changes); this removes the redundant keeps and name lookups around it. ## Credit From **avatarmanz/VIctory-7900XTX [ab86ef7f3](https://github.com/avatarmanz/VIctory-7900XTX/commit/ab86ef7f3)** ("A pipeline a list binds again is not kept and named again"), which is from **Belobug/VIctory-Belobug-AMD [92d353f8](https://github.com/Belobug/VIctory-Belobug-AMD)** (romainhedouin), GPL-3.0. ## Numbers Offline, no game run (`cargo xwin test -p victory-gpu --lib bound`, Wine): 10,000 binds of five pipelines keep and name **5** (not 10,000); a reset binds them again; pipelines an address apart are two. What a repeat no longer costs is two interface queries, three lock/unlocks and one name lookup on the submitting thread per repeated bind; how many of those a frame has is **not measured** here. ## Off switch None: the list still keeps and names every pipeline it binds, just once each instead of once per bind. ## Other hardware This is host-side bookkeeping: no shader, no D3D12 call and no default path changes, so the path on NVIDIA and on Windows is the same as before minus redundant keeps. Checked here on RX 9070 XT / Mesa RADV / Wine only. **Not tested on NVIDIA hardware** - a Windows or NVIDIA test run would be welcome. ## Gates - `cargo xwin clippy --target x86_64-pc-windows-msvc -p victory-gpu --all-targets -- -D warnings`: clean. - `cargo xwin test --target x86_64-pc-windows-msvc -p victory-gpu --lib bound` (Wine): 3 new tests pass. - `cargo xtask policy`: 192 files ok. **Not tested in a game run.**
Dukestar69 commented 2026-11-26 11:09:25 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Dukestar69 on 2026-11-26T11:09:25Z.

Review: APPROVED


Verified on RTX 5090 against origin/main (63bcca4):

  • cargo test -p victory-gpu --lib bound:: -- --test-threads=1: passed.
  • cargo test -p victory-gpu --lib draw:: -- --test-threads=1: 20/20 passed; host::tests: 30/30 passed.
  • cargo clippy -p victory-gpu --all-targets -- -D warnings: clean.
  • cargo xtask policy: 192 files ok.

Cleanly deduplicates repeated pipeline binds within a command list.

Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).

<!-- greyfinch-sync:Marvisak/VIctory:review:6073083263 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3167#pullrequestreview-6073083263). Originally posted by [Dukestar69](https://github.com/Dukestar69) on 2026-11-26T11:09:25Z. **Review:** APPROVED --- Verified on RTX 5090 against `origin/main` (`63bcca4`): - `cargo test -p victory-gpu --lib bound:: -- --test-threads=1`: passed. - `cargo test -p victory-gpu --lib draw:: -- --test-threads=1`: 20/20 passed; `host::tests`: 30/30 passed. - `cargo clippy -p victory-gpu --all-targets -- -D warnings`: clean. - `cargo xtask policy`: 192 files ok. Cleanly deduplicates repeated pipeline binds within a command list. Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
Jackster commented 2026-11-26 23:02:17 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Jackster on 2026-11-26T23:02:17Z.


Windows 11, 63bcca4 + this PR, Radeon RX 7900 XTX:

  • cargo test -p victory-gpu --lib: 234 passed / 0 failed / 1 ignored (unpatched 63bcca4 here: 231; +3).
  • cargo clippy -p victory-gpu --all-targets -- -D warnings: clean.

a_pipeline_bound_again_is_kept_once, a_list_reset_binds_them_again and pipelines_an_address_apart_are_two all pass. Synthetic only. AI-assisted.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7205199259 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3167#issuecomment-7205199259). Originally posted by [Jackster](https://github.com/Jackster) on 2026-11-26T23:02:17Z. --- Windows 11, `63bcca4` + this PR, Radeon RX 7900 XTX: - `cargo test -p victory-gpu --lib`: 234 passed / 0 failed / 1 ignored (unpatched `63bcca4` here: 231; +3). - `cargo clippy -p victory-gpu --all-targets -- -D warnings`: clean. `a_pipeline_bound_again_is_kept_once`, `a_list_reset_binds_them_again` and `pipelines_an_address_apart_are_two` all pass. Synthetic only. AI-assisted.
fuzeofficlal commented 2026-11-27 00:16:03 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-27T00:16:03Z.

Review: APPROVED


Reviewed and tested af6b429073ab247234a617e484ef7625af0120bc on both RTX 5090 and WARP (VICTORY_D3D12_DEBUG=1).

Verification:

  • cargo xtask policy — pass
  • cargo clippy --tests -p victory-gpu -- -D warnings (default and --features diagnostics) — clean
  • bound::tests (3/3) and draw::tests (20/20 on RTX 5090, 20/20 on WARP) — all pass with 0 D3D12 Debug Layer errors
  • Live HostList::bind_pipeline probe (400 alternating binds of 2 compute pipelines -> kept=4, names=2, releasing all caller COM refs prior to Close() + host.execute(&[&list]), verifying list.reset() clears kept/bound/pipelines, then rebinding and executing a fresh pipeline) — passes cleanly on both RTX 5090 and WARP with 0 Debug Layer errors.

Locking and reset invariants are clean: bind_pipeline (host.rs:2053-2068) drops the deferred mutex before calling used_pipeline, HostList::reset (host.rs:1786, 1789) clears both Deferred (kept + bound) and pipelines, and State::cut (draw.rs:315-316) resets host_pipeline when switching to a fresh host command list.

LGTM!

<!-- greyfinch-sync:Marvisak/VIctory:review:6081899557 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3167#pullrequestreview-6081899557). Originally posted by [fuzeofficlal](https://github.com/fuzeofficlal) on 2026-11-27T00:16:03Z. **Review:** APPROVED --- Reviewed and tested `af6b429073ab247234a617e484ef7625af0120bc` on both RTX 5090 and WARP (`VICTORY_D3D12_DEBUG=1`). Verification: - `cargo xtask policy` — pass - `cargo clippy --tests -p victory-gpu -- -D warnings` (default and `--features diagnostics`) — clean - `bound::tests` (3/3) and `draw::tests` (20/20 on RTX 5090, 20/20 on WARP) — all pass with 0 D3D12 Debug Layer errors - Live `HostList::bind_pipeline` probe (400 alternating binds of 2 compute pipelines -> `kept=4`, `names=2`, releasing all caller COM refs prior to `Close()` + `host.execute(&[&list])`, verifying `list.reset()` clears `kept`/`bound`/`pipelines`, then rebinding and executing a fresh pipeline) — passes cleanly on both RTX 5090 and WARP with 0 Debug Layer errors. Locking and reset invariants are clean: `bind_pipeline` (`host.rs:2053-2068`) drops the `deferred` mutex before calling `used_pipeline`, `HostList::reset` (`host.rs:1786, 1789`) clears both `Deferred` (`kept` + `bound`) and `pipelines`, and `State::cut` (`draw.rs:315-316`) resets `host_pipeline` when switching to a fresh host command list. LGTM!
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/3167:upstream-pr/3167'
git switch 'upstream-pr/3167'

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/3167'
git switch 'upstream-pr/3167'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/3167'
git switch 'upstream-pr/3167'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/3167'
git switch 'main'
git merge --squash 'upstream-pr/3167'
git switch 'main'
git merge --ff-only 'upstream-pr/3167'
git switch 'main'
git merge 'upstream-pr/3167'
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!3165
No description provided.