Shadow: queue card copies as they change instead of scanning all at each submission #392

Closed
github-bot wants to merge 662 commits from github-bot/gh-392 into main AGit
Owner

@⁠urielbeaupre on GitHub · 2026-11-28 01:37 UTC · original
urielbeaupre:perf/card-dirty-queue-v2 → main · +60234 −5474 · 206 files · 662 commits · closed without merging

shadow::card_dirty walked every copy in the card's memory (CARDED) at each submission to find the few with dirty ranges: an upgrade of a Weak and an atomic load per copy. A VICTORY_PROFILE sample of the submitting thread on current main put 5.5% of its time there (Vec::retain in card_dirty), in the prison cell on a Ryzen 9 7900X / RTX 4070 Ti.

This PR has each copy queue itself once, the first time it becomes dirty after the queue was last taken (Card.queued, Card.me, CARD_QUEUE), so card_dirty only looks at copies that changed.

  • A change to a copy that is not tracked yet (no me) asks for one full look (CARD_SCAN_ALL), as before. track_carded adds the copy to CARDED before it asks for that look.
  • Ordering: the writer adds its ranges and has_dirty under the dirty lock, then swaps queued to true and pushes the copy if queued was false. The reader swaps queued to false (AcqRel) before it takes the ranges. A change the reader did not take therefore always queues the copy again. The worst case is an empty take.
  • A copy that ends up in the queue twice is taken once per call.
  • Dead Weak entries in CARDED, which the full scan used to drop, are pruned every 1,024 calls.
  • VICTORY_CARD_DIRTY_SCAN=1 restores the old full scan for comparison.
  • The relay bookkeeping (sent.forget, note_joined, has_sent) is unchanged and runs only for dirty copies, as before.

Measurements

RTX 4070 Ti 12 GB, Ryzen 9 7900X (12 cores), 63 GB, Windows 11. Release build, -Machine 4070, Series S, windowed 1920×1080. Unattended with the intro skipped (A held); measured 100–160 s after the loader started, in the prison cell, with no pipelines being made. Same binary, the switch alternating between runs:

VICTORY_CARD_DIRTY_SCAN FPS median slowest quarter CPU preparation
0 (queue) 26.0 25.8 31.1 ms
1 (scan) 24.9 24.4 32.5 ms
0 (queue) 25.2 24.7 32.2 ms
1 (scan) 24.6 24.5 33.6 ms

The mean is 25.6 vs 24.75 fps (about +3%), with CPU preparation 1.4 ms lower. That is two runs each, and the second pair nearly overlaps, so read it as "about +1 fps, within run-to-run spread for one pair". On a diagnostics build of an older main, the gain was smaller (21.9 → 22.2, separate runs) and within noise. The release build is less noisy.

A further pair on fe7c6e5 with this exact commit, after its pipelines were built: queue 25.3 fps (preparation 32.4 ms) against scan 22.9 (36.2 ms). The scan run looks low against the others. Across all three pairs the queue run was ahead each time.

Verification

cargo test -p victory-gpu --lib: 528 passed, including the new card_dirty_takes_queued_copies_once_and_requeues_later_changes. The two tests that call card_dirty share a lock. cargo clippy -p victory-gpu --features diagnostics is clean, and cargo xtask policy passes.

🤖 Generated with Claude Code

