About 500 window copies of title memory stay stale after their refresh in the first minutes of the world (RTX 5080, 310c6eb + #571) #866

Closed
opened 2026-11-26 03:52:47 +00:00 by github-bot · 1 comment
Owner

@⁠ghost on GitHub · 2026-11-25 11:06 UTC · original

AI-assisted (Claude Code). Counts, addresses and log lines only; no game data.

Summary. With main (310c6eb) + #571 on an RTX 5080, about 500 of the 4 MiB window copies of title memory hold bytes that differ from title memory after their refresh, while the title's bytes there no longer change. They all appear in the first 2.5 minutes of the world, in every launch. This is the fault class of #571 (memory changed with nothing to tell of it), still present with #571 in, and I think it is the likeliest reason pictures differ from launch to launch (a wall missing in 1 launch of 10 with #571, rooms lit by their lamps in some launches only).

How measured. VICTORY_REFRESH_CHECK=1 as it is fills its 64-line cap in one burst on buffers the title rewrites all the time (here an 11,059,200-byte copy at world start in one launch, the 182 MB heap during loading in another), so it cannot tell a write that raced the look from a copy that stays wrong. I added a second counter to Shadow::refresh_check locally: a block is counted when the copy differs from title memory and the title's sample is the same as at the previous look, four looks in a row. Per copy, a line at 1, 4, 16, 64... such blocks. Patch below (diagnostic only, behind the same switch).

Counts (three launches of 300 s, defaults, scripted Enter until 70 s, diag build, Series X profile):

launch window copies with a frozen-stale block of them with 4 or more such blocks, at least other copies with one
1 546 401 3,693 23
2 525 406 4,083 25
3 489 388 3,945 21

When the window copies are first reported, in 30 s bins from the first world frame (launch 1 / launch 3): 387 / 510, 282 / 233, 157 / 211, 150 / 87, 99 / 9, 15 / 1, 4 / 5, then none. Nothing before the world starts.

The windows are on_the_card=false window=true, 4,194,304 bytes, spread over the title's pool (0x7xxxxxxxx, 0xbxxxxxxxx, 0xcxxxxxxxx).

What I am not sure of

  • The "other copies" include big ones with on_the_card=true (several of 11 to 52 MB counted up to 1,024 times). For a copy on the card data is only part of the copy, so I do not trust the comparison there and leave those out of the claim.
  • The counter says a window was stale over four refreshes; it does not say whether a later refresh brought it up to date. I did not log recoveries.
  • I have not found which writes are missed. #571's path logs nothing here that I could match to the windows.
  • One card.

Diagnostic patch (against 310c6eb, crates/victory-gpu/src/shadow.rs):

diff --git a/crates/victory-gpu/src/shadow.rs b/crates/victory-gpu/src/shadow.rs
index 133e871..3f9bb48 100644
--- a/crates/victory-gpu/src/shadow.rs
+++ b/crates/victory-gpu/src/shadow.rs
@@ -2442,6 +2442,11 @@ impl Shadow {
         // Blocks found differing: how many refreshes in a row.
         static DIFFERING: Mutex<Option<std::collections::HashMap<usize, u32>>> = Mutex::new(None);
         static SAID: AtomicU64 = AtomicU64::new(0);
+        // LOCAL DIAGNOSTIC: blocks whose title bytes stay the same from look to look while
+        // the copy differs (by block: the title sample's sum, looks in a row), and how many
+        // such blocks each copy has had (by the copy's start).
+        static FROZEN: Mutex<Option<std::collections::HashMap<usize, (u64, u32)>>> = Mutex::new(None);
+        static PER_COPY: Mutex<Option<std::collections::HashMap<usize, u64>>> = Mutex::new(None);
         let start = self.start as usize;
         let mut title = [0u8; SAMPLE];
         let mut at = from;
@@ -2453,6 +2458,33 @@ impl Shadow {
                 let copy = unsafe { std::slice::from_raw_parts(self.data.add(at - start).cast_const(), n) };
                 let mut map = DIFFERING.lock().unwrap_or_else(|e| e.into_inner());
                 let map = map.get_or_insert_with(Default::default);
+                {
+                    let mut frozen = FROZEN.lock().unwrap_or_else(|e| e.into_inner());
+                    let frozen = frozen.get_or_insert_with(Default::default);
+                    if copy == &title[..n] {
+                        frozen.remove(&at);
+                    } else {
+                        let sum = title[..n].iter().fold(0xcbf29ce484222325u64, |h, &b| (h ^ u64::from(b)).wrapping_mul(0x100000001b3));
+                        let e = frozen.entry(at).or_insert((sum, 0));
+                        if e.0 == sum { e.1 += 1 } else { *e = (sum, 1) }
+                        if e.1 == 4 {
+                            let mut per = PER_COPY.lock().unwrap_or_else(|e| e.into_inner());
+                            let count = per.get_or_insert_with(Default::default).entry(start).or_insert(0);
+                            *count += 1;
+                            if matches!(*count, 1 | 4 | 16 | 64 | 256 | 1024 | 4096) {
+                                tracing::warn!(
+                                    blocks = *count,
+                                    copy_start = format_args!("{start:#x}"),
+                                    copy_bytes = self.len,
+                                    address = format_args!("{at:#x}"),
+                                    on_the_card = self.card.is_some(),
+                                    window = self.window,
+                                    "FROZEN-STALE: title bytes unchanged over four looks, the copy differs"
+                                );
+                            }
+                        }
+                    }
+                }
                 if copy == &title[..n] {
                     map.remove(&at);
                 } else {
**@⁠ghost** on GitHub · 2026-11-25 11:06 UTC · [original](https://github.com/fxceless/victory-fork/issues/866) *AI-assisted (Claude Code). Counts, addresses and log lines only; no game data.* **Summary.** With `main` (`310c6eb`) + #571 on an RTX 5080, about 500 of the 4 MiB window copies of title memory hold bytes that differ from title memory after their refresh, while the title's bytes there no longer change. They all appear in the first 2.5 minutes of the world, in every launch. This is the fault class of #571 (memory changed with nothing to tell of it), still present with #571 in, and I think it is the likeliest reason pictures differ from launch to launch (a wall missing in 1 launch of 10 with #571, rooms lit by their lamps in some launches only). **How measured.** `VICTORY_REFRESH_CHECK=1` as it is fills its 64-line cap in one burst on buffers the title rewrites all the time (here an 11,059,200-byte copy at world start in one launch, the 182 MB heap during loading in another), so it cannot tell a write that raced the look from a copy that stays wrong. I added a second counter to `Shadow::refresh_check` locally: a block is counted when the copy differs from title memory **and the title's sample is the same as at the previous look, four looks in a row**. Per copy, a line at 1, 4, 16, 64... such blocks. Patch below (diagnostic only, behind the same switch). **Counts** (three launches of 300 s, defaults, scripted Enter until 70 s, diag build, Series X profile): | launch | window copies with a frozen-stale block | of them with 4 or more | such blocks, at least | other copies with one | |---|---|---|---|---| | 1 | 546 | 401 | 3,693 | 23 | | 2 | 525 | 406 | 4,083 | 25 | | 3 | 489 | 388 | 3,945 | 21 | When the window copies are first reported, in 30 s bins from the first world frame (launch 1 / launch 3): 387 / 510, 282 / 233, 157 / 211, 150 / 87, 99 / 9, 15 / 1, 4 / 5, then none. Nothing before the world starts. The windows are `on_the_card=false window=true`, 4,194,304 bytes, spread over the title's pool (`0x7xxxxxxxx`, `0xbxxxxxxxx`, `0xcxxxxxxxx`). **What I am not sure of** - The "other copies" include big ones with `on_the_card=true` (several of 11 to 52 MB counted up to 1,024 times). For a copy on the card `data` is only part of the copy, so I do not trust the comparison there and leave those out of the claim. - The counter says a window was stale over four refreshes; it does not say whether a later refresh brought it up to date. I did not log recoveries. - I have not found which writes are missed. #571's path logs nothing here that I could match to the windows. - One card. **Diagnostic patch** (against `310c6eb`, `crates/victory-gpu/src/shadow.rs`): ```diff diff --git a/crates/victory-gpu/src/shadow.rs b/crates/victory-gpu/src/shadow.rs index 133e871..3f9bb48 100644 --- a/crates/victory-gpu/src/shadow.rs +++ b/crates/victory-gpu/src/shadow.rs @@ -2442,6 +2442,11 @@ impl Shadow { // Blocks found differing: how many refreshes in a row. static DIFFERING: Mutex<Option<std::collections::HashMap<usize, u32>>> = Mutex::new(None); static SAID: AtomicU64 = AtomicU64::new(0); + // LOCAL DIAGNOSTIC: blocks whose title bytes stay the same from look to look while + // the copy differs (by block: the title sample's sum, looks in a row), and how many + // such blocks each copy has had (by the copy's start). + static FROZEN: Mutex<Option<std::collections::HashMap<usize, (u64, u32)>>> = Mutex::new(None); + static PER_COPY: Mutex<Option<std::collections::HashMap<usize, u64>>> = Mutex::new(None); let start = self.start as usize; let mut title = [0u8; SAMPLE]; let mut at = from; @@ -2453,6 +2458,33 @@ impl Shadow { let copy = unsafe { std::slice::from_raw_parts(self.data.add(at - start).cast_const(), n) }; let mut map = DIFFERING.lock().unwrap_or_else(|e| e.into_inner()); let map = map.get_or_insert_with(Default::default); + { + let mut frozen = FROZEN.lock().unwrap_or_else(|e| e.into_inner()); + let frozen = frozen.get_or_insert_with(Default::default); + if copy == &title[..n] { + frozen.remove(&at); + } else { + let sum = title[..n].iter().fold(0xcbf29ce484222325u64, |h, &b| (h ^ u64::from(b)).wrapping_mul(0x100000001b3)); + let e = frozen.entry(at).or_insert((sum, 0)); + if e.0 == sum { e.1 += 1 } else { *e = (sum, 1) } + if e.1 == 4 { + let mut per = PER_COPY.lock().unwrap_or_else(|e| e.into_inner()); + let count = per.get_or_insert_with(Default::default).entry(start).or_insert(0); + *count += 1; + if matches!(*count, 1 | 4 | 16 | 64 | 256 | 1024 | 4096) { + tracing::warn!( + blocks = *count, + copy_start = format_args!("{start:#x}"), + copy_bytes = self.len, + address = format_args!("{at:#x}"), + on_the_card = self.card.is_some(), + window = self.window, + "FROZEN-STALE: title bytes unchanged over four looks, the copy differs" + ); + } + } + } + } if copy == &title[..n] { map.remove(&at); } else { ```
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:52:47 +00:00
Author
Owner

@⁠ghost on GitHub · 2026-11-25 12:01 UTC · original

AI-assisted (Claude Code). Counts only.

Gone on main f85101b. Same card, same diagnostic (the patch above on top of f85101b), four launches of 300 s, defaults:

build window copies with a frozen-stale block, per launch other copies with one
310c6eb + #571 489, 525, 546 21 to 25
f85101b 0, 0, 0, 0 0

So a26859f's guard of the other views of a physical page (VICTORY_VIEW_GUARD) covers what this issue counted, the big copies on the card included. I had the same idea running locally in parallel (twins of a guarded block made read-only, a write at one marks the others written): four launches with it also counted 0, which is a second confirmation that this was the cause; it is not needed now and I am not sending it.

What it did for the picture here: the four f85101b launches show the same frames at the same points for the first time on this card (cell walls, posters, the uniform's colour, the faces in the opening scenes), where before no two launches agreed. No device loss, no title stop, no refused read in the four; 2.9 to 4.1 fps in the cell with the diagnostic on.

One note for anyone on a tree between the two: making the other views read-only raises how often a plain DirectStorage read meets a read-only block (hr=0x800706f8, then the title's own breakpoint). My local version stopped that way in 1 launch of 2 until I merged #552; with #552, 2 refused reads in 4 launches were caught by its fallback. f85101b had none in four launches here.

Closing.

**@⁠ghost** on GitHub · 2026-11-25 12:01 UTC · [original](https://github.com/fxceless/victory-fork/issues/866#issuecomment-7161812955) *AI-assisted (Claude Code). Counts only.* **Gone on `main` `f85101b`.** Same card, same diagnostic (the patch above on top of `f85101b`), four launches of 300 s, defaults: | build | window copies with a frozen-stale block, per launch | other copies with one | |---|---|---| | `310c6eb` + #571 | 489, 525, 546 | 21 to 25 | | `f85101b` | 0, 0, 0, 0 | 0 | So `a26859f`'s guard of the other views of a physical page (`VICTORY_VIEW_GUARD`) covers what this issue counted, the big copies on the card included. I had the same idea running locally in parallel (twins of a guarded block made read-only, a write at one marks the others written): four launches with it also counted 0, which is a second confirmation that this was the cause; it is not needed now and I am not sending it. What it did for the picture here: the four `f85101b` launches show the same frames at the same points for the first time on this card (cell walls, posters, the uniform's colour, the faces in the opening scenes), where before no two launches agreed. No device loss, no title stop, no refused read in the four; 2.9 to 4.1 fps in the cell with the diagnostic on. One note for anyone on a tree between the two: making the other views read-only raises how often a plain DirectStorage read meets a read-only block (`hr=0x800706f8`, then the title's own breakpoint). My local version stopped that way in 1 launch of 2 until I merged #552; with #552, 2 refused reads in 4 launches were caught by its fallback. `f85101b` had none in four launches here. Closing.
This discussion has been locked. Commenting is limited to contributors.
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.

Dependencies

No dependencies set

Reference
github/fxceless--victory-fork#866
No description provided.