Skip to content

GPU: keep valid marked writes beside withheld ranges - #1998

Open
Halfect wants to merge 3 commits into
Marvisak:mainfrom
Halfect:fix/marked-withheld-same-page
Open

Halfect wants to merge 3 commits into
Marvisak:mainfrom
Halfect:fix/marked-withheld-same-page

Conversation

@Halfect

@Halfect Halfect commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

What

Fixes #1976.

copy_back_marks no longer skips a whole 64 KiB page when a missed list's range overlaps it. It now subtracts the withheld ranges and lets copy_back_marked process the rest of the page.

  • A disjoint valid marked write goes back even when a missed range shares its page.
  • Withheld bytes stay out of title memory and remain in the host copy; bytes elsewhere in the page, including undeclared direct writes, retain the existing copy-back behavior.
  • A page is marked fully synchronized only when no withheld range was left different.
  • A later marked submission is not suppressed after an earlier partial copy-back consumed the page's saved snapshot. For an already-changed page with no fresh title-side snapshot, writing saves the submission's host bytes as its comparison baseline; an existing title-side snapshot still takes precedence.

Regression coverage

  • A one-page D3D12 test records a valid four-byte write at offset 64 and a missed write at offset 256 behind the same page mark. It checks that the valid bytes reach title memory, the missed bytes do not, and the missed bytes remain in the host copy.
  • The D3D12 fixture now includes subsequent-mark, different-page, and no-withholding controls.
  • A focused second-submission regression covers a title write while the first submission is armed, partial copy-back consuming saved, another title write between submissions, and a later marked write without an intervening refresh. It checks publication of the later GPU write, preservation of the newer title bytes, and that old withheld bytes do not reappear.
  • Pure range tests cover the reported gap, unsorted and overlapping withheld ranges, clipping, and a fully withheld page.

Checks

  • GitHub Windows CI at b49aa3f: success.
  • Earlier independent GPU runs validated the original same-page fix on RTX 3080, RTX 5070, and RX 7800 XT; those runs predate the expanded second-submission fixture and do not establish its execution on b49aa3f.
  • cargo xtask policy: 182 files ok.
  • git diff --check: clean.
  • macOS cannot compile victory-gpu on main (host_resource is unavailable in resource.rs), so local execution was limited to platform-independent checks. GPU execution of the expanded fixture remains to be established by an independent Windows/GPU run.

No title executable, world run, or game data was used. AI-assisted (Kimi).

@DesertGamer

Copy link
Copy Markdown

VIctory V2: community PRs, merged and tested

Open PRs sitting in the queue? V2 pulls them into one build, screens each one (binaries, build scripts, hooks, new deps) and runs tests after every batch.