**@⁠urielbeaupre** on GitHub · 2026-11-28 01:37 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/392) `urielbeaupre:perf/card-dirty-queue-v2` → `main` · +60234 −5474 · 206 files · 662 commits · closed without merging `shadow::card_dirty` walked every copy in the card's memory (`CARDED`) at each submission to find the few with dirty ranges: an upgrade of a `Weak` and an atomic load per copy. A `VICTORY_PROFILE` sample of the submitting thread on current main put **5.5% of its time** there (`Vec::retain` in `card_dirty`), in the prison cell on a Ryzen 9 7900X / RTX 4070 Ti. This PR has each copy queue itself once, the first time it becomes dirty after the queue was last taken (`Card.queued`, `Card.me`, `CARD_QUEUE`), so `card_dirty` only looks at copies that changed. - A change to a copy that is not tracked yet (no `me`) asks for one full look (`CARD_SCAN_ALL`), as before. `track_carded` adds the copy to `CARDED` before it asks for that look. - **Ordering:** the writer adds its ranges and `has_dirty` under the `dirty` lock, then swaps `queued` to true and pushes the copy if `queued` was false. The reader swaps `queued` to false (AcqRel) before it takes the ranges. A change the reader did not take therefore always queues the copy again. The worst case is an empty take. - A copy that ends up in the queue twice is taken once per call. - Dead `Weak` entries in `CARDED`, which the full scan used to drop, are pruned every 1,024 calls. - `VICTORY_CARD_DIRTY_SCAN=1` restores the old full scan for comparison. - The relay bookkeeping (`sent.forget`, `note_joined`, `has_sent`) is unchanged and runs only for dirty copies, as before. ## Measurements RTX 4070 Ti 12 GB, Ryzen 9 7900X (12 cores), 63 GB, Windows 11. Release build, `-Machine 4070`, Series S, windowed 1920×1080. Unattended with the intro skipped (A held); measured 100–160 s after the loader started, in the prison cell, with no pipelines being made. Same binary, the switch alternating between runs: | `VICTORY_CARD_DIRTY_SCAN` | FPS median | slowest quarter | CPU preparation | |---|---:|---:|---:| | 0 (queue) | 26.0 | 25.8 | 31.1 ms | | 1 (scan) | 24.9 | 24.4 | 32.5 ms | | 0 (queue) | 25.2 | 24.7 | 32.2 ms | | 1 (scan) | 24.6 | 24.5 | 33.6 ms | The mean is **25.6 vs 24.75 fps (about +3%)**, with CPU preparation 1.4 ms lower. That is two runs each, and the second pair nearly overlaps, so read it as "about +1 fps, within run-to-run spread for one pair". On a diagnostics build of an older main, the gain was smaller (21.9 → 22.2, separate runs) and within noise. The release build is less noisy. A further pair on `fe7c6e5` with this exact commit, after its pipelines were built: queue **25.3** fps (preparation 32.4 ms) against scan **22.9** (36.2 ms). The scan run looks low against the others. Across all three pairs the queue run was ahead each time. ## Verification `cargo test -p victory-gpu --lib`: 528 passed, including the new `card_dirty_takes_queued_copies_once_and_requeues_later_changes`. The two tests that call `card_dirty` share a lock. `cargo clippy -p victory-gpu --features diagnostics` is clean, and `cargo xtask policy` passes. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
card_dirty walked every copy in the card's memory each submission to find
the dirty ones (5.5% of the submitting thread in a profile of the prison
cell). Each copy now queues itself once when it first becomes dirty after
the queue was taken; a change to a copy not tracked yet asks for one full
look, as before. VICTORY_CARD_DIRTY_SCAN=1: the full scan, to compare.

Release build, RTX 4070 Ti / Ryzen 9 7900X, prison cell, same binary
alternating: queue 26.0, 25.2, 25.3 fps against scan 24.9, 24.6, 22.9;
preparation about 1.4 ms lower.

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

@⁠akimfomin on GitHub · 2026-11-28 01:56 UTC · original

Source-level comparison with KLBF #57: a page bitmap limits copy work there; your queue limits which objects are visited. I enumerated the ten order-preserving interleavings of one writer and a reader around dequeue, clearing the queued bit and taking ranges. In the CPU model clear → take protects each dirty event, while take → clear loses a later writer in one schedule. This is a bounded model, not a Rust memory-ordering proof. A compact fixture could arrange a writer between reset and drain and assert that its range is seen on one of two consecutive drains.

**@⁠akimfomin** on GitHub · 2026-11-28 01:56 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/392#issuecomment-7232017730) Source-level comparison with [KLBF #57](https://github.com/PastiiJay/klbf-lab/pull/57): a page bitmap limits copy work there; your queue limits which objects are visited. I enumerated the ten order-preserving interleavings of one writer and a reader around dequeue, clearing the queued bit and taking ranges. In the CPU model `clear → take` protects each dirty event, while `take → clear` loses a later writer in one schedule. This is a bounded model, not a Rust memory-ordering proof. A compact fixture could arrange a writer between reset and drain and assert that its range is seen on one of two consecutive drains.
Author
Owner

@⁠urielbeaupre on GitHub · 2026-11-28 01:57 UTC · original

Thanks, that matches what the code does: it clears, then takes. In card_dirty's take (shadow.rs:1092), the reader does queued.swap(false, AcqRel) first, then reads has_dirty and takes the ranges under the dirty lock. The writer (card_changed_runs, shadow.rs:5334) adds its ranges and sets has_dirty under that lock, releases it, and only then does queued.swap(true, AcqRel). It pushes the copy if that swap returns false.

  • If the writer's swap comes after the reader's clear, it sees false and queues the copy again for the next drain.
  • If it comes before, both are RMWs on queued, so the reader's swap synchronizes with it and sees the ranges.

