GPU diagnostics: sample pages the watch calls unchanged against title memory #2629
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!2629
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2629"
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?
@r4tedx on GitHub · 2026-11-25 17:12 UTC · original
r4tedx:mem/stale-check→main· +258 −0 · 3 files · 1 commits · openWhat it changes
This is in the
diagnosticsfeature only and is off unless asked for. Release builds do not change.VICTORY_STALE_CHECK=Nmakes the first submission of each presented frame check its share of the copies. That is one host copy in N, round robin overshadow::all(). The check runs under the submission lock and before any refresh, so nothing is armed or pending.memory::withheld_until_frame_end).1checks every copy every frame.fixchecks every copy and also copies the pages that differ, for an A/B of the picture. Any other value means one in 64. Unset, empty or0means off.stale check over F frames (one copy in N a frame): C copies, P pages the write tracking called unchanged compared with title memory, D of them differed (B bytes), T in all; first: <up to 10 addresses>It prints addresses and counts only, no bytes.
This differs from ka1qux's version in one way. Theirs checks at each update of a copy. Main never updates a copy that its tracker calls clean, so a check there would never see those copies. The frame sweep does see them, and they are the case where a missed write leaves a copy stale for good.
Tests (WARP,
--features diagnostics)the_stale_check_finds_writes_the_tracking_missed:fixcopies page 1, and the next check finds nothing.stale_check_settings: the values above.Results: victory-gpu WARP 200 passed / 0 failed / 1 ignored; clippy clean with and without diagnostics
What a title run should show
The line, with the target
0 of them differed. Any other count names a missed writer, and the first addresses say where to look. Per the design, N = 64 should cost under about 1 % of preparing. That has not been measured: no title run has been made with this change yet.Credit
The idea, the variable name and
fixcome from @ka1qux'sVICTORY_STALE_CHECK(30a71b7c on their fork, GPL-3.0-or-later). It is rewritten here for main's copies, and the commit carries ka1qux as co-author.The title was not used in these tests.
🤖 Generated with Claude Code
@kotekompotek on GitHub · 2026-11-25 17:52 UTC · original
Reviewed:
VICTORY_STALE_CHECKsamples pages the watch calls unchanged and compares them against live title memory — catching the failure mode where a page's write went unseen. Thewithheld_until_frame_endexemption is necessary and correct (intentional divergence, not a missed refresh). Diagnostics-only, zero cost otherwise. CI green.@Marvisak on GitHub · 2026-11-25 22:20 UTC · original · edited 2026-11-26 07:18 UTC
Automated triage for the maintainers.
Thanks for the in-game runs: across about 19 million page compares, no page the tracking called unchanged had changed. That fills the gap noted earlier. Same head, verdict unchanged (merge candidate). CI: passing.
Generated by Claude Code
@futurepro62 on GitHub · 2026-11-26 00:22 UTC · original
Full-suite run on NVIDIA, since this PR has no test report yet. Tested exact head
bba1998(on its basef3578e3).Tested
dxil.dllfrom Windows SDK 10.0.26100 (the loader's default), debug.cargo build --workspace --locked, thencargo test --workspace --locked --no-fail-fast -- --test-threads=4 --skip emit::memory_tests::heap_direct_texture_reads_mark_their_heap_index --skip descriptor::host::tests::dynamic_slots_are_held_until_released --skip memory::tests::lists_share_a_table_and_copies_keep_their_views --skip emit::stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride --skip emit::stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros --skip emit::synthetic_tests::gathers_at_a_level_match_the_hardware: 863 passed, 0 failed, 10 ignored.diagnosticsfeature, so the run above doesn't include them. Run on their own:cargo test -p victory-gpu --lib --locked --features diagnostics stale_check:the_stale_check_finds_writes_the_tracking_missedandstale_check_settingspass (2 passed, 0 failed).--skipleaves out tests that fail on main842b0cbon this card too, not because of this PR:heap_direct_texture_reads_mark_their_heap_indexends thevictory-shadertest process with0xc0000005(#2571), so without the skip the rest of that crate never reports;dynamic_slots_are_held_until_released,lists_share_a_table_and_copies_keep_their_viewsand the twostride_testshit the 1,000,000-view heap cap of NVIDIA drivers (#1835, #2317);gathers_at_a_level_match_the_hardwarefails on lane 0 (#1744).Not tested
AI use
@fuzeofficlal on GitHub · 2026-11-26 00:36 UTC · original
Code review and hardware + WARP verification at head
bba19981021bmerged cleanly ontomain(63bcca43c6a0):#[cfg(feature = "diagnostics")]acrosshost.rs,memory.rs, andshadow.rs(zero default-build impact).check_staleruns underself.submittedat submit entry (at most once per presented frame);stale_pagesproperly excludes dirty (t.changed(page)), untracked,withheld_until_frame_end, and pending shader-write pages. Reading title memory throughhost::read_into(ReadProcessMemory) leaves page protections intact without triggering thewatch.rsVEH handler, and re-checkingt.changed(page)after comparison cleanly filters concurrent title writes racing the read.VICTORY_D3D12_DEBUG=1, Rust 1.98.1):cargo xtask policy:191 files okcargo clippy --locked -p victory-gpu --tests -- -D warnings(default +--features diagnostics): 0 warningsshadow::tests watch::tests: 24/24 passed--features diagnostics,VICTORY_D3D12_DEBUG=1,shadow::tests watch::tests host::testsexcludingdescriptor::/pipeline::): 38/38 passed (includingstale_check_settingsandthe_stale_check_finds_writes_the_tracking_missed)--features diagnostics,VICTORY_D3D12_DEBUG=1, same filter): 38/38 passedLooks clean and ready to merge.
@r4tedx on GitHub · 2026-11-26 04:21 UTC · original
In-game result for the stale check, as triage asked: two runs with
VICTORY_STALE_CHECK=1on an RTX 5070 (12 GB, Windows 11), the same open-world save. The build is our play line onmain781e846dwith this PR cherry-picked (it needs none of the 24 commits after its parent), diagnostics on.219878a0)So over 89 lines and about 19 million page compares, the write tracking never called a page unchanged that wasn't. Neither run had a device removal. Run 1 crashed during loading on a null view in
alias_source, which is main 781e846d's own bug, fixed by main's219878a0and unrelated to this PR; its 30 lines are from before that point. Run 2 carries219878a0and ran the full 6 minutes, into the world.One caveat on what this covers: that play line's picture is wrong for other reasons we're still tracing, outside this PR's code (this PR only reads and compares). The pages compared are the ones the title wrote through that run, so the result holds for the tracking, not for the picture.
Local title data was used for these runs; only the counts from the diagnostics lines are given here.
AI-assisted
@fuzeofficlal on GitHub · 2026-11-26 14:29 UTC · original · approved these changes
Reviewed
bba19981021bd38daaab13558cbe8d6ec71447acmerged cleanly ontomain(63bcca43c6a0) and verified on Windows 11 x64 (NVIDIA GeForce RTX 5090 + Microsoft WARP,VICTORY_D3D12_DEBUG=1, Rust1.98.1).Code Review
crates/victory-gpu/src/host.rs:1146,3113,memory.rs:348,shadow.rs:690,1212-1315): All stale-check code and state are compiled out unless--features diagnosticsis enabled, leaving default and release builds untouched.shadow.rs:690-740,memory.rs:348):check_staleruns underself.submittedat submit entry (at most once per presented frame);stale_pagesskips copies with pending shader writes, dirty pages (t.changed(page)), untracked subranges, andwithheld_until_frame_endranges. Reading throughhost::read_into(ReadProcessMemory) leaves page guards intact and safely skips unmapped/decommitted pages without faulting, while the post-comparet.changed(page)recheck filters concurrent title writes racing the read.Verification (RTX 5090 + WARP +
VICTORY_D3D12_DEBUG=1, Rust1.98.1)cargo run --locked -p xtask -- policy:191 files ok.cargo clippy --locked -p victory-gpu --all-targets -- -D warnings(default and--features diagnostics): 0 warnings.cargo check --release --locked -p victory-gpu: clean (zero diagnostics code compiled).shadow:: watch::(RTX 5090): 25/25 passed.--features diagnostics+VICTORY_D3D12_DEBUG=1:shadow:: watch::: 27/27 passed (includingthe_stale_check_finds_writes_the_tracking_missedandstale_check_settings).shadow:: watch:: memory::: 35/35 passed.VICTORY_D3D12_DEBUG=1): verifiedstale_pages(false)safely skips an unmappedMEM_RESERVE/PAGE_NOACCESSmiddle page without AV (compared=2, differ=[]), skips a diverging page registered viamemory::drop_withheld(compared=1, differ=[]), and continues skipping it cleanly aftermemory::log_frame()triggersretake_dropped(compared=1, differ=[]).#2612: merges cleanly, clippy (--all-features) clean,shadow:: watch::35/35 passed on RTX 5090 andshadow:: watch:: memory::43/43 passed on WARP (both with--features diagnosticsandVICTORY_D3D12_DEBUG=1).LGTM.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.