Where it stands today: launches, runs the menu at 30 fps, plays the intro video, reaches the start screen and loads the world (~50 s). Entering the world is the current blocker: rendering fails with a GPU "device removed" error (tracked in issue #1).

⚠️ Entering the world on a real GPU can hang it and make Windows reset the driver. Try it at your own risk.

Not playable yet, but every batch of merged fixes moves it closer. If you have a PR that's stuck, or a GPU to test on, I'd love your help:
https://DesertGamer/VIctory-V2

Unofficial community fork of Marvisak/VIctory, GPL-3.0.

@BaggyALPHA

Copy link
Copy Markdown
Contributor

Independent Windows verification on RTX 3080. At 1d8754a, the GPU-backed same-page test passes. Restoring the old whole-page skip locally makes that same test fail on the valid write assertion, confirming it exercises the changed path.

The failing withheld_ranges_are_cut_out_without_losing_the_gaps assertion has a one-line expected-value error. The withheld interval [page + 80, page + 120) clips to [page + 80, page + 100), so the second surviving interval ends at page + 80:

[(page, page + 10), (page + 50, page + 80)]

With only that expected value corrected locally, cargo test -p victory-gpu --locked -- --test-threads=1 passed 147 tests, 0 failed, 2 ignored. The test tree used upstream 940d32f, this PR, #1963 for the neighboring copy-back regressions, and #1751 for the known NVIDIA descriptor-heap failures. All inputs were synthetic.

AI-assisted (OpenAI Codex).

@catminou4 catminou4 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Static review only: victory-gpu is Windows-only (D3D12/windows_sys) — nothing compiles or runs on macOS; source review of the diff.

Keep valid marked writes beside withheld ranges — same cluster as #1986/#2004 (issue #1976); duplicate effort, reconcile before merge.

@welisonzika14-jpg

Copy link
Copy Markdown

RTX 5070 (Blackwell, driver 621.24), Ryzen 7 5700X, Windows 11, Rust 1.98.1 MSVC. No game files, unit tests only. cargo test -p victory-gpu --lib, run twice.

#2004 covers the same issue (#1976); it also passes here, see there.

Written with AI help (Claude/Kiro); the numbers are from runs on my machine.

@jeremygold02

jeremygold02 commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Triage verdict — Preferred starting point, needs a regression test (3385794)

Evidence

  • I’d use 3385794’s outside-withheld spans as the basis for the GPU: a withheld range can suppress a disjoint valid marked write on the same page #1976 fix. This keeps the writes themselves out of the holes and avoids declaring a divergent page current. There is a second-submission case I’d check before merging: copy_back_marked consumes t.saved(page), then leaves changed set when holes prevent taken. If the title had changed the page and a later mark arrives without a fresh saved snapshot or intervening full refresh, the saved.is_none() && t.changed(page) branch can skip the later copy-back.

Checks and limits

  • That is a source-level concern; the current tests do not exercise that interleaving.
  • cargo test --locked -p victory-gpu --lib withheld -- --test-threads=1 reported both selected tests passing on this head, including the corrected CPU interval test. The same-page test can return early if D3D12 setup is unavailable, so that local output alone does not establish GPU execution.

Next step

This verification was AI-assisted.

@Calvix2k

Copy link
Copy Markdown
Contributor

Independent run on Windows 10 19045, RX 7800 XT (RDNA3), your head 3385794:

cargo test -p victory-gpu --features diagnostics --lib shadow:: — 6 passed, 0 failed, including withheld_ranges_are_cut_out_without_losing_the_gaps and a_withheld_range_does_not_suppress_the_pages_other_writes.

That is the same result @jeremygold02 got on an RTX 3080 for the next-refresh case that #2004 fails 3/3: your taken condition ("only when no withheld range was left different") is what makes the second submission not resurrect the withheld bytes. I closed none of these; but from my side this is the implementation to pick for #1976, and #2004's regression idea is already covered here by withheld_ranges_are_cut_out_without_losing_the_gaps.

@Halfect

Halfect commented Nov 25, 2026

Copy link
Copy Markdown
Contributor Author

Addressed the second-submission review concern in b49aa3f.

  • Ported the subsequent-mark, different-page, and no-withholding controls into the D3D12 fixture.
  • Added a focused interleaving: a title write while the first submission is armed, partial copy-back consuming saved, another title write between submissions, then a later marked write with no intervening refresh. It asserts both that the later GPU write is published and that the old withheld bytes do not replace the newer title bytes.
  • For an already-changed page with no fresh title snapshot, writing now saves the submission's host bytes as its comparison baseline. An existing title-side snapshot still takes precedence; the taken guard for withheld pages remains unchanged.

cargo xtask policy passes (182 files), and git diff --check is clean. macOS compilation still stops only at main's existing resource.rs:284 host_resource error. Windows CI is running; GPU execution of the expanded fixture remains to be established by that run or an independent Windows/GPU run.

@Calvix2k

Copy link
Copy Markdown
Contributor

Re-verified on b49aa3f, Windows 10 19045 / RX 7800 XT: cargo test -p victory-gpu --features diagnostics --lib shadow:: — 7 passed, 0 failed, including the interleaving case where a title write lands in a withheld range between two submissions.

That was the gap in #2004 and it is covered now. From my side this is ready for a maintainer; #2004 is closed, so there is only one implementation left to review.

@andrewpozdnakov7-jpg

Copy link
Copy Markdown
Contributor

I compared the two copy-back cases on WARP at the current heads of #1986 and #1998.

1dbad74 ports my earlier 5b6583d snapshot fix and regression directly onto b49aa3f665964a9e687b475e30e296cee4271ffd, using your existing outside_withheld helper. With the follow-up, the same snapshot test keeps both withheld words in the host copy only, and the second marked submission still writes 0x77777777. The full WARP GPU suite goes from 149 passed / 1 failed / 2 ignored to 150 passed / 0 failed / 2 ignored. Strict GPU Clippy in both modes and the staged asset policy passed.

If you include the follow-up or its regression, please preserve the Git author when cherry-picking it. If you fold it into your own commit, please add:

Co-authored-by: andrewpozdnakov7-jpg andrewpozdnakov7-jpg@users.noreply.github.com

@Halfect

Halfect commented Nov 25, 2026

Copy link
Copy Markdown
Contributor Author

Thanks @andrewpozdnakov7-jpg — I cherry-picked 1dbad74 as 2679f3a, preserving your Git authorship.

This adds the snapshot-backed overlapping-withholding regression and keeps withheld intervals out of snapshot copy-back while allowing the surviving ranges to retire normally.

CPU-only validation on 2679f3a:

  • cargo test --locked -p victory-gpu --lib withheld_ranges_are_cut_out_without_losing_the_gaps: 1 passed, 0 failed.
  • cargo clippy --locked -p victory-gpu --all-targets -- -D warnings: clean.
  • cargo xtask policy: 182 files ok.
  • git diff --check: clean.

I did not execute the new GPU-backed regression locally; that remains for Windows CI or an independent Windows/GPU run.

Marvisak commented Nov 25, 2026 •

Copy link
Copy Markdown
Owner

Automated triage for the maintainers.

Merge candidate. Re-reviewed after the rebase onto f3578e3. The PR fixes #1976. copy_back_marks in crates/victory-gpu/src/shadow.rs no longer skips a whole page that a withheld list overlaps. copy_back_marked and copy_back_or_not now retire only the spans outside_withheld returns, and a page with a hole is not marked taken. A page that is already changed and has no title-side snapshot gets the submission's host bytes as its baseline (Tracked::save_host, or_insert). disarm clears that baseline after every submission, so a stale one can't carry over. The per-byte merge still goes through main's merge_writeback, and #2377's partial_refresh_under_marked_range_updates_saved_bytes is kept. The mark-bitmap tests now hold the submission lock, a #[cfg(test)] accessor in host.rs.

One thing for the reviewer: the rebase removes main's coarse rule in Host::execute that withheld any ordinary range overlapping a withheld range of the same copy. It changes the assertion in main's withholding::only_programs_using_title_memory_are_withheld from (0, 0) to (0x44, 0x44). That follows from the byte-exact exclusion and reads correctly to me, but it reverses a decision main made recently. The GPU runs in the thread (RTX 3070, RX 7800 XT, WARP) were on earlier heads. The author's run on this head covers the full victory-gpu lib suite with no new failures.

On your reply: thanks for the careful rebase notes and for keeping the co-author's commit intact.

CI: passing (check).


Generated by Claude Code

@upipibi

upipibi commented Nov 25, 2026 •

Copy link
Copy Markdown

@Halfect Windows GPU run of 2679f3a, as you asked: RTX 3070 (Ampere, driver 616.56, Windows 11).

  • The four new tests (snapshot_copy_back_keeps_overlapping_withheld_bytes_on_the_gpu, a_withheld_range_does_not_suppress_the_pages_other_writes, a_title_write_does_not_suppress_the_next_marked_submission, withheld_ranges_are_cut_out_without_losing_the_gaps) with --test-threads=1: 4 passed, 0 failed in 3 of 3 runs.
  • cargo test -p victory-gpu --locked (parallel), 3 runs. Every run fails descriptor::host::tests::dynamic_slots_are_held_until_released and memory::tests::lists_share_a_table_and_copies_keep_their_views, the NVIDIA heap-cap pair that main 940d32f fails here too (1 run). Two runs had one more failure each:
    • run 1: watch::tests::writes_through_another_mapping_mark_the_tracker (watch.rs:858, left: []). It passes alone 3 of 3, on this PR and on main.
    • run 3: this PR's shadow::tests::a_withheld_range_does_not_suppress_the_pages_other_writes, at shadow.rs:1306: "the valid write on the shared page goes back", left: [0, 0, 0, 0], right: [90, 90, 90, 90].

Rates (measured afterwards, same build):

  • the four new tests with --test-threads=1: 0 failures in 20 more runs (23 in total);
  • shadow:: and watch:: together, parallel (cargo test -p victory-gpu --lib -- shadow:: watch::): 0 failures in 20 runs;
  • the full parallel victory-gpu suite on this PR: 10 more runs. Beyond the heap-cap pair, a_withheld_range_does_not_suppress_the_pages_other_writes failed in none of them (1 of 13 in total), and one run had two watch:: failures (writes_mark_every_tracker_of_their_page, writes_through_another_mapping_mark_the_tracker);
  • main 940d32f, watch:: alone, parallel: 0 failures in 20 runs.

Counted by script over the logs (corrected; I first wrote 4 of 13 and 7%): on this PR, 3 of 13 full parallel runs had an extra failure beyond the heap-cap pair (4 failures in all: watch:: in 2 runs, one of them with two, and a_withheld_range... in 1). On main 940d32f, 0 of 11 runs. If 3 bad runs were spread at random over all 24, all 3 landing on this PR has a probability of about 14%, so this can't be told apart from main. The extra failures came only under the full parallel suite, never with shadow:: and watch:: on their own.

AI-assisted (Claude Code). Synthetic tests only.

@Halfect

Halfect commented Nov 25, 2026

Copy link
Copy Markdown
Contributor Author

Thanks @upipibi — that single parallel failure was a real find, and the "passes alone 3 of 3" detail is what pinned it down. Root-caused and fixed in 329c162.

Root cause (test isolation, not the copy-back logic). The written-pages bitmap is process-wide, and copy_back_marks consumes every set bit, mapping each to its owning copy. Production runs all copy-backs under the submission lock (Host::execute: "one submission at a time from preparation to copy-back"), but the shadow tests set bits and call copy_back_marks directly, outside that lock. In a parallel run, another test's submission — or one of the other mark tests — can consume this test's bits first and copy its page back with the caller's (empty) withheld list; the test's own copy_back_marks then finds nothing set. Depending on timing that shows up either as the valid write missing (your run 3) or as the withheld bytes leaking. The race needs two mark-bit tests live at once, which is why it only appears with this PR's added tests and only under parallel scheduling.

Fix. The three tests that set bits (marked_pages_go_back_by_the_bytes_the_gpu_changed, a_withheld_range_does_not_suppress_the_pages_other_writes, a_title_write_does_not_suppress_the_next_marked_submission) now hold the submission lock for their whole body — the same serialization production copy-backs run under. The snapshot fixture goes through Host::execute, which takes the lock itself, so it needs nothing. No production code changes behavior (+19 lines, test-only besides a #[cfg(test)] accessor).

Validation on this head (Windows, NVIDIA):

  • The four tests you named, with --test-threads=1: 5 passed, 0 failed (the fifth is the range helper).
  • cargo test -p victory-gpu --locked full parallel suite, 12 consecutive runs: 0 shadow/watch failures.
  • The remaining parallel failures on this machine (draw::, bindless::, indirect::, pipeline::library, host::list_scratch, the NVIDIA descriptor heap-cap pair) reproduce identically on unmodified main 940d32f built and run the same way (12 runs; same families, same or higher counts), so they are the pre-existing NVIDIA parallel class, not this PR. Your run-1 watch::tests::writes_through_another_mapping_mark_the_tracker flake belongs to that class too — this PR doesn't touch the tracking/aliasing paths it exercises.
  • cargo clippy -p victory-gpu --all-targets -- -D warnings: clean. cargo xtask policy: 182 files ok. git diff --check: clean.

If you're willing, a repeat of your parallel RTX 3070 run on 329c162 would be the confirmation that counts — your environment is the one that caught it.

@upipibi

upipibi commented Nov 25, 2026 •

Copy link
Copy Markdown

@Halfect Repeated at 329c162 on the same RTX 3070 (driver 616.56), same build setup: cargo test -p victory-gpu --locked full parallel suite, 10 runs, plus the four new tests with --test-threads=1, 3 runs.

  • a_withheld_range_does_not_suppress_the_pages_other_writes passed in all 10 parallel runs here (before: 1 of 13; p ≈ 0.57, so this alone can't show the fix, though it agrees with it). The four new tests single-threaded: 4 passed, 0 failed, 3 of 3.
  • Two parallel runs still had one watch:: failure each, beyond the heap-cap pair:
    • watch::tests::kernel_reads_into_guarded_blocks_after_opening (watch.rs:792): "the kernel does not fault into our handler"
    • watch::tests::writes_through_another_mapping_mark_the_tracker (watch.rs:858): left: [], right: [(1892664541184, 1892664606720)]
  • On this card, unmodified main 940d32f showed no watch:: failure in 11 full parallel runs. Counted by script (corrected; I first wrote 3 of 13): before this commit watch:: failures were in 2 of 13 PR runs, at 329c162 in 2 of 10. Against 0 of 11 on main, 2 of 10 has a probability of about 21% of being chance, so it can't be told apart from main. Your machine showed none in 12. I haven't looked into the cause.

AI-assisted (Claude Code). Synthetic tests only.

@andrewpozdnakov7-jpg

Copy link
Copy Markdown
Contributor

I independently checked 329c162 on forced WARP with 16 test threads. All three marked copy-back tests passed in 60 of 60 full GPU suite runs. The eight shadow tests also passed together with one thread. The one additional failure was bindless::tests::heap_views_follow_writes_through_another_mapping, with the 0 versus 1064 result already recorded in #2252. I did not reproduce the separate watch failures in these WARP runs.

On the old 2679f3a tree, the withheld-range test failed once in a 60-run parallel batch. I also forced a second bitmap consumer after the first mark in that exact fixture and read [165, 165, 165, 165] from bytes that should have stayed zero. The submission lock in 329c162 covers that interleaving.

For the remaining watch failures, #1913 covers a known test fixture that can retain a watch on a freed pool and applies cleanly alongside 329c162. The original GPU snapshot commit 2679f3a is still the direct parent. If the contribution is squashed, please retain:

Co-authored-by: andrewpozdnakov7-jpg andrewpozdnakov7-jpg@users.noreply.github.com

AI-assisted. Synthetic tests only.

@Halfect

Halfect commented Nov 25, 2026

Copy link
Copy Markdown
Contributor Author

Thanks @upipibi for the rerun on the same RTX 3070 — the target test passing in all 10 parallel runs plus the single-threaded 3/3 is the confirmation I was after, and the statistical framing (2 of 10 vs 0 of 11, ~21% chance) correctly says the remaining watch:: flakes can't be told apart from main here. Those two tests exercise watch/aliasing paths this PR doesn't change; as @andrewpozdnakov7-jpg notes, #1913 covers a known fixture that can retain a watch on a freed pool, which is the plausible candidate for that class and applies cleanly alongside this head.

Thanks @andrewpozdnakov7-jpg for the forced-WARP 60/60 verification and for reproducing the bitmap-consumer race on the old tree — that's a clean confirmation of the root cause. On attribution: your snapshot fix stands as its own commit 2679f3a on this branch with your Git authorship intact, and if the branch is ever squashed I will retain Co-authored-by: andrewpozdnakov7-jpg <andrewpozdnakov7-jpg@users.noreply.github.com> in the final message.

Nothing further from my side; ready for review.

@Halfect
Halfect force-pushed the fix/marked-withheld-same-page branch from 329c162 to 57969ea Compare November 25, 2026 17:44
@Halfect

Halfect commented Nov 25, 2026

Copy link
Copy Markdown
Contributor Author

Rebased onto current main 13f91ca and pushed 57969ea; the branch merges cleanly again. Main's memory-withholding work landed since the last head, and the rebase reconciles this PR with it:

  • Marks path (this PR's core). copy_back_marks keeps main's two-bitmap collection and memory_withheld handling; the per-page whole-skip is replaced with this PR's per-range filtering, so a page another list also marked still gets its valid writes back beside the withheld ranges. Main's new marks_of_shaders_using_title_memory_are_held_back and what_a_frame_withholds_leaves_the_copies_at_its_end tests are kept and pass.
  • Snapshot path. Main withheld an allowed range whole when it overlapped a withheld range of the same copy ("its copy-back would take the other's bytes along"). That premise is gone here: copy_back's exclusion (outside_withheld) retires exactly the allowed bytes, so the coarse suppression loop is removed and only_programs_using_title_memory_are_withheld now asserts the finer outcome — the ordinary range overlapping a withheld one goes back without the withheld bytes (0x44 at the non-overlapping part) instead of being withheld with it. Flagging this explicitly for review since it adjusts one assertion of a test main landed.
  • Test adaptation. snapshot_copy_back_keeps_overlapping_withheld_bytes_on_the_gpu (kept with @andrewpozdnakov7-jpg's authorship) now marks list B's write as a memory writer, which main's missed && memory gating requires for withholding, and registers the miss only in the withheld iteration — a list with no miss registered is immune to the frame-global withholding latch, which a parallel suite run otherwise leaks across tests (it failed the control iteration here before this fix).

Validation on 57969ea (Windows, synthetic tests only):

  • cargo test --locked -p victory-gpu --lib -- --test-threads=1 shadow:: withholding: 13 passed, 0 failed.
  • Full parallel cargo test --locked -p victory-gpu --lib: 196 passed, 3 failed — the same three failures unmodified 13f91ca shows on this machine in the same run (192 passed): the NVIDIA descriptor heap-cap pair and draw::tests::a_texture_written_in_one_format_reads_in_another_through_a_placed_view. No new failures.
  • cargo clippy --locked -p victory-gpu --all-targets -- -D warnings: clean. cargo xtask policy: 184 files ok. git diff --check: clean.

AI-assisted (Kimi).

@Machad3x

Copy link
Copy Markdown

Setup: RTX 3080 Ti (driver 621.24), Windows 11, a local stack of open PRs merged with main 67e8ae1.

On a stack with 7ef96fa (#2280) and b6e75cf (#2409), 6b8d12e conflicts in
shadow.rs (copy_back_marked, rewritten around put_back) and in a doc
comment in watch.rs. Not tested here.

Written with Claude Code; tested locally.

@Halfect

Halfect commented Nov 25, 2026

Copy link
Copy Markdown
Contributor Author

Thanks @Machad3x for the stack check. The conflicts you hit are against two still-open PRs (#2280's copy_back_marked rewrite around put_back, #2409's watch.rs doc comment), not against main — this head (57969ea) rebases cleanly onto current main 13f91ca. Whichever of the three lands first, I'll rebase this one onto the result.

@andrewpozdnakov7-jpg

Copy link
Copy Markdown
Contributor

I reran the adapted snapshot copy-back test on 57969ea. On the exact parent 6b8d12e, the held-overlap case copies [A, B, 0] to title memory. With 29bf5b1 in the branch, it copies [A, 0, 0] and the GPU copy still contains [A, B, B]. The no-withholding control copies [A, B, B] on both. Six paired WARP runs gave the same result; the serial GPU suite passed 202 tests with one ignored in each debug setting.

Authored adaptation 29bf5b1 preserves the Git author. Please keep it if the series is rebased again, or add this trailer if it is folded into a different commit:

Co-authored-by: andrewpozdnakov7-jpg andrewpozdnakov7-jpg@users.noreply.github.com

@Halfect

Halfect commented Nov 25, 2026

Copy link
Copy Markdown
Contributor Author

Thanks @andrewpozdnakov7-jpg for re-running the adapted test on 57969ea and confirming the held-overlap case ([A, 0, 0] to title memory, GPU copy retaining [A, B, B], control unchanged). Noted on the attribution: if the series is rebased again I will keep 29bf5b1 intact with your authorship; if it is ever folded into another commit I will add the Co-authored-by: andrewpozdnakov7-jpg <andrewpozdnakov7-jpg@users.noreply.github.com> trailer. Nothing further from my side on this head.

Halfect and others added 3 commits November 26, 2026 06:38
The written-pages bitmap and copy_back_marks are process-wide, and
copy_back_marks consumes every set bit for its owning copy. The shadow
tests set bits and call copy_back_marks directly, outside the submission
lock that serializes production copy-backs (Host::execute). Running
tests in parallel, another test's submission (or mark test) could
consume a mark test's bits first and copy its page back without that
test's withheld list; the test's own copy-back then found nothing to
do. Seen once in three parallel runs on an RTX 3070 as the valid write
of a_withheld_range_does_not_suppress_the_pages_other_writes not
reaching title memory.

The three tests that set bits now hold the submission lock for their
whole body, the same serialization production copy-backs run under.
The snapshot fixture goes through Host::execute, which takes the lock
itself, so it needs none. No production code changes behavior.
@Halfect
Halfect force-pushed the fix/marked-withheld-same-page branch from 57969ea to f3b2a18 Compare November 25, 2026 22:40
@Halfect

Halfect commented Nov 25, 2026

Copy link
Copy Markdown
Contributor Author

Rebased onto current main f3578e3 and pushed f3b2a18; the branch merges cleanly again. Main's merge_writeback refactor (#2054 follow-through) and the new saved-bytes work (#2239/#2377/#2455) landed since the last head, and the rebase reconciles this PR with them:

  • Both copy-back paths keep this PR's per-range filtering. copy_back_or_not and copy_back_marked still retire exactly the ranges outside_withheld returns; the per-byte merge now goes through main's merge_writeback helper (identical semantics, as its own oracle test pins). The synced push stays gated on a full PIECE piece with t.taken(&synced): a page with a withheld hole never forms a full piece, so it is not marked current — the same outcome main's whole-page filter gives for ordinary ranges.
  • Main's new test is kept. partial_refresh_under_marked_range_updates_saved_bytes (GPU: a partial refresh of an armed page updates the bytes saved of it #2377) passes here, adapted only for this PR's withheld parameters (&[]).
  • watch.rs doc now covers both sources of saved bytes: the armed first write and the host baseline of an already-changed page.
  • 29bf5b1 keeps @andrewpozdnakov7-jpg's Git authorship through the rebase, as requested.

Validation on f3b2a18 (Windows, CPU-only, synthetic tests only):

  • cargo test --locked -p victory-gpu --lib -- --test-threads=1 shadow:: withholding: 15 passed, 0 failed.
  • Full cargo test --locked -p victory-gpu --lib: 229 passed, 3 failed — the same three failures unmodified f3578e3 shows on this machine in a separate worktree just now (225 passed): the NVIDIA descriptor heap-cap pair and draw::tests::a_texture_written_in_one_format_reads_in_another_through_a_placed_view. No new failures.
  • cargo clippy --locked -p victory-gpu --all-targets -- -D warnings: clean. cargo xtask policy: 190 files ok. git diff --check: clean.

AI-assisted (Kimi).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GPU: a withheld range can suppress a disjoint valid marked write on the same page