The worst case is an empty take on the next drain.

The existing test covers the sequential version: card_dirty_takes_queued_copies_once_and_requeues_later_changes makes a change after a take and asserts the next drain returns it. A deterministic writer between the clear and the take needs a test hook inside card_dirty. I can add one behind cfg(test) (a callback run between the swap and the take) so the fixture you describe asserts the range is seen on one of two drains, if that's wanted here.

**@⁠urielbeaupre** on GitHub · 2026-11-28 01:57 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/392#issuecomment-7232030769) Thanks, that matches what the code does: it clears, then takes. In `card_dirty`'s `take` (shadow.rs:1092), the reader does `queued.swap(false, AcqRel)` first, then reads `has_dirty` and takes the ranges under the `dirty` lock. The writer (`card_changed_runs`, shadow.rs:5334) adds its ranges and sets `has_dirty` under that lock, releases it, and only then does `queued.swap(true, AcqRel)`. It pushes the copy if that swap returns `false`. - If the writer's swap comes after the reader's clear, it sees `false` and queues the copy again for the next drain. - If it comes before, both are RMWs on `queued`, so the reader's swap synchronizes with it and sees the ranges. The worst case is an empty take on the next drain. The existing test covers the sequential version: `card_dirty_takes_queued_copies_once_and_requeues_later_changes` makes a change after a take and asserts the next drain returns it. A deterministic writer *between* the clear and the take needs a test hook inside `card_dirty`. I can add one behind `cfg(test)` (a callback run between the swap and the take) so the fixture you describe asserts the range is seen on one of two drains, if that's wanted here.
A test-only hook (CARD_DIRTY_BETWEEN) runs a writer after card_dirty has cleared queued and before it takes the ranges; the range is taken exactly once over two drains.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
Owner

@⁠akimfomin on GitHub · 2026-11-28 02:03 UTC · original

Thanks, that confirms the exact ordering the bounded model checks. The fixture does not need a real GPU: pause the reader after it clears queued, enqueue one second dirty range on the writer, resume the reader, and combine this drain with the next one. Assert the second range appears exactly once across the two drains. A test-only hook would cover the gap you described if the maintainer wants it. The model also has a reversal control where taking before clearing loses that second range.

**@⁠akimfomin** on GitHub · 2026-11-28 02:03 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/392#issuecomment-7232102893) Thanks, that confirms the exact ordering the bounded model checks. The fixture does not need a real GPU: pause the reader after it clears `queued`, enqueue one second dirty range on the writer, resume the reader, and combine this drain with the next one. Assert the second range appears exactly once across the two drains. A test-only hook would cover the gap you described if the maintainer wants it. The model also has a reversal control where taking before clearing loses that second range.
Author
Owner

@⁠urielbeaupre on GitHub · 2026-11-28 02:06 UTC · original

Added in b45345c: a_change_between_clearing_queued_and_taking_is_taken_once_in_two_drains. A test-only hook (CARD_DIRTY_BETWEEN, cfg(test)) runs a writer inside card_dirty after queued is cleared and before the ranges are taken. The test queues a first change, adds a second from the hook, and drains twice. It asserts each range appears exactly once over the two drains and that a third drain is empty.

cargo test -p victory-gpu --lib: 529 passed. One note: in one of four full runs, watch::tests::a_raw_copy_in_watched_memory_keeps_the_other_asked_ranges failed. It passed alone three times and in the next two full runs. It's in the write-watch code, which this PR doesn't touch, so it looks like a pre-existing flake from shared global state, but I haven't confirmed it on main.

**@⁠urielbeaupre** on GitHub · 2026-11-28 02:06 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/392#issuecomment-7232139054) Added in b45345c: `a_change_between_clearing_queued_and_taking_is_taken_once_in_two_drains`. A test-only hook (`CARD_DIRTY_BETWEEN`, `cfg(test)`) runs a writer inside `card_dirty` after `queued` is cleared and before the ranges are taken. The test queues a first change, adds a second from the hook, and drains twice. It asserts each range appears exactly once over the two drains and that a third drain is empty. `cargo test -p victory-gpu --lib`: 529 passed. One note: in one of four full runs, `watch::tests::a_raw_copy_in_watched_memory_keeps_the_other_asked_ranges` failed. It passed alone three times and in the next two full runs. It's in the write-watch code, which this PR doesn't touch, so it looks like a pre-existing flake from shared global state, but I haven't confirmed it on main.
Author
Owner

