GPU: name the title slots a capped host heap could not hold #3475

Open
github-bot wants to merge 4 commits from github-bot/gh-3475 into main AGit
Owner

@⁠tharun-37 on GitHub · 2026-11-27 05:16 UTC · original
tharun-37:gpu/capped-heap-slot-report → main · +186 −4 · 2 files · 4 commits · open

Summary

  • Count the title's slots a capped host view heap could not hold, and the highest index among them.
  • Warn for the first such slot and then at every doubling, instead of once per new highest index: a GTA VI world load on an RTX 4060 Laptop logged 310,720 warnings for the same condition (a 140 MB log file).
  • A slot past the heap asked for again does not warn again: only a newly reached distance does.
  • Report the count and the highest index with the run's statistics (a diagnostics build).

Fixes #3474

Why

The warning is for the first slot past the host heap, but it fires for every new highest index the title reaches. How far the title's descriptor table overflows the host heap is the number that says whether a clamp (the shader reads a null slot) is enough or the title's views have to be made afresh, and it was nowhere in the log.

What the log says now

WARN victory_gpu::descriptor::host: title slot past the host heap past=1 index=934464 highest=934464 count=934464 for_draw=false
...
INFO victory_gpu::host: title slots past the host heap: 310720 (the title's slots reach 1245183, the heap holds 934464; 310720 skips)

19 warnings instead of 310,720, and the count of the slots past the heap in the statistics. The count in the warning is the number of the title's slots past the heap (the slots are numbered from zero), not the number of times a slot was skipped, so it does not depend on how often the title asks for the same slot.

Verification

  • cargo test -p victory-gpu — 233 passed, 1 ignored; the 2 failures are the known NVIDIA heap-cap ones (dynamic_slots_are_held_until_released, lists_share_a_table_and_copies_keep_their_views), reproduced on main.
  • cargo clippy -p victory-gpu --all-targets -- -D warnings, with and without diagnostics — clean.
  • The new test descriptor::host::tests::the_slots_past_a_capped_heap_are_counted_and_the_log_names_a_few, and the three tests for a repeat, a sparse index and concurrent asks (capped_heap_repeats_and_older_indices_do_not_warn_again, capped_heap_sparse_indices_warn_when_crossing_a_range, capped_heap_concurrent_repeats_warn_once_but_count_every_skip).
  • A world load on an RTX 4060 Laptop (driver 32.0.16.2140, Windows 11 build 26300): 19 warnings instead of 310,720, the statistics line above, and a 3.6 MB log for the whole run instead of 140 MB.
**@⁠tharun-37** on GitHub · 2026-11-27 05:16 UTC · [original](https://github.com/Marvisak/VIctory/pull/3475) `tharun-37:gpu/capped-heap-slot-report` → `main` · +186 −4 · 2 files · 4 commits · open ## Summary - Count the title's slots a capped host view heap could not hold, and the highest index among them. - Warn for the first such slot and then at every doubling, instead of once per new highest index: a GTA VI world load on an RTX 4060 Laptop logged 310,720 warnings for the same condition (a 140 MB log file). - A slot past the heap asked for again does not warn again: only a newly reached distance does. - Report the count and the highest index with the run's statistics (a diagnostics build). Fixes #3474 ## Why The warning is for the first slot past the host heap, but it fires for every new highest index the title reaches. How far the title's descriptor table overflows the host heap is the number that says whether a clamp (the shader reads a null slot) is enough or the title's views have to be made afresh, and it was nowhere in the log. ## What the log says now ``` WARN victory_gpu::descriptor::host: title slot past the host heap past=1 index=934464 highest=934464 count=934464 for_draw=false ... INFO victory_gpu::host: title slots past the host heap: 310720 (the title's slots reach 1245183, the heap holds 934464; 310720 skips) ``` 19 warnings instead of 310,720, and the count of the slots past the heap in the statistics. The count in the warning is the number of the title's slots past the heap (the slots are numbered from zero), not the number of times a slot was skipped, so it does not depend on how often the title asks for the same slot. ## Verification - `cargo test -p victory-gpu` — 233 passed, 1 ignored; the 2 failures are the known NVIDIA heap-cap ones (`dynamic_slots_are_held_until_released`, `lists_share_a_table_and_copies_keep_their_views`), reproduced on `main`. - `cargo clippy -p victory-gpu --all-targets -- -D warnings`, with and without `diagnostics` — clean. - The new test `descriptor::host::tests::the_slots_past_a_capped_heap_are_counted_and_the_log_names_a_few`, and the three tests for a repeat, a sparse index and concurrent asks (`capped_heap_repeats_and_older_indices_do_not_warn_again`, `capped_heap_sparse_indices_warn_when_crossing_a_range`, `capped_heap_concurrent_repeats_warn_once_but_count_every_skip`). - A world load on an RTX 4060 Laptop (driver 32.0.16.2140, Windows 11 build 26300): 19 warnings instead of 310,720, the statistics line above, and a 3.6 MB log for the whole run instead of 140 MB.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 05:17:25 +00:00
Author
Owner

@⁠kalberts0089-hash on GitHub · 2026-11-27 05:34 UTC · original

NVIDIA test report: RTX 4060 (desktop, driver 610.88), Windows 11 Pro, rustc 1.98.1. Head ec62b97 (base main 63bcca4).

  • cargo test -p victory-gpu --lib -- --test-threads=1: 230 passed, 2 failed, 1 ignored (main: 229 / 2 / 1). The new the_slots_past_a_capped_heap_are_counted_and_the_log_names_a_few passes, with and without --features diagnostics. The 2 failures are the known capped-heap ones (dynamic_slots_are_held_until_released, lists_share_a_table_and_copies_keep_their_views) and fail the same way on main.
  • cargo clippy -p victory-gpu --all-targets --features diagnostics -- -D warnings: clean.
  • cargo test -p victory-shader --no-fail-fast: the process dies with 0xc0000005 in heap_direct_texture_reads_mark_their_heap_index, as on main (#2571, not this PR). With only that test skipped: 298 passed, 3 failed, 3 ignored, the known NVIDIA failures (a_heap_buffer_read_by_element_takes_the_views_stride, a_heap_buffer_read_where_no_buffer_view_is_reads_zeros, gathers_at_a_level_match_the_hardware).
  • Not tested: the world-load log comparison. I have no game run on this machine, and no unit test reaches mirror past the capped heap with a log subscriber, so this report doesn't confirm the 310,720 → 23 line count. Reading the change: a single ascending sweep over the 310,720 skipped slots gives 19 warnings (skip 1, then every power of two up to 2^18), and only the capped view heap can reach this path, because sampler heaps are made at full size or not at all.

Synthetic tests only, no game files. AI-assisted (Claude Code).

**@⁠kalberts0089-hash** on GitHub · 2026-11-27 05:34 UTC · [original](https://github.com/Marvisak/VIctory/pull/3475#issuecomment-7210753703) NVIDIA test report: RTX 4060 (desktop, driver 610.88), Windows 11 Pro, rustc 1.98.1. Head `ec62b97` (base main `63bcca4`). - `cargo test -p victory-gpu --lib -- --test-threads=1`: 230 passed, 2 failed, 1 ignored (main: 229 / 2 / 1). The new `the_slots_past_a_capped_heap_are_counted_and_the_log_names_a_few` passes, with and without `--features diagnostics`. The 2 failures are the known capped-heap ones (`dynamic_slots_are_held_until_released`, `lists_share_a_table_and_copies_keep_their_views`) and fail the same way on main. - `cargo clippy -p victory-gpu --all-targets --features diagnostics -- -D warnings`: clean. - `cargo test -p victory-shader --no-fail-fast`: the process dies with `0xc0000005` in `heap_direct_texture_reads_mark_their_heap_index`, as on main (#2571, not this PR). With only that test skipped: 298 passed, 3 failed, 3 ignored, the known NVIDIA failures (`a_heap_buffer_read_by_element_takes_the_views_stride`, `a_heap_buffer_read_where_no_buffer_view_is_reads_zeros`, `gathers_at_a_level_match_the_hardware`). - Not tested: the world-load log comparison. I have no game run on this machine, and no unit test reaches `mirror` past the capped heap with a log subscriber, so this report doesn't confirm the 310,720 → 23 line count. Reading the change: a single ascending sweep over the 310,720 skipped slots gives 19 warnings (skip 1, then every power of two up to 2^18), and only the capped view heap can reach this path, because sampler heaps are made at full size or not at all. Synthetic tests only, no game files. AI-assisted (Claude Code).
Author
Owner

@⁠tharun-37 on GitHub · 2026-11-27 06:07 UTC · original

Thanks for the report. Two changes since ec62b97 (07107f6):

  • The number in the warning is now the count of the title's slots past the heap, not the count of skips. The slots are numbered from zero, so the ones past a heap of 934,464 are those from 934,464 to the highest index the title reached (1,245,183): 310,720 of them. The old count was the number of times a slot was skipped, which grows with every ask for the same slot and so does not name the slots.
  • The warning fires on the first slot past the heap and then at every doubling of that count.

With that, a world load on an RTX 4060 Laptop (driver 32.0.16.2140, Windows 11 build 26300) gives 19 warnings, the same 19 an ascending sweep over the 310,720 slots gives:

WARN victory_gpu::descriptor::host: title slot past the host heap past=1 index=934464 highest=934464 count=934464 for_draw=false
...
WARN victory_gpu::descriptor::host: title slot past the host heap past=262144 index=1196607 highest=1196607 count=934464 for_draw=false
INFO victory_gpu::host: title slots past the host heap: 310720 (the title's slots reach 1245183, the heap holds 934464; 310720 skips)

310,720 warnings (a 140 MB log) before, 19 now, and the whole run's log is 3.6 MB instead of 140 MB.

**@⁠tharun-37** on GitHub · 2026-11-27 06:07 UTC · [original](https://github.com/Marvisak/VIctory/pull/3475#issuecomment-7211234544) Thanks for the report. Two changes since `ec62b97` (`07107f6`): - The number in the warning is now the count of the title's slots past the heap, not the count of skips. The slots are numbered from zero, so the ones past a heap of 934,464 are those from 934,464 to the highest index the title reached (1,245,183): 310,720 of them. The old count was the number of times a slot was skipped, which grows with every ask for the same slot and so does not name the slots. - The warning fires on the first slot past the heap and then at every doubling of that count. With that, a world load on an RTX 4060 Laptop (driver 32.0.16.2140, Windows 11 build 26300) gives 19 warnings, the same 19 an ascending sweep over the 310,720 slots gives: ``` WARN victory_gpu::descriptor::host: title slot past the host heap past=1 index=934464 highest=934464 count=934464 for_draw=false ... WARN victory_gpu::descriptor::host: title slot past the host heap past=262144 index=1196607 highest=1196607 count=934464 for_draw=false INFO victory_gpu::host: title slots past the host heap: 310720 (the title's slots reach 1245183, the heap holds 934464; 310720 skips) ``` 310,720 warnings (a 140 MB log) before, 19 now, and the whole run's log is 3.6 MB instead of 140 MB.
Author
Owner

@⁠playcations on GitHub · 2026-11-27 06:22 UTC · original

The current cc7bd350d92a87ab44e6e45043ae3625871c678c still repeats warnings if the retained high-water distance is a power of two.

I replayed the exact production PastHeap, slots_past and worth_a_warning code on CPU with count = 934_464 and this sequence of out-of-range indices:

[count, count, count, count + 1, count + 2, count + 3, count + 2, count + 3]

For each observation the replay calls the same note -> slots_past -> worth_a_warning chain as mirror. It produces 7 warnings, although only three new warning distances (1, 2, 4) were reached. The state correctly ends at (skips=8, highest=count+3, count=count). Repeating count alone warns every time; after reaching count+3, both a repeat and an older out-of-range index warn again because note returns the retained maximum and its distance remains 4.

The ascending-only test cannot catch this. The atomic fetch_max return already gives the previous maximum; carrying that into the emission decision would let the caller require a new high-water/threshold crossing while preserving the skip counter on every observation. It would also be useful to cover a first sparse observation and jumps over a threshold, so warnings do not disappear when a distance is not exactly a power of two.

This is an isolated replay of the production CPU policy, not a HostHeap::mirror/subscriber integration test or a game/GPU run. No game data used. AI-assisted with Codex GPT-6.1 Sol; source and failure were reviewed.

**@⁠playcations** on GitHub · 2026-11-27 06:22 UTC · [original](https://github.com/Marvisak/VIctory/pull/3475#issuecomment-7211464905) The current `cc7bd350d92a87ab44e6e45043ae3625871c678c` still repeats warnings if the retained high-water distance is a power of two. I replayed the exact production `PastHeap`, `slots_past` and `worth_a_warning` code on CPU with `count = 934_464` and this sequence of out-of-range indices: ```rust [count, count, count, count + 1, count + 2, count + 3, count + 2, count + 3] ``` For each observation the replay calls the same `note -> slots_past -> worth_a_warning` chain as `mirror`. It produces **7 warnings**, although only three new warning distances (1, 2, 4) were reached. The state correctly ends at `(skips=8, highest=count+3, count=count)`. Repeating `count` alone warns every time; after reaching `count+3`, both a repeat and an older out-of-range index warn again because `note` returns the retained maximum and its distance remains 4. The ascending-only test cannot catch this. The atomic `fetch_max` return already gives the previous maximum; carrying that into the emission decision would let the caller require a new high-water/threshold crossing while preserving the skip counter on every observation. It would also be useful to cover a first sparse observation and jumps over a threshold, so warnings do not disappear when a distance is not exactly a power of two. This is an isolated replay of the production CPU policy, not a `HostHeap::mirror`/subscriber integration test or a game/GPU run. No game data used. AI-assisted with Codex GPT-6.1 Sol; source and failure were reviewed.
Author
Owner

@⁠playcations on GitHub · 2026-11-27 06:41 UTC · original

I prepared the small follow-up below against current cc7bd350, for inclusion in this PR if you want it.

note keeps fetch_max's previous maximum and returns both the retained maximum and the warning decision. The decision compares the old and new power-of-two ranges; repeats and older indices do not warn, while a first sparse observation or a jump over a boundary does. Every skip still increments the counter, and the statistics/log fields remain intact.

Checked the actual Windows-target module tests under GPU-isolated Wine 11.22 Staging:

  • repeated/out-of-order sequence: only the three newly reached ranges warn;
  • sparse first index and skipped boundaries: expected warnings;
  • 16 simultaneous identical observations: one warning, all 16 skips counted;
  • existing ascending sweep: the original 19 warnings are preserved.

cargo xwin clippy -p victory-gpu --all-targets --target x86_64-pc-windows-msvc -- -D warnings passes with and without --features diagnostics; cargo xtask policy passes (191 files). A separate Sol source review found no material issue under the current fixed positive capped-heap size. This is CPU policy/testing only, not a new game/GPU run or a full suite claim. AI-assisted with Codex GPT-6.1 Sol.

Proposed follow-up patch
diff --git a/crates/victory-gpu/src/descriptor/host.rs b/crates/victory-gpu/src/descriptor/host.rs
index 0a2b896..e1c7fc6 100644
--- a/crates/victory-gpu/src/descriptor/host.rs
+++ b/crates/victory-gpu/src/descriptor/host.rs
@@ -39,13 +39,16 @@ impl PastHeap {
         }
     }
 
-    /// Counts a title slot past a heap of `count` slots: the highest index
-    /// seen among them.
-    fn note(&self, index: u32, count: u32) -> u32 {
+    /// Counts every skip, returning the highest index and whether this
+    /// observation first reaches a new warning range. The atomic's old
+    /// maximum keeps repeats and concurrent observations from warning again.
+    fn note(&self, index: u32, count: u32) -> (u32, bool) {
         self.skips.fetch_add(1, Ordering::Relaxed);
-        let highest = self.highest.fetch_max(index, Ordering::Relaxed).max(index);
+        let previous = self.highest.fetch_max(index, Ordering::Relaxed);
+        let highest = previous.max(index);
         self.count.store(count, Ordering::Relaxed);
-        highest
+        let warn = worth_a_warning(slots_past(count, previous), slots_past(count, highest));
+        (highest, warn)
     }
 
     /// The skips so far, the highest index seen, and the heap's size.
@@ -67,11 +70,11 @@ pub(crate) fn slots_past(count: u32, highest: u32) -> u32 {
     highest.saturating_sub(count.saturating_sub(1))
 }
 
-/// Whether the `past`th title slot past the host heap is worth a warning:
-/// the first one, and then every doubling, so the log shows how far past the
-/// heap the title went without a line per slot.
-fn worth_a_warning(past: u32) -> bool {
-    past > 0 && past.is_power_of_two()
+/// Warn for the first observation and each newly reached power-of-two
+/// range, even when sparse indices skip the exact boundary. Repeated or
+/// older observations stay in the previous range and do not warn.
+fn worth_a_warning(previous: u32, past: u32) -> bool {
+    past > previous && (previous == 0 || past.ilog2() > previous.ilog2())
 }
 
 pub(crate) struct HostHeap {
@@ -785,9 +788,9 @@ impl HostHeap {
             // Diagnostic (NVIDIA heap cap): the title's slots past the host
             // heap. The count of them is in the run's statistics; a warning
             // per slot floods the log.
-            let highest = PAST_HEAP.note(index, self.count);
+            let (highest, warn) = PAST_HEAP.note(index, self.count);
             let past = slots_past(self.count, highest);
-            if worth_a_warning(past) {
+            if warn {
                 tracing::warn!(
                     past,
                     index,
@@ -1897,21 +1900,24 @@ mod tests {
     fn the_slots_past_a_capped_heap_are_counted_and_the_log_names_a_few() {
         let past = PastHeap::new();
         assert_eq!(past.get(), (0, 0, 0));
-        assert_eq!(past.note(1_245_183, 934_464), 1_245_183);
-        assert_eq!(past.note(934_464, 934_464), 1_245_183);
+        assert_eq!(past.note(1_245_183, 934_464), (1_245_183, true));
+        assert_eq!(past.note(934_464, 934_464), (1_245_183, false));
         assert_eq!(past.get(), (2, 1_245_183, 934_464));
         // The warnings: the first slot past the heap and then every doubling.
-        assert!(worth_a_warning(1));
-        assert!(worth_a_warning(2));
-        assert!(!worth_a_warning(3));
-        assert!(worth_a_warning(4));
-        assert!(!worth_a_warning(5));
-        assert!(worth_a_warning(1 << 20));
-        assert!(!worth_a_warning((1 << 20) + 1));
-        assert!(!worth_a_warning(0));
+        assert!(worth_a_warning(0, 1));
+        assert!(worth_a_warning(1, 2));
+        assert!(!worth_a_warning(2, 3));
+        assert!(worth_a_warning(3, 4));
+        assert!(!worth_a_warning(4, 5));
+        assert!(worth_a_warning((1 << 20) - 1, 1 << 20));
+        assert!(!worth_a_warning(1 << 20, (1 << 20) + 1));
+        assert!(!worth_a_warning(0, 0));
         // A title 310 720 slots past the heap names 19 of them, however many
         // times the slots are skipped.
-        let named = (1..=310_720).filter(|n| worth_a_warning(*n)).count();
+        let ascending = PastHeap::new();
+        let named = (934_464..=1_245_183)
+            .filter(|&index| ascending.note(index, 934_464).1)
+            .count();
         assert_eq!(named, 19);
         // The title's slots are numbered from zero: the ones past the heap
         // are those from the heap's last slot to the highest index seen.
@@ -1920,6 +1926,45 @@ mod tests {
         assert_eq!(slots_past(934_464, 934_464), 1);
     }
 
+    #[test]
+    fn capped_heap_repeats_and_older_indices_do_not_warn_again() {
+        let past = PastHeap::new();
+        let count = 934_464;
+        let indices = [count, count, count, count + 1, count + 2, count + 3, count + 2, count + 3];
+        let warnings = indices.into_iter().filter(|&index| past.note(index, count).1).count();
+        assert_eq!(warnings, 3);
+        assert_eq!(past.get(), (8, count + 3, count));
+    }
+
+    #[test]
+    fn capped_heap_sparse_indices_warn_when_crossing_a_range() {
+        let past = PastHeap::new();
+        let count = 934_464;
+        let observations = [(count + 2, true), (count + 2, false), (count + 4, true),
+            (count + 3, false), (count + 6, false), (count + 8, true)];
+        for (index, warn) in observations {
+            assert_eq!(past.note(index, count).1, warn, "index {index}");
+        }
+        assert_eq!(past.get(), (6, count + 8, count));
+    }
+
+    #[test]
+    fn capped_heap_concurrent_repeats_warn_once_but_count_every_skip() {
+        use std::sync::{Arc, Barrier};
+        let past = Arc::new(PastHeap::new());
+        let barrier = Arc::new(Barrier::new(16));
+        let workers: Vec<_> = (0..16).map(|_| {
+            let (past, barrier) = (past.clone(), barrier.clone());
+            std::thread::spawn(move || {
+                barrier.wait();
+                past.note(934_464, 934_464).1
+            })
+        }).collect();
+        let warnings = workers.into_iter().map(|worker| worker.join().unwrap()).filter(|&warn| warn).count();
+        assert_eq!(warnings, 1);
+        assert_eq!(past.get(), (16, 934_464, 934_464));
+    }
+
     /// Typed buffer views of integer formats carry their kind in the
     /// view-stride table; float, normalized, raw and structured ones none.
     #[test]
**@⁠playcations** on GitHub · 2026-11-27 06:41 UTC · [original](https://github.com/Marvisak/VIctory/pull/3475#issuecomment-7211756422) I prepared the small follow-up below against current `cc7bd350`, for inclusion in this PR if you want it. `note` keeps `fetch_max`'s previous maximum and returns both the retained maximum and the warning decision. The decision compares the old and new power-of-two ranges; repeats and older indices do not warn, while a first sparse observation or a jump over a boundary does. Every skip still increments the counter, and the statistics/log fields remain intact. Checked the actual Windows-target module tests under GPU-isolated Wine 11.22 Staging: - repeated/out-of-order sequence: only the three newly reached ranges warn; - sparse first index and skipped boundaries: expected warnings; - 16 simultaneous identical observations: one warning, all 16 skips counted; - existing ascending sweep: the original 19 warnings are preserved. `cargo xwin clippy -p victory-gpu --all-targets --target x86_64-pc-windows-msvc -- -D warnings` passes with and without `--features diagnostics`; `cargo xtask policy` passes (191 files). A separate Sol source review found no material issue under the current fixed positive capped-heap size. This is CPU policy/testing only, not a new game/GPU run or a full suite claim. AI-assisted with Codex GPT-6.1 Sol. <details><summary>Proposed follow-up patch</summary> ```diff diff --git a/crates/victory-gpu/src/descriptor/host.rs b/crates/victory-gpu/src/descriptor/host.rs index 0a2b896..e1c7fc6 100644 --- a/crates/victory-gpu/src/descriptor/host.rs +++ b/crates/victory-gpu/src/descriptor/host.rs @@ -39,13 +39,16 @@ impl PastHeap { } } - /// Counts a title slot past a heap of `count` slots: the highest index - /// seen among them. - fn note(&self, index: u32, count: u32) -> u32 { + /// Counts every skip, returning the highest index and whether this + /// observation first reaches a new warning range. The atomic's old + /// maximum keeps repeats and concurrent observations from warning again. + fn note(&self, index: u32, count: u32) -> (u32, bool) { self.skips.fetch_add(1, Ordering::Relaxed); - let highest = self.highest.fetch_max(index, Ordering::Relaxed).max(index); + let previous = self.highest.fetch_max(index, Ordering::Relaxed); + let highest = previous.max(index); self.count.store(count, Ordering::Relaxed); - highest + let warn = worth_a_warning(slots_past(count, previous), slots_past(count, highest)); + (highest, warn) } /// The skips so far, the highest index seen, and the heap's size. @@ -67,11 +70,11 @@ pub(crate) fn slots_past(count: u32, highest: u32) -> u32 { highest.saturating_sub(count.saturating_sub(1)) } -/// Whether the `past`th title slot past the host heap is worth a warning: -/// the first one, and then every doubling, so the log shows how far past the -/// heap the title went without a line per slot. -fn worth_a_warning(past: u32) -> bool { - past > 0 && past.is_power_of_two() +/// Warn for the first observation and each newly reached power-of-two +/// range, even when sparse indices skip the exact boundary. Repeated or +/// older observations stay in the previous range and do not warn. +fn worth_a_warning(previous: u32, past: u32) -> bool { + past > previous && (previous == 0 || past.ilog2() > previous.ilog2()) } pub(crate) struct HostHeap { @@ -785,9 +788,9 @@ impl HostHeap { // Diagnostic (NVIDIA heap cap): the title's slots past the host // heap. The count of them is in the run's statistics; a warning // per slot floods the log. - let highest = PAST_HEAP.note(index, self.count); + let (highest, warn) = PAST_HEAP.note(index, self.count); let past = slots_past(self.count, highest); - if worth_a_warning(past) { + if warn { tracing::warn!( past, index, @@ -1897,21 +1900,24 @@ mod tests { fn the_slots_past_a_capped_heap_are_counted_and_the_log_names_a_few() { let past = PastHeap::new(); assert_eq!(past.get(), (0, 0, 0)); - assert_eq!(past.note(1_245_183, 934_464), 1_245_183); - assert_eq!(past.note(934_464, 934_464), 1_245_183); + assert_eq!(past.note(1_245_183, 934_464), (1_245_183, true)); + assert_eq!(past.note(934_464, 934_464), (1_245_183, false)); assert_eq!(past.get(), (2, 1_245_183, 934_464)); // The warnings: the first slot past the heap and then every doubling. - assert!(worth_a_warning(1)); - assert!(worth_a_warning(2)); - assert!(!worth_a_warning(3)); - assert!(worth_a_warning(4)); - assert!(!worth_a_warning(5)); - assert!(worth_a_warning(1 << 20)); - assert!(!worth_a_warning((1 << 20) + 1)); - assert!(!worth_a_warning(0)); + assert!(worth_a_warning(0, 1)); + assert!(worth_a_warning(1, 2)); + assert!(!worth_a_warning(2, 3)); + assert!(worth_a_warning(3, 4)); + assert!(!worth_a_warning(4, 5)); + assert!(worth_a_warning((1 << 20) - 1, 1 << 20)); + assert!(!worth_a_warning(1 << 20, (1 << 20) + 1)); + assert!(!worth_a_warning(0, 0)); // A title 310 720 slots past the heap names 19 of them, however many // times the slots are skipped. - let named = (1..=310_720).filter(|n| worth_a_warning(*n)).count(); + let ascending = PastHeap::new(); + let named = (934_464..=1_245_183) + .filter(|&index| ascending.note(index, 934_464).1) + .count(); assert_eq!(named, 19); // The title's slots are numbered from zero: the ones past the heap // are those from the heap's last slot to the highest index seen. @@ -1920,6 +1926,45 @@ mod tests { assert_eq!(slots_past(934_464, 934_464), 1); } + #[test] + fn capped_heap_repeats_and_older_indices_do_not_warn_again() { + let past = PastHeap::new(); + let count = 934_464; + let indices = [count, count, count, count + 1, count + 2, count + 3, count + 2, count + 3]; + let warnings = indices.into_iter().filter(|&index| past.note(index, count).1).count(); + assert_eq!(warnings, 3); + assert_eq!(past.get(), (8, count + 3, count)); + } + + #[test] + fn capped_heap_sparse_indices_warn_when_crossing_a_range() { + let past = PastHeap::new(); + let count = 934_464; + let observations = [(count + 2, true), (count + 2, false), (count + 4, true), + (count + 3, false), (count + 6, false), (count + 8, true)]; + for (index, warn) in observations { + assert_eq!(past.note(index, count).1, warn, "index {index}"); + } + assert_eq!(past.get(), (6, count + 8, count)); + } + + #[test] + fn capped_heap_concurrent_repeats_warn_once_but_count_every_skip() { + use std::sync::{Arc, Barrier}; + let past = Arc::new(PastHeap::new()); + let barrier = Arc::new(Barrier::new(16)); + let workers: Vec<_> = (0..16).map(|_| { + let (past, barrier) = (past.clone(), barrier.clone()); + std::thread::spawn(move || { + barrier.wait(); + past.note(934_464, 934_464).1 + }) + }).collect(); + let warnings = workers.into_iter().map(|worker| worker.join().unwrap()).filter(|&warn| warn).count(); + assert_eq!(warnings, 1); + assert_eq!(past.get(), (16, 934_464, 934_464)); + } + /// Typed buffer views of integer formats carry their kind in the /// view-stride table; float, normalized, raw and structured ones none. #[test] ``` </details>
Author
Owner

@⁠cloph-dsp on GitHub · 2026-11-27 06:42 UTC · original

Independent CPU-only verification of PR #3475 (capped host heap slot logging).

  • Windows, rustc/cargo 1.100.0/MSVC, worktree-local CARGO_TARGET_DIR (D:\Victory-Contrib\target-3475-watch), CARGO_BUILD_JOBS=2.
  • Head cc7bd350d92a87ab44e6e45043ae3625871c678c, merge base 63bcca43c6a00a758510398fa43096ce7e4f7df0.
  • Command: cargo test --locked -p victory-gpu --lib -- descriptor::host::tests::the_slots_past_a_capped_heap_are_counted_and_the_log_names_a_few --exact --test-threads=1 --quiet -> 1 passed; 0 failed; 232 filtered.
  • Negative control: git grep -F for the new test name on 63bcca4 returned no hits.
  • git diff --check 63bcca4 HEAD exit 0 (clean).
  • Only the named synthetic test was replayed; the full crate suite and real D3D12 heap behaviour were not exercised. Pre-existing warnings only.
  • AI-assisted (Hy4 flash). GPU/driver: N/A (CPU-only descriptor accounting). No game data, assets, shaders, DRM or decrypt used.
**@⁠cloph-dsp** on GitHub · 2026-11-27 06:42 UTC · [original](https://github.com/Marvisak/VIctory/pull/3475#issuecomment-7211777367) Independent CPU-only verification of PR #3475 (`capped host heap slot logging`). - Windows, rustc/cargo 1.100.0/MSVC, worktree-local `CARGO_TARGET_DIR` (`D:\Victory-Contrib\target-3475-watch`), `CARGO_BUILD_JOBS=2`. - Head `cc7bd350d92a87ab44e6e45043ae3625871c678c`, merge base `63bcca43c6a00a758510398fa43096ce7e4f7df0`. - Command: `cargo test --locked -p victory-gpu --lib -- descriptor::host::tests::the_slots_past_a_capped_heap_are_counted_and_the_log_names_a_few --exact --test-threads=1 --quiet` -> `1 passed; 0 failed; 232 filtered`. - Negative control: `git grep -F` for the new test name on `63bcca4` returned no hits. - `git diff --check 63bcca4 HEAD` exit 0 (clean). - Only the named synthetic test was replayed; the full crate suite and real D3D12 heap behaviour were not exercised. Pre-existing warnings only. - AI-assisted (Hy4 flash). GPU/driver: N/A (CPU-only descriptor accounting). No game data, assets, shaders, DRM or decrypt used.
Author
Owner

@⁠tharun-37 on GitHub · 2026-11-27 06:48 UTC · original

Good catch, and the patch works as you describe — taken with one change to the wording of the helper (it now takes the previous and the new distance, as in your patch).

deafeda keeps fetch_max's previous maximum and returns it with the warning decision, so:

  • a repeat of a slot past the heap stays in the range it reached and does not warn again;
  • an older out-of-range index does not warn either;
  • a first sparse observation warns, and so does one that jumps over a power-of-two boundary;
  • every skip still counts, and the statistics line is unchanged.

Your three tests are in (capped_heap_repeats_and_older_indices_do_not_warn_again, capped_heap_sparse_indices_warn_when_crossing_a_range, capped_heap_concurrent_repeats_warn_once_but_count_every_skip), with the ascending sweep test now replaying the same note chain so the 19 warnings are checked against the production path.

On this machine (RTX 4060 Laptop, driver 32.0.16.2140, Windows 11 build 26300):

  • cargo test -p victory-gpu: 233 passed, 1 ignored; the 2 failures are the known capped-heap ones (dynamic_slots_are_held_until_released, lists_share_a_table_and_copies_keep_their_views), reproduced on main.
  • cargo clippy -p victory-gpu --all-targets -- -D warnings, with and without diagnostics: clean.
  • cargo fmt -p victory-gpu -- --check and git diff --check: clean.

Thank you for the replay and the patch.

**@⁠tharun-37** on GitHub · 2026-11-27 06:48 UTC · [original](https://github.com/Marvisak/VIctory/pull/3475#issuecomment-7211858855) Good catch, and the patch works as you describe — taken with one change to the wording of the helper (it now takes the previous and the new distance, as in your patch). `deafeda` keeps `fetch_max`'s previous maximum and returns it with the warning decision, so: - a repeat of a slot past the heap stays in the range it reached and does not warn again; - an older out-of-range index does not warn either; - a first sparse observation warns, and so does one that jumps over a power-of-two boundary; - every skip still counts, and the statistics line is unchanged. Your three tests are in (`capped_heap_repeats_and_older_indices_do_not_warn_again`, `capped_heap_sparse_indices_warn_when_crossing_a_range`, `capped_heap_concurrent_repeats_warn_once_but_count_every_skip`), with the ascending sweep test now replaying the same `note` chain so the 19 warnings are checked against the production path. On this machine (RTX 4060 Laptop, driver 32.0.16.2140, Windows 11 build 26300): - `cargo test -p victory-gpu`: 233 passed, 1 ignored; the 2 failures are the known capped-heap ones (`dynamic_slots_are_held_until_released`, `lists_share_a_table_and_copies_keep_their_views`), reproduced on `main`. - `cargo clippy -p victory-gpu --all-targets -- -D warnings`, with and without `diagnostics`: clean. - `cargo fmt -p victory-gpu -- --check` and `git diff --check`: clean. Thank you for the replay and the patch.
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/3475/head:github-bot/gh-3475'
git switch 'github-bot/gh-3475'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-3475'
git switch 'github-bot/gh-3475'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-3475'
git switch 'github-bot/gh-3475'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-3475'
git switch 'main'
git merge --squash 'github-bot/gh-3475'
git switch 'main'
git merge --ff-only 'github-bot/gh-3475'
git switch 'main'
git merge 'github-bot/gh-3475'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
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/Marvisak--VIctory!3475
No description provided.