Join adjacent D3D12 barrier calls #1890

Open
github-bot wants to merge 1 commit from github-bot/gh-1890 into main AGit
Owner

@⁠Gauss999 on GitHub · 2026-11-29 01:46 UTC · original
Gauss999:patch-9 → main · +456 −9 · 4 files · 1 commits · open

What it changes

  • Add VICTORY_JOIN_BARRIERS=1 as an opt-in. The default remains immediate ResourceBarrier, without batching allocation or resource retention; diagnostics builds can also use VICTORY_AB.
  • Wrap the host graphics list in Rec: adjacent barriers are held, then emitted in their original order before the next command, direct barrier, Close, Reset, or other Deref use.
  • Route five list paths and two texture paths through the wrapper, including the current clear_rtv and texture alias transitions that were not present in the original port.
  • Flush before a later call names an already-pending resource. Conflict identity covers transition, both aliasing sides (pResourceBefore and pResourceAfter), and UAV.
  • Acquire strong references for incoming resources before any flush, retain them through the deferred D3D12 call, and release them only after it.
  • Add a small/large resource-name index and per-frame asked/made call counters. This joins API calls only; it does not fold A→B→C into A→C or cancel transitions.

Sources: original replay implementation d3a6c2c, isolated port 195dd84, and conflict-index test 72b0a47. The unrelated VICTORY_UP_QUEUE copy-queue work is deliberately excluded.

The original source reports 2,490 barrier calls joined (1,619 upload-transition/next-aliasing pairs), saving 2.4 ms of 79.5 ms in replay5. That is a third-party replay result, with no in-game measurement or guaranteed gain here.

How it was tested

  • GPU and profile: not run locally; prepared through the GitHub editor.
  • Before/after: no local timing claimed. The replay figure above belongs to the source author.
  • Added seven tests: a 4,096-step conflict-index comparison, mock-sink grouping/order, repeated-resource flush, immediate-off and A/B-switch behavior, null-resource identity, opt-in parsing, and an available-device list/Close smoke test.
  • cargo test: not run in this environment. No build, clippy, fmt, WARP, Debug Layer, PIX, or game run is claimed.
  • Two independent static review passes found no remaining obvious static blocker in the final revision; this is not a compilation claim. Remaining coverage gap: production non-null COM identity/AddRef acquisition and automatic Deref/Close flushing still need runtime regressions.

Required before leaving Draft: run fmt, clippy and victory-gpu tests on Windows; add/run non-null resource retention and Deref/Close tests; exercise repeated A→B→C, aliasing-before/after and UAV cases under D3D12 Debug Layer; inspect PIX/event order; then A/B the same replay and an actual game with GPU/CPU timestamps and the asked/made counters.

Checked for overlap

  • Searched the current repository for VICTORY_JOIN_BARRIERS and inspected the source/downstream ports. Related downstream Draft: Dathinel/victory-4gb#49.
  • Kept this separate from transition folding such as Marvisak/VIctory#1382; this PR preserves every transition and its order.