@⁠akimfomin on GitHub · 2026-11-28 02:08 UTC · original

I checked the updated b45345c1ed7011b1b8441511a7228ee44989d49d against main fe7c6e52198f2070805ffafc4e55a7163291bad0. The pinned Git merge is clean, and the new fixture checks both ranges across two drains and an empty third drain. The single reported write-watch failure still needs an unchanged-main comparison before calling it an existing flake. I have not rerun the full driver suite. Thanks for adding the exact interleaving.

**@⁠akimfomin** on GitHub · 2026-11-28 02:08 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/392#issuecomment-7232162172) I checked the updated `b45345c1ed7011b1b8441511a7228ee44989d49d` against `main` `fe7c6e52198f2070805ffafc4e55a7163291bad0`. The pinned Git merge is clean, and the new fixture checks both ranges across two drains and an empty third drain. The single reported write-watch failure still needs an unchanged-main comparison before calling it an existing flake. I have not rerun the full driver suite. Thanks for adding the exact interleaving.
Author
Owner

@⁠urielbeaupre on GitHub · 2026-11-28 02:19 UTC · original

Compared with unchanged main: 15 full runs of cargo test -p victory-gpu --lib on each, same machine, back to back.

Tree watch::tests::a_raw_copy_in_watched_memory_keeps_the_other_asked_ranges failed Other failures
main fe7c6e5 (clean worktree) 1 of 15 none
this PR b45345c 3 of 15 none

It fails on unchanged main too, so the flake predates this PR. 1 vs 3 of 15 is too small a sample to say whether the PR changes its rate. It doesn't touch watch.rs, but it adds tests that run in parallel and could shift timing against that test's shared global state. I can look into what that test races with if it's worth fixing here or in its own PR.

**@⁠urielbeaupre** on GitHub · 2026-11-28 02:19 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/392#issuecomment-7232285516) Compared with unchanged main: 15 full runs of `cargo test -p victory-gpu --lib` on each, same machine, back to back. | Tree | `watch::tests::a_raw_copy_in_watched_memory_keeps_the_other_asked_ranges` failed | Other failures | |---|---|---| | main `fe7c6e5` (clean worktree) | 1 of 15 | none | | this PR `b45345c` | 3 of 15 | none | It fails on unchanged main too, so the flake predates this PR. 1 vs 3 of 15 is too small a sample to say whether the PR changes its rate. It doesn't touch `watch.rs`, but it adds tests that run in parallel and could shift timing against that test's shared global state. I can look into what that test races with if it's worth fixing here or in its own PR.
Author
Owner

@⁠urielbeaupre on GitHub · 2026-11-28 03:13 UTC · original

Root cause of the write-watch flake: stale VIEWS state left by another test's cleanup (drop_views unmapped views without title_memory_unmapping), hit when the allocator reuses the address. It's unrelated to this PR. The fix is in its own PR, #393: test-only, main went from 5 of 30 failing runs to 0 of 40.

**@⁠urielbeaupre** on GitHub · 2026-11-28 03:13 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/392#issuecomment-7232904064) Root cause of the write-watch flake: stale `VIEWS` state left by another test's cleanup (`drop_views` unmapped views without `title_memory_unmapping`), hit when the allocator reuses the address. It's unrelated to this PR. The fix is in its own PR, #393: test-only, main went from 5 of 30 failing runs to 0 of 40.
Suggested in review; copies are queued either way and a full look clears queued, so the two can alternate.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
Owner

@⁠maximecmb on GitHub · 2026-11-28 09:45 UTC · original

Measured in play on a second card: RTX 5080 16 GB, Ryzen 7 9800X3D (8 cores), 64 GB, Series S, -Machine auto, diagnostics build of fe7c6e5 with this PR and 396 merged.

To have both ways in one run, card_dirty_scan() was changed locally to answer crate::ab::pick("VICTORY_CARD_DIRTY_SCAN") first (copies are queued either way and a full look clears queued, so the two can alternate), and the prologue was played by hand from its save with VICTORY_AB=5,VICTORY_CARD_DIRTY_SCAN: prison, robbery, chase on foot, jet ski, docks, 420 s in the world. Frame time with the scan, less with the queue, inside each full cycle:

