Card copies: the compare is sent in an ExecuteCommandLists call of its own again, so no copy in COPY_DEST is bound as a root SRV (#1 was lost in 4db42779) #4884

Closed
github-bot wants to merge 1 commit from github-bot/gh-4883 into main AGit
Owner

@⁠davemathews12 on GitHub · 2026-12-01 12:43 UTC · original
davemathews12:fix/compare-own-execute → main · +58 −8 · 1 files · 1 commits · closed without merging

Refs #4544, Refs #4643

What it changes

The compare of copies in the card's memory (plan.check) is sent in the same ExecuteCommandLists call as the title's lists, after them. A title list can leave a card copy promoted to COPY_DEST (a CopyBufferRegion into it, e.g. place_copy), and a promoted state lasts to the end of that call, across its lists. The compare then binds the copy as a root SRV (SetComputeRootShaderResourceView(1, …), host.rs, the compare pass) while it is in COPY_DEST: D3D12 message 538, "Resource state (0x400: COPY_DEST) (promoted from COMMON state) … is invalid for use as a root shader resource … Missing State: 0x40". NVIDIA and AMD tolerate it; Arc B580 removes the device (marcelloveyugioh-wq's run in #4678: 3,114 of these, all COPY_DEST, then DXGI_ERROR_DEVICE_HUNG; gilmarcs's runs in #4643).

This was fixed once: #1 (merged Nov 26) sent the compare in a call of its own, since buffers decay to COMMON between calls, and #3 kept the timeline's end marks after it. Neither is on main now: the merge onto the foxhound base, 4db42779 ("its tree is kept in history, not in the files"), took foxhound's host.rs, which pushes the compare onto the submission's lists. git log -m -S compare_at -- crates/victory-gpu/src/host.rs shows it added by #3 (fdc8bbc5) and gone in 4db42779.

This brings it back, for all three send paths:

  • the sender of a split submission (VICTORY_SUBMIT_SPLIT);
  • a late submission sent inline;
  • the waited submission (after its last group, as #1 did).

compare_cuts adds a cut before the compare, after the parts' cuts, and never makes an empty call. The diagnostics' timeline marks that are inserted in front shift its place, as they shift firsts. The end marks stay after the compare, in its call, as #3 had them.

Cost: one more ExecuteCommandLists call in a submission that has a compare. I haven't measured it.

Related, not overlapping:

  • #4590 returns place_copy's destination to COMMON after the copy, at the source. Its debug run measured SetComputeRootShaderResourceView 538s going from 98,637 to 0. The two don't conflict. This one also covers a copy promoted to COPY_DEST by any other command in the title's lists, and it is what #1 did.
  • #194 tracks buffer states and adds a barrier to plan.check's prologue.
  • #3881 (and my #4678, which I'm closing as its duplicate) reads before once per recording. That's a different race, and it doesn't stop these messages (marcelloveyugioh-wq's run).

How it was tested

  • GPU and profile: none. I have no Windows machine, and this has not been run in the game. The cause is from reading the code, together with the message's "promoted from COMMON state" and #1's evidence. #1's PR measured 0 of these messages on an RTX 5070 with this split. LucaruluDev's fixture in #1 gives exactly one 538 for one call and none for two.
  • Before: n/a. After: n/a.
  • For shader changes, the wave sizes tested: n/a (no shader change).
  • cargo test: not run (host.rs is Windows-only); a new test, the_compare_is_sent_in_a_call_of_its_own, covers compare_cuts. cargo clippy -p victory-gpu --tests --target x86_64-pc-windows-msvc, with and without --features diagnostics: no errors and no new warnings, cross-checked from Linux. cargo xtask policy --staged passes.

Asking Arc owners (@⁠marcelloveyugioh-wq, @⁠gilmarcs): with the same command as your #4678 run (VICTORY_D3D12_DEBUG=1, card buffers on), does "invalid for use as a root shader resource" still appear, and does the device still hang?

Checked for overlap

  • I searched the open and closed pull requests and issues ("state decay", "compare separately", "separate ExecuteCommandLists", "COPY_DEST root shader resource", "538", #4544, #4643). The only one that sends the compare on its own is #1, which is merged and no longer on main. #4590, #194 and #4677 are related, as above.

🤖 Generated with Claude Code

**@⁠davemathews12** on GitHub · 2026-12-01 12:43 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4883) `davemathews12:fix/compare-own-execute` → `main` · +58 −8 · 1 files · 1 commits · closed without merging Refs #4544, Refs #4643 ## What it changes The compare of copies in the card's memory (`plan.check`) is sent in the same `ExecuteCommandLists` call as the title's lists, after them. A title list can leave a card copy promoted to `COPY_DEST` (a `CopyBufferRegion` into it, e.g. `place_copy`), and a promoted state lasts to the end of that call, across its lists. The compare then binds the copy as a root SRV (`SetComputeRootShaderResourceView(1, …)`, host.rs, the compare pass) while it is in `COPY_DEST`: D3D12 message 538, "Resource state (0x400: COPY_DEST) (promoted from COMMON state) … is invalid for use as a root shader resource … Missing State: 0x40". NVIDIA and AMD tolerate it; Arc B580 removes the device (marcelloveyugioh-wq's run in #4678: 3,114 of these, all `COPY_DEST`, then `DXGI_ERROR_DEVICE_HUNG`; gilmarcs's runs in #4643). This was fixed once: #1 (merged Nov 26) sent the compare in a call of its own, since buffers decay to `COMMON` between calls, and #3 kept the timeline's end marks after it. Neither is on main now: the merge onto the foxhound base, 4db42779 ("its tree is kept in history, not in the files"), took foxhound's `host.rs`, which pushes the compare onto the submission's lists. `git log -m -S compare_at -- crates/victory-gpu/src/host.rs` shows it added by #3 (fdc8bbc5) and gone in 4db42779. This brings it back, for all three send paths: - the sender of a split submission (`VICTORY_SUBMIT_SPLIT`); - a late submission sent inline; - the waited submission (after its last group, as #1 did). `compare_cuts` adds a cut before the compare, after the parts' cuts, and never makes an empty call. The diagnostics' timeline marks that are inserted in front shift its place, as they shift `firsts`. The end marks stay after the compare, in its call, as #3 had them. Cost: one more `ExecuteCommandLists` call in a submission that has a compare. I haven't measured it. Related, not overlapping: - #4590 returns `place_copy`'s destination to `COMMON` after the copy, at the source. Its debug run measured `SetComputeRootShaderResourceView` 538s going from 98,637 to 0. The two don't conflict. This one also covers a copy promoted to `COPY_DEST` by any other command in the title's lists, and it is what #1 did. - #194 tracks buffer states and adds a barrier to `plan.check`'s prologue. - #3881 (and my #4678, which I'm closing as its duplicate) reads `before` once per recording. That's a different race, and it doesn't stop these messages (marcelloveyugioh-wq's run). ## How it was tested - GPU and profile: none. I have no Windows machine, and this has **not been run in the game**. The cause is from reading the code, together with the message's "promoted from COMMON state" and #1's evidence. #1's PR measured 0 of these messages on an RTX 5070 with this split. LucaruluDev's fixture in #1 gives exactly one 538 for one call and none for two. - Before: n/a. After: n/a. - For shader changes, the wave sizes tested: n/a (no shader change). - `cargo test`: not run (host.rs is Windows-only); a new test, `the_compare_is_sent_in_a_call_of_its_own`, covers `compare_cuts`. `cargo clippy -p victory-gpu --tests --target x86_64-pc-windows-msvc`, with and without `--features diagnostics`: no errors and no new warnings, cross-checked from Linux. `cargo xtask policy --staged` passes. Asking Arc owners (@⁠marcelloveyugioh-wq, @⁠gilmarcs): with the same command as your #4678 run (`VICTORY_D3D12_DEBUG=1`, card buffers on), does "invalid for use as a root shader resource" still appear, and does the device still hang? ## Checked for overlap - [x] I searched the open and closed pull requests and issues ("state decay", "compare separately", "separate ExecuteCommandLists", "COPY_DEST root shader resource", "538", #4544, #4643). The only one that sends the compare on its own is #1, which is merged and no longer on main. #4590, #194 and #4677 are related, as above. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
A title list can leave a card copy promoted to COPY_DEST (a CopyBufferRegion
into it), and a promoted state lasts to the end of the ExecuteCommandLists
call. The compare of copies in the card's memory was sent in the same call,
after the title's lists, and binds the copy as a root SRV: D3D12 message 538
("COPY_DEST (promoted from COMMON state) ... invalid for use as a root shader
resource"). Arc B580 removes the device over it.

#1 sent the compare on its own (buffers decay to COMMON between calls), and
#3 kept the timeline's end marks after it. The foxhound base (4db42779) did
not carry that over. This cuts before the compare in all three send paths:
the sender of a split submission, a late submission sent inline, and the
waited one (after its last group).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-01 12:48:36 +00:00
Author
Owner

@⁠andrewpozdnakov7-jpg on GitHub · 2026-12-01 12:55 UTC · original

I compiled the exact compare_cuts selector and its test from 6ee3106d on Windows. I also checked the sender's list layout with two title groups and both diagnostic marker pairs. The compare started in a separate batch, both trailing markers stayed after it, and all three batches were non-empty. Both focused tests passed.

This verifies the list boundaries. Confirming that message 538 disappears and that the Arc run completes still needs a D3D12 diagnostics run.

**@⁠andrewpozdnakov7-jpg** on GitHub · 2026-12-01 12:55 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4883#issuecomment-7311846018) I compiled the exact `compare_cuts` selector and its test from `6ee3106d` on Windows. I also checked the sender's list layout with two title groups and both diagnostic marker pairs. The compare started in a separate batch, both trailing markers stayed after it, and all three batches were non-empty. Both focused tests passed. This verifies the list boundaries. Confirming that message 538 disappears and that the Arc run completes still needs a D3D12 diagnostics run.
Author
Owner

@⁠cloph-dsp on GitHub · 2026-12-01 12:56 UTC · original

Verification of this PR (AI-assisted: Hy4 flash), source only, no game data.

Windows / rustc 1.100.0 / MSVC. Worktree at head 6ee3106d, dedicated per-worktree CARGO_TARGET_DIR (D:\Victory-Contrib\NVIDIA-Contrib\target-4883), never shared.

Negative control on base 5fabb46e:

  • git grep -F the_compare_is_sent_in_a_call_of_its_own 5fabb46e -- . -> exit 1 (test is new)
    Whitespace: git diff --check 5fabb46e..6ee3106d -> exit 0, clean.
cargo test --locked -p victory-gpu --lib -- host::tests::the_compare_is_sent_in_a_call_of_its_own --exact --test-threads=1 --quiet

-> running 1 test / test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 1161 filtered out.

The test lives inside #[cfg(test)] mod tests at crates/victory-gpu/src/host.rs:1898, so the host::tests:: prefix is required (a bare name matches 0 tests and looks like a failure).

GPU/driver: N/A (the test exercises compare_cuts' planned call splitting only; no device is opened).

Verdict: PASS for the new synthetic test on this host.

**@⁠cloph-dsp** on GitHub · 2026-12-01 12:56 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4883#issuecomment-7311869805) Verification of this PR (AI-assisted: Hy4 flash), source only, no game data. Windows / rustc 1.100.0 / MSVC. Worktree at head 6ee3106d, dedicated per-worktree CARGO_TARGET_DIR (D:\Victory-Contrib\NVIDIA-Contrib\target-4883), never shared. Negative control on base 5fabb46e: - `git grep -F the_compare_is_sent_in_a_call_of_its_own 5fabb46e -- .` -> exit 1 (test is new) Whitespace: `git diff --check 5fabb46e..6ee3106d` -> exit 0, clean. ``` cargo test --locked -p victory-gpu --lib -- host::tests::the_compare_is_sent_in_a_call_of_its_own --exact --test-threads=1 --quiet ``` -> `running 1 test` / `test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 1161 filtered out`. The test lives inside `#[cfg(test)] mod tests` at crates/victory-gpu/src/host.rs:1898, so the `host::tests::` prefix is required (a bare name matches 0 tests and looks like a failure). GPU/driver: N/A (the test exercises `compare_cuts`' planned call splitting only; no device is opened). Verdict: PASS for the new synthetic test on this host.
Author
Owner

@⁠Dukestar69 on GitHub · 2026-12-01 16:23 UTC · original · approved these changes

Reviewed crates/victory-gpu/src/host.rs: restoring compare_cuts so the card-memory compare command list is submitted in its own ExecuteCommandLists call (and adjusting check_at when front/ahead lists are prepended) ensures buffers promoted to COPY_DEST decay back to COMMON before the compare binds them as a root SRV (preventing D3D12 message 538). Verified on Windows (RTX 5090): cargo test -p victory-gpu --lib host::tests::the_compare_is_sent_in_a_call_of_its_own -- --test-threads=1 (1 passed, 0 failed).

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

**@⁠Dukestar69** on GitHub · 2026-12-01 16:23 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4883#pullrequestreview-6135367923) · **approved these changes** Reviewed crates/victory-gpu/src/host.rs: restoring compare_cuts so the card-memory compare command list is submitted in its own ExecuteCommandLists call (and adjusting check_at when front/ahead lists are prepended) ensures buffers promoted to COPY_DEST decay back to COMMON before the compare binds them as a root SRV (preventing D3D12 message 538). Verified on Windows (RTX 5090): cargo test -p victory-gpu --lib host::tests::the_compare_is_sent_in_a_call_of_its_own -- --test-threads=1 (1 passed, 0 failed). Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
github-bot closed this pull request 2026-12-01 18:30:38 +00:00
Author
Owner

@⁠trustno1-coder on GitHub · 2026-12-01 18:29 UTC · original

Closing this as part of moving main to the texture and video-memory rework (v2026.12.01.01-test). A lot of the code changed, and this pull request no longer applies cleanly to it; it would need to be rewritten against the new main rather than rebased. Thank you for the work. If the change is still needed, please open a new pull request based on the current main.

**@⁠trustno1-coder** on GitHub · 2026-12-01 18:29 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4883#issuecomment-7321026893) Closing this as part of moving main to the texture and video-memory rework (v2026.12.01.01-test). A lot of the code changed, and this pull request no longer applies cleanly to it; it would need to be rewritten against the new main rather than rebased. Thank you for the work. If the change is still needed, please open a new pull request based on the current main.

Pull request closed

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!4884
No description provided.