**@⁠Gauss999** on GitHub · 2026-11-29 01:46 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1890) `Gauss999:patch-9` → `main` · +456 −9 · 4 files · 1 commits · open ## What it changes - Add `VICTORY_JOIN_BARRIERS=1` as an opt-in. The default remains immediate `ResourceBarrier`, without batching allocation or resource retention; diagnostics builds can also use `VICTORY_AB`. - Wrap the host graphics list in `Rec`: adjacent barriers are held, then emitted in their original order before the next command, direct barrier, `Close`, `Reset`, or other `Deref` use. - Route five list paths and two texture paths through the wrapper, including the current `clear_rtv` and texture alias transitions that were not present in the original port. - Flush before a later call names an already-pending resource. Conflict identity covers transition, both aliasing sides (`pResourceBefore` and `pResourceAfter`), and UAV. - Acquire strong references for incoming resources **before any flush**, retain them through the deferred D3D12 call, and release them only after it. - Add a small/large resource-name index and per-frame asked/made call counters. This joins API calls only; it does not fold A→B→C into A→C or cancel transitions. Sources: original replay implementation [d3a6c2c](https://github.com/dankxylese/leotux/commit/d3a6c2c3da8016da3063bd3cbc25c0c6498b687b), isolated port [195dd84](https://github.com/yaak192/Victory-Lap-NVIDIA/commit/195dd84357e9c7c67d98fde65fec0a9519ce921b), and conflict-index test [72b0a47](https://github.com/Dathinel/victory-4gb/commit/72b0a47e919f555282084c16e52088c3e5fa0a2d). The unrelated `VICTORY_UP_QUEUE` copy-queue work is deliberately excluded. The original source reports 2,490 barrier calls joined (1,619 upload-transition/next-aliasing pairs), saving **2.4 ms of 79.5 ms in replay5**. That is a third-party replay result, with no in-game measurement or guaranteed gain here. ## How it was tested - GPU and profile: **not run locally**; prepared through the GitHub editor. - Before/after: **no local timing claimed**. The replay figure above belongs to the source author. - Added seven tests: a 4,096-step conflict-index comparison, mock-sink grouping/order, repeated-resource flush, immediate-off and A/B-switch behavior, null-resource identity, opt-in parsing, and an available-device list/Close smoke test. - `cargo test`: **not run in this environment**. No build, clippy, fmt, WARP, Debug Layer, PIX, or game run is claimed. - Two independent static review passes found no remaining obvious static blocker in the final revision; this is not a compilation claim. Remaining coverage gap: production non-null COM identity/AddRef acquisition and automatic `Deref`/`Close` flushing still need runtime regressions. Required before leaving Draft: run fmt, clippy and `victory-gpu` tests on Windows; add/run non-null resource retention and `Deref`/`Close` tests; exercise repeated A→B→C, aliasing-before/after and UAV cases under D3D12 Debug Layer; inspect PIX/event order; then A/B the same replay and an actual game with GPU/CPU timestamps and the asked/made counters. ## Checked for overlap - [x] Searched the current repository for `VICTORY_JOIN_BARRIERS` and inspected the source/downstream ports. Related downstream Draft: [Dathinel/victory-4gb#49](https://github.com/Dathinel/victory-4gb/pull/49). - [x] Kept this separate from transition folding such as [Marvisak/VIctory#1382](https://github.com/Marvisak/VIctory/pull/1382); this PR preserves every transition and its order.
Wrap host command lists so adjacent ResourceBarrier calls can be held and emitted together under VICTORY_JOIN_BARRIERS=1. The default path remains unchanged.
Add an opt-in command-list wrapper with conflict-aware batching, strong resource references through flush, counters, and focused conflict-index and resource-identity tests.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-29 01:54:13 +00:00
# Conflicts:
#	crates/victory-gpu/src/host.rs
#	crates/victory-gpu/src/list.rs
#	crates/victory-gpu/src/texture.rs
upstream/main renamed the direct ResourceBarrier call to barstat::rb
and reworked ResourceBarrier-style dispatch (barrier() gained the
narrow_legacy paths; barrier_groups gained a host_list block). Route
the merged call sites through the batching wrapper (list.list.barriers)
as the PR intends: default stays the immediate non-allocating call,
VICTORY_JOIN_BARRIERS=1 opts into joining adjacent barriers.
github-bot force-pushed github-bot/gh-1890 from ef49614d9f to 2b31ba6178 2026-11-30 00:23:01 +00:00 Compare
This pull request has changes conflicting with the target branch.
  • crates/victory-gpu/src/host.rs
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.
git fetch -u origin '+refs/pull/1890/head:github-bot/gh-1890'
git switch 'github-bot/gh-1890'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1890'
git switch 'github-bot/gh-1890'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1890'
git switch 'github-bot/gh-1890'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1890'
git switch 'main'
git merge --squash 'github-bot/gh-1890'
git switch 'main'
git merge --ff-only 'github-bot/gh-1890'
git switch 'main'
git merge 'github-bot/gh-1890'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

Reference
github/trustno1-coder--VIctory-NVIDIA!1890
No description provided.