Phases of Mean Median Cycles where the queue was faster
2,000 draws a frame or more +1.4 ms (± 0.7) +1.6 ms (± 0.8) 24 of 35
3,000 or more +1.1 ms (± 0.8) +0.7 ms (± 0.6) 15 of 25
6,000 or more (outdoors) +1.0 ms (± 1.9) +0.6 ms (± 1.2) 5 of 10

Frames were 43 ms on average over those phases (53 ms outdoors). A sampling profile of victory-submit over the outdoor part of the same route, on main before this PR, had card_dirty at 3.3 % of the thread's running time with about 3,700 copies in the card's memory, which is about the same millisecond.

No error and no device loss in 7 minutes, through to the Chapter I title. The recording was reviewed from one frame every 3 s: nothing comes and goes with the phases.

Limits: one PC, one run. Outdoors alone the difference is inside the noise. 396 has no switch, so it is on both sides.

If the switch were read through ab::pick as above, others could measure it the same way in one run.

**@⁠maximecmb** on GitHub · 2026-11-28 09:45 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/392#issuecomment-7237442462) Measured in play on a second card: RTX 5080 16 GB, Ryzen 7 9800X3D (8 cores), 64 GB, Series S, `-Machine auto`, diagnostics build of `fe7c6e5` with this PR and 396 merged. To have both ways in one run, `card_dirty_scan()` was changed locally to answer `crate::ab::pick("VICTORY_CARD_DIRTY_SCAN")` first (copies are queued either way and a full look clears `queued`, so the two can alternate), and the prologue was played by hand from its save with `VICTORY_AB=5,VICTORY_CARD_DIRTY_SCAN`: prison, robbery, chase on foot, jet ski, docks, 420 s in the world. Frame time with the scan, less with the queue, inside each full cycle: | Phases of | Mean | Median | Cycles where the queue was faster | |---|---|---|---| | 2,000 draws a frame or more | +1.4 ms (± 0.7) | +1.6 ms (± 0.8) | 24 of 35 | | 3,000 or more | +1.1 ms (± 0.8) | +0.7 ms (± 0.6) | 15 of 25 | | 6,000 or more (outdoors) | +1.0 ms (± 1.9) | +0.6 ms (± 1.2) | 5 of 10 | Frames were 43 ms on average over those phases (53 ms outdoors). A sampling profile of `victory-submit` over the outdoor part of the same route, on `main` before this PR, had `card_dirty` at 3.3 % of the thread's running time with about 3,700 copies in the card's memory, which is about the same millisecond. No error and no device loss in 7 minutes, through to the Chapter I title. The recording was reviewed from one frame every 3 s: nothing comes and goes with the phases. Limits: one PC, one run. Outdoors alone the difference is inside the noise. 396 has no switch, so it is on both sides. If the switch were read through `ab::pick` as above, others could measure it the same way in one run.
Author
Owner

@⁠urielbeaupre on GitHub · 2026-11-28 09:47 UTC · original

Thanks for measuring it through the whole prologue. Done in fb40506: card_dirty_scan() now takes crate::ab::pick("VICTORY_CARD_DIRTY_SCAN") first, in diagnostics builds, so VICTORY_AB=<s>,VICTORY_CARD_DIRTY_SCAN alternates the two in one run. Outside an A/B run it reads the variable as before. Card-dirty tests pass, clippy is clean.

**@⁠urielbeaupre** on GitHub · 2026-11-28 09:47 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/392#issuecomment-7237465822) Thanks for measuring it through the whole prologue. Done in fb40506: `card_dirty_scan()` now takes `crate::ab::pick("VICTORY_CARD_DIRTY_SCAN")` first, in diagnostics builds, so `VICTORY_AB=<s>,VICTORY_CARD_DIRTY_SCAN` alternates the two in one run. Outside an A/B run it reads the variable as before. Card-dirty tests pass, clippy is clean.
Author
Owner

@⁠Kal0s-design on GitHub · 2026-11-28 18:38 UTC · original

Went through fb40506 for lost changes, since that's the failure mode that would matter here (a card copy left stale until something else forces a full look).

