fix: count every loose window copy against VICTORY_WINDOW_BUDGET_MB #466
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/466"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from LooperSalty/AnyXboxX. Originally posted by KainanP on 2026-11-27T00:11:06Z.
Fixes #450.
The bug, on the Vice-Tay base (
b6d86cf8)#454 brought the window budget back (
VICTORY_WINDOW_BUDGET_MB, inshadow.rs), and the problem FunWithFlagsDev found on the combined base is there too.let_go_idle()filtersLOOSEdown to the copies that can go (strong count 1, idle foridle_msand 4 frames, COM references 1).window_victims()then compared the budget with the bytes of those copies alone. Copies held by a list or a slot, or used recently, never counted. In the issue's row (3,072 MiB held plus 1,536 MiB idle against a 2,048 MiB budget), nothing went.Both are confirmed against main's
window_victims. The issue's row gives[]where all three idle copies should go, and two due copies under a budget they fit in give[]where the sweep without a budget releases both.The change
The budget is compared with the unique bytes of every loose copy, eligible or not (
loose_bytes, deduplicated by copy identity like the diagnosticmemory()). The oldest eligible copies go until that total fits or none are left. Copies that can't go stay; the target isn't always reachable, and that's accepted.Copies in place (
crate::inplace) hold no copy of their own, so they count as 0 bytes (copy_bytes). They're never chosen to meet the budget, but they still go once due.Copies that have been idle for the time the sweep uses without a budget (
ram_idle_ms) are markeddueand go whatever the budget, so a budget never keeps more than no budget would. The band's shorter idle time (10 s in Watch, 2 s in High) only adds candidates for meeting the budget.A copy that stands under several keys goes under all of them. Before, only one key was removed while its bytes were counted as freed. In practice the
strong_count == 1filter keeps such a copy out of the eligible list, but the accounting now matches what it frees.The let-go tally (second commit, after akimfomin's review):
LET_GO[1]stays the title memory the windows let go spanned, in-place windows included. A newLET_GO[2]counts the host-copy bytes they owned (copy_bytes). The memory line and thesweep:trail line print both, so a 4 MiB in-place window plus an 8 MiB copy reads as 12 MiB spanned and 8 MiB owned, not as 12 MiB let go. Test:let_go_tally_keeps_span_and_owned_copy_bytes_apart.Behaviour changes
VICTORY_WINDOW_BUDGET_MBunset, or the Calm band: unchanged.window_mapped_for, card memory the CPU writes) count as copies, the same as before. Only in-place ones are excluded.Tests (rule 5)
shadow::window_tests:window_budget_counts_the_copies_that_cannot_go: the issue's row. 3,072 held + 1,536 idle against 2,048 MiB means all idle copies go; against 4,096 MiB only the oldest goes; under the budget nothing goes.window_budget_never_keeps_what_the_sweep_lets_go_without_one: due copies go even when everything fits; over the budget the rest go oldest first.window_budget_passes_over_copies_in_place.window_budget_counts_one_copy_under_several_keys_oncenow expects the shared copy under both of its keys ([0, 1]instead of[0]), for the reason above.The first two encode cases that main's
window_victimsgets wrong (checked with a throwaway test on main:[]for both).Run here (RTX 4060 Laptop GPU, Intel UHD iGPU, WARP). Rerun on
1399bff6(rebased onmainb62053fe): 503 passed in 10 of 10 runs on RTX, 2 of 2 on Intel UHD, and 6 of 7 on WARP; the other WARP run had onewatch.rstiming failure (what_the_kernel_writes_through_is_not_guarded_for_another_view). The table is from the first head:cargo test -p victory-gpu --lib --release --features diagnostics, RTXwatch.rswrite-watch timing test (what_is_put_in_beside_the_guards_is_told_at_every_view,no_write_is_lost_with_port_7), and both passed on rerun.watch.rsisn't touched here; main shows the same kind of failure (nothing_is_guarded_between_our_forgetting_it_and_its_unmapping, 1 in 112 runs)VICTORY_D3D12_ADAPTER=IntelVICTORY_D3D12_WARP=1cargo clippy -p victory-gpu --lib --testsoverlay.rsone as main)cargo xtask policycargo build --release --workspace --exclude anyxboxx-launcherNo launcher-visible change: the launcher sets no window budget.
Asking for an A/B
The budget only acts in the Watch and High RAM bands, so the useful run is on a machine that gets there. That means 16 GB of RAM, or an 8 GB card where Windows spills into shared memory. If you have one, please run with
VICTORY_WINDOW_BUDGET_MBset (for example 2048) onmainand on this branch, and compare private bytes and commit, how many window copies go and are made again (sweep:trail lines, the memory line), and frame times (VICTORY_FRAMETIME_DUMP=1).Credit: FunWithFlagsDev for the analysis and the test row in #450. Thanks to akimfomin for the review of the memory work on #449.
AI use: code, tests and this description written with Claude Code; tests run locally on RTX, Intel UHD and WARP; nothing was run in game.
🤖 Generated with Claude Code
Imported from LooperSalty/AnyXboxX. Originally posted by akimfomin on 2026-11-27T01:17:55Z.
PortBridge checked this head against the pinned receiving main
5a08a334ef216eff98d2c7d9a9166f94c9ef70ed: Git reports a clean merge, withshadow.rsas the only changed file. For the one-change A/B I kept your merge baseb6d86cf8separate from that later receiving commit.PortBridge Lab #109 now has your synthetic test and the Watch/High-only acceptance criteria. I shared it with a Vice-Tay reporter who already measured the separate 16 GB RAM throttle. There is no new hardware result yet. If a volunteer submits one, I'll return the aggregates here with their attribution.
Imported from LooperSalty/AnyXboxX. Originally posted by akimfomin on 2026-11-27T02:25:31Z.
PortBridge checked one detail that matters for the requested 16 GB A/B. At
02bc88444ba29bfe47d44b2c76537839117ab2aa, the budget correctly charges zero for an in-place window, but the existing sweep adds its full logical length toLET_GO[1]and reports that length before retirement. In a two-window CPU check, letting go of a 4 MiB in-place mapping plus an 8 MiB allocated copy produces a 12 MiB logical tally for 8 MiB of owned copies. Neither number proves that resident RAM fell immediately. This is a measurement caveat, separate from whether the victim selection is correct.For PortBridge Lab #109, compare process private bytes and free RAM in the same warm interval, alongside re-copy count and frame time. Treat the sweep byte count as window span. If copy-byte telemetry is wanted, reporting the two amounts separately would preserve the existing diagnostic. PortBridge also surfaced VIctory #1250: its double reservation is for GPU upload/staging fallback, a separate accounting rule from #466's held host copies. Budget accounting · Sweep tally and retirement
Imported from LooperSalty/AnyXboxX. Originally posted by KainanP on 2026-11-27T10:45:25Z.
@akimfomin, thanks, you're right. The budget charged an in-place window nothing, but the sweep's tally still added the window's whole logical length, so your two-window case printed 12 MiB for 8 MiB of owned copies. I took your suggestion and now report the two amounts separately.
New commit
1399bff6(rebased onmainb62053fe; the #450 commit is now4228f760):LET_GO[1]keeps its meaning, and its doc now says what that is: the title memory the windows let go spanned, in-place windows included.LET_GO[2]is new: of that span, the bytes of host copies the windows owned (copy_bytes; none for a window in place). That's the same rule the budget charges.N windows outside buffers X MB spanned (Y MB of owned host copies; a window in place owns none). The sweep'ssweep:trail line gives both in KiB.retire. For the A/B, private bytes and free RAM in the same warm interval remain the measure, as you wrote in Lab #109.let_go_tally_keeps_span_and_owned_copy_bytes_apartis your case: a 4 MiB in-place window plus an 8 MiB copy gives 2 windows, 12 MiB spanned, 8 MiB owned.Tests on
1399bff6:cargo test -p victory-gpu --lib --release --features diagnostics, RTX 4060 LaptopVICTORY_D3D12_ADAPTER=IntelVICTORY_D3D12_WARP=1watch::tests::what_the_kernel_writes_through_is_not_guarded_for_another_view, a write-watch timing test inwatch.rs, which this PR doesn't touch (the same kind of intermittent failure as noted in the description)cargo clippy -p victory-gpu --all-targets --features diagnosticsmain(manual implementation of .is_multiple_of())cargo xtask policyruff check --select W605,F,E9Noted on VIctory #1250: its double reservation is GPU upload/staging fallback, a separate rule from the held host copies here, so nothing changes in this PR for it.
AI use: Claude Code (Claude Opus 5.5).