GPU/host: stop CardInflight::brought from pinning Arc<Shadow> buffers after fallback fetches #804

Open
AscilCH wants to merge 1 commit from upstream-pr/805 into main
AscilCH commented 2026-11-25 08:19:19 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by AscilCH on 2026-11-25T08:19:19Z.


Summary

Fix two CardInflight::brought retention bugs introduced in 9376fd6 (crates/victory-gpu/src/host.rs):

  1. Skip recording stale brought entries when no later flight is in the air.

    • In Host::relay_card_back(), inflight_tickets_landed(plans) pruned inflight.brought before the fallback fetch ran, after which every fetched piece was unconditionally appended with (shadow.clone(), lo, hi, after - 1) whenever after > 1—even when after - 1 <= max(plan.sent_as) so no later flight could ever match b.3 >= sent_as.
    • Guard inflight.brought.extend(...) with should_record_brought(after, landed) (after > 1 && landed.is_none_or(|last| after - 1 > last)).
  2. Clear inflight.brought in Host::card_done() when all plans have landed.

    • When work.out == 0 (or !relay()), reset inflight.brought.clear() alongside work.taken = 0 so no Arc<Shadow> card/staging buffers remain pinned after all in-flight plans finish.

Verification

  • cargo test -p victory-gpu --locked -- host::batch: 5 passed; 0 failed; 1 ignored (benchmark), including new should_record_brought_only_when_later_flights_exist.
  • cargo clippy -p victory-gpu --all-targets --all-features --locked: 0 warnings in crates/victory-gpu/src/host.rs (only pre-existing 9376fd6 warnings in draw.rs and indirect.rs).
  • cargo xtask policy: 171 files ok.

(AI-assisted; synthetic unit tests only, no game data.)

<!-- greyfinch-sync:fxceless/victory-fork:issue:6600222664 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/805). Originally posted by [AscilCH](https://github.com/AscilCH) on 2026-11-25T08:19:19Z. --- ## Summary Fix two `CardInflight::brought` retention bugs introduced in `9376fd6` (`crates/victory-gpu/src/host.rs`): 1. **Skip recording stale `brought` entries when no later flight is in the air.** - In `Host::relay_card_back()`, `inflight_tickets_landed(plans)` pruned `inflight.brought` before the fallback fetch ran, after which every fetched piece was unconditionally appended with `(shadow.clone(), lo, hi, after - 1)` whenever `after > 1`—even when `after - 1 <= max(plan.sent_as)` so no later flight could ever match `b.3 >= sent_as`. - Guard `inflight.brought.extend(...)` with `should_record_brought(after, landed)` (`after > 1 && landed.is_none_or(|last| after - 1 > last)`). 2. **Clear `inflight.brought` in `Host::card_done()` when all plans have landed.** - When `work.out == 0` (or `!relay()`), reset `inflight.brought.clear()` alongside `work.taken = 0` so no `Arc<Shadow>` card/staging buffers remain pinned after all in-flight plans finish. ## Verification - `cargo test -p victory-gpu --locked -- host::batch`: `5 passed; 0 failed; 1 ignored` (benchmark), including new `should_record_brought_only_when_later_flights_exist`. - `cargo clippy -p victory-gpu --all-targets --all-features --locked`: 0 warnings in `crates/victory-gpu/src/host.rs` (only pre-existing `9376fd6` warnings in `draw.rs` and `indirect.rs`). - `cargo xtask policy`: `171 files ok`. *(AI-assisted; synthetic unit tests only, no game data.)*
MamaLeVrai commented 2026-11-25 10:11:15 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by MamaLeVrai on 2026-11-25T09:54:07Z.


Test report on real hardware: AMD RX 6950 XT (RDNA2), Windows 11, Rust 1.98.1, with a GPU present. I merged this PR's head 6bf3929 into main 9376fd6 in a throwaway tree (no conflict). cargo clippy --workspace --all-targets --locked -- -D warnings fails, with the same two errors as main itself on this machine (function placed_filler_twins is never used, field depth_written is never read, victory-gpu): this PR adds none and removes none. cargo test --workspace --locked: 541 passed, 0 failed, 10 ignored, two runs (main alone: 540 passed). The title was not run, so this says nothing about in-game effect. No game data.

AI-assisted (Claude Code); no game data.

<!-- greyfinch-sync:fxceless/victory-fork:comment:7158953442 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/805#issuecomment-7158953442). Originally posted by [MamaLeVrai](https://github.com/MamaLeVrai) on 2026-11-25T09:54:07Z. --- Test report on real hardware: AMD RX 6950 XT (RDNA2), Windows 11, Rust 1.98.1, with a GPU present. I merged this PR's head `6bf3929` into `main` `9376fd6` in a throwaway tree (no conflict). `cargo clippy --workspace --all-targets --locked -- -D warnings` fails, with the same two errors as `main` itself on this machine (`function placed_filler_twins is never used`, `field depth_written is never read`, `victory-gpu`): this PR adds none and removes none. `cargo test --workspace --locked`: 541 passed, 0 failed, 10 ignored, two runs (`main` alone: 540 passed). The title was not run, so this says nothing about in-game effect. No game data. AI-assisted (Claude Code); no game data.
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/805:upstream-pr/805'
git switch 'upstream-pr/805'

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/805'
git switch 'upstream-pr/805'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/805'
git switch 'upstream-pr/805'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/805'
git switch 'main'
git merge --squash 'upstream-pr/805'
git switch 'main'
git merge --ff-only 'upstream-pr/805'
git switch 'main'
git merge 'upstream-pr/805'
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
fxceless/victory-fork!804
No description provided.