The invariant I checked is: if queued is true, the copy is in CARD_QUEUE, or CARD_SCAN_ALL is set and the copy will be in CARDED by the time a full look can take it. Each path keeps it:

  • Writer vs drain. Covered in the thread already: ranges and has_dirty under the lock, then queued.swap(true); the drain swaps queued to false before reading has_dirty. Both RMWs on queued, so either the drain sees the ranges or the writer requeues. The new fixture pins that schedule.
  • Change before tracking. The writer finds no me and sets CARD_SCAN_ALL. If that full look runs before track_carded pushes the copy into CARDED, it misses it and queued stays true. track_carded then sees has_dirty still true and asks for another full look, and in production nothing but card_dirty drains dirty, so it can't have been cleared in between. send_up/take_dirty drain it too, but they're in the cfg(test) impl.
  • Queue taken, then a full look. The taken queue is dropped on that path, which is fine because every copy with me set was pushed into CARDED first, so the full look covers it.
  • Copies that die. upgrade fails and they're skipped. CARDED holds dead Weaks for up to 1,024 calls, which only costs memory.

On native Windows (NVIDIA card) the 61 shadow:: tests pass, the three card_dirty tests passed 200 of 200 repeated runs together, and the branch merges cleanly on current main (fe7c6e5).

One small test-only thing: track_carded_test's Tracked drop takes the copy out of CARDED but me stays set. A later change to that copy still queues it, and card_dirty hands it out, where the old code would have ignored it. unbacked copies are leaked and the tests filter with mine, so nothing hits it now. I'm only mentioning it in case a future test assumes an untracked copy is never returned.

AI-assisted: yes

**@⁠Kal0s-design** on GitHub · 2026-11-28 18:38 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/392#issuecomment-7243941922) Went through `fb40506` for lost changes, since that's the failure mode that would matter here (a card copy left stale until something else forces a full look). The invariant I checked is: if `queued` is true, the copy is in `CARD_QUEUE`, or `CARD_SCAN_ALL` is set and the copy will be in `CARDED` by the time a full look can take it. Each path keeps it: - **Writer vs drain.** Covered in the thread already: ranges and `has_dirty` under the lock, then `queued.swap(true)`; the drain swaps `queued` to false before reading `has_dirty`. Both RMWs on `queued`, so either the drain sees the ranges or the writer requeues. The new fixture pins that schedule. - **Change before tracking.** The writer finds no `me` and sets `CARD_SCAN_ALL`. If that full look runs before `track_carded` pushes the copy into `CARDED`, it misses it and `queued` stays true. `track_carded` then sees `has_dirty` still true and asks for another full look, and in production nothing but `card_dirty` drains `dirty`, so it can't have been cleared in between. `send_up`/`take_dirty` drain it too, but they're in the `cfg(test)` impl. - **Queue taken, then a full look.** The taken queue is dropped on that path, which is fine because every copy with `me` set was pushed into `CARDED` first, so the full look covers it. - **Copies that die.** `upgrade` fails and they're skipped. `CARDED` holds dead `Weak`s for up to 1,024 calls, which only costs memory. On native Windows (NVIDIA card) the 61 `shadow::` tests pass, the three `card_dirty` tests passed 200 of 200 repeated runs together, and the branch merges cleanly on current `main` (`fe7c6e5`). One small test-only thing: `track_carded_test`'s `Tracked` drop takes the copy out of `CARDED` but `me` stays set. A later change to that copy still queues it, and `card_dirty` hands it out, where the old code would have ignored it. `unbacked` copies are leaked and the tests filter with `mine`, so nothing hits it now. I'm only mentioning it in case a future test assumes an untracked copy is never returned. AI-assisted: yes
Author
Owner

@⁠TaynanGT on GitHub · 2026-11-29 11:37 UTC · original

Thanks for tracing the writer/drain and pre-tracking cases. The 200 repeated runs are useful evidence. Please document the test-only untracking caveat, and retain a regression for a write arriving after the drain clears queued so no update can disappear.

**@⁠TaynanGT** on GitHub · 2026-11-29 11:37 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/392#issuecomment-7255238083) Thanks for tracing the writer/drain and pre-tracking cases. The 200 repeated runs are useful evidence. Please document the test-only untracking caveat, and retain a regression for a write arriving after the drain clears queued so no update can disappear.
github-bot closed this pull request 2026-11-30 17:14:35 +00:00
Author
Owner

@⁠TaynanGT on GitHub · 2026-11-30 17:09 UTC · original

main has moved to a new line of the code and everything is now named Vice-Tay, so this PR no longer applies as it is (details in #468). If you'd like this change in, please rebuild it on the current main and open a new PR; I'll review it there.

**@⁠TaynanGT** on GitHub · 2026-11-30 17:09 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/392#issuecomment-7285821818) `main` has moved to a new line of the code and everything is now named Vice-Tay, so this PR no longer applies as it is (details in #468). If you'd like this change in, please rebuild it on the current `main` and open a new PR; I'll review it there.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.