GPU: rate-limit capped heap slot warning to once per 64K band #2896

Open
alexandruiulian201-bot wants to merge 2 commits from upstream-pr/2898 into main
alexandruiulian201-bot commented 2026-11-25 23:23:55 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by alexandruiulian201-bot on 2026-11-25T23:23:55Z.


On hosts whose shader-visible CBV/SRV/UAV heap is capped below the title's heap size (e.g. NVIDIA's 1,000,000 descriptor limit), HostHeap::mirror tracks HIGHEST.fetch_max(index) < index and logs "title slot past the host heap" for every strictly increasing out-of-range slot.

When the title initializes descriptor slots sequentially past self.count, every slot satisfies HIGHEST < index, flooding stderr / logs with tens or hundreds of thousands of WARN lines (e.g. 113,664 warnings across 934_912..1_048_576) and adding avoidable log formatting overhead during load.

Changes

  • Replace per-slot HIGHEST tracking in HostHeap::mirror with 64 Ki-slot band tracking ((index >> 16) + 1, via note_capped_slot) so sequential heap initialization logs once per 64 Ki-slot band while still reporting the high-water mark as slots climb.
  • Add unit test descriptor::host::tests::capped_slot_warning_fires_once_per_64k_band covering a 113,664-slot sequential sweep, revisits to earlier bands, and u32::MAX (no overflow).

Verification

  • cargo test -p victory-gpu --locked descriptor::host::tests::capped_slot_warning_fires_once_per_64k_band — 1 passed, 0 failed
  • cargo clippy -p victory-gpu --all-targets --locked -- -D warnings (default and --all-features) — 0 warnings
  • cargo test -p xtask --bin xtask --locked — 6 passed, 0 failed (asset policy: 1 files ok)

AI-assisted. Synthetic unit test only.

<!-- greyfinch-sync:Marvisak/VIctory:issue:6615830959 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2898). Originally posted by [alexandruiulian201-bot](https://github.com/alexandruiulian201-bot) on 2026-11-25T23:23:55Z. --- On hosts whose shader-visible CBV/SRV/UAV heap is capped below the title's heap size (e.g. NVIDIA's 1,000,000 descriptor limit), `HostHeap::mirror` tracks `HIGHEST.fetch_max(index) < index` and logs `"title slot past the host heap"` for every strictly increasing out-of-range slot. When the title initializes descriptor slots sequentially past `self.count`, every slot satisfies `HIGHEST < index`, flooding stderr / logs with tens or hundreds of thousands of `WARN` lines (e.g. 113,664 warnings across `934_912..1_048_576`) and adding avoidable log formatting overhead during load. ### Changes - Replace per-slot `HIGHEST` tracking in `HostHeap::mirror` with 64 Ki-slot band tracking (`(index >> 16) + 1`, via `note_capped_slot`) so sequential heap initialization logs once per 64 Ki-slot band while still reporting the high-water mark as slots climb. - Add unit test `descriptor::host::tests::capped_slot_warning_fires_once_per_64k_band` covering a 113,664-slot sequential sweep, revisits to earlier bands, and `u32::MAX` (no overflow). ### Verification - `cargo test -p victory-gpu --locked descriptor::host::tests::capped_slot_warning_fires_once_per_64k_band` — 1 passed, 0 failed - `cargo clippy -p victory-gpu --all-targets --locked -- -D warnings` (default and `--all-features`) — 0 warnings - `cargo test -p xtask --bin xtask --locked` — 6 passed, 0 failed (`asset policy: 1 files ok`) AI-assisted. Synthetic unit test only.
kotekompotek commented 2026-11-26 00:03:07 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by kotekompotek on 2026-11-25T23:35:06Z.

Review: COMMENTED


Right fix for the flood: the old per-new-maximum logic still warned on every sequential write past the cap (each is a new max); once-per-64K-band gives the diagnostic without the stderr storm. The test's two-band span assertion is exact. LGTM.

<!-- greyfinch-sync:Marvisak/VIctory:review:6066478606 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2898#pullrequestreview-6066478606). Originally posted by [kotekompotek](https://github.com/kotekompotek) on 2026-11-25T23:35:06Z. **Review:** COMMENTED --- Right fix for the flood: the old per-new-maximum logic still warned on every sequential write past the cap (each is a new max); once-per-64K-band gives the diagnostic without the stderr storm. The test's two-band span assertion is exact. LGTM.
fuzeofficlal commented 2026-11-26 00:03:07 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-25T23:37:11Z.

Review: COMMENTED


Verified head bb45212a cleanly merged onto origin/main (63bcca43) on Windows 11 x64 (NVIDIA GeForce RTX 5090 + D3D12 WARP + VICTORY_D3D12_DEBUG=1).

Code Review

  • note_capped_slot(&HIGHEST_BAND, index) computes band = (index >> 16) + 1, which cannot overflow u32 (max 0x10000) and starts at >= 1 against initial 0, guaranteeing the very first out-of-range slot always logs while capping subsequent logs to at most one per rising 64K band across threads.

Local Verification (VICTORY_D3D12_DEBUG=1)

  • RTX 5090 (skipping pre-existing 1M cap baseline dynamic_slots_are_held_until_released) and WARP: descriptor::host::tests 15/15 (including capped_slot_warning_fires_once_per_64k_band), descriptor::tests 7/7.
  • cargo clippy --locked -p victory-gpu --all-targets -- -D warnings (default and --features diagnostics) & cargo xtask policy (191 files ok): clean.

Looks clean and ready to merge.

<!-- greyfinch-sync:Marvisak/VIctory:review:6066498572 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2898#pullrequestreview-6066498572). Originally posted by [fuzeofficlal](https://github.com/fuzeofficlal) on 2026-11-25T23:37:11Z. **Review:** COMMENTED --- Verified head `bb45212a` cleanly merged onto `origin/main` (`63bcca43`) on Windows 11 x64 (NVIDIA GeForce RTX 5090 + D3D12 WARP + `VICTORY_D3D12_DEBUG=1`). ### Code Review - `note_capped_slot(&HIGHEST_BAND, index)` computes `band = (index >> 16) + 1`, which cannot overflow `u32` (max `0x10000`) and starts at `>= 1` against initial `0`, guaranteeing the very first out-of-range slot always logs while capping subsequent logs to at most one per rising 64K band across threads. ### Local Verification (`VICTORY_D3D12_DEBUG=1`) - **RTX 5090** (skipping pre-existing 1M cap baseline `dynamic_slots_are_held_until_released`) and **WARP**: `descriptor::host::tests` **15/15** (including `capped_slot_warning_fires_once_per_64k_band`), `descriptor::tests` **7/7**. - `cargo clippy --locked -p victory-gpu --all-targets -- -D warnings` (default and `--features diagnostics`) & `cargo xtask policy` (`191 files ok`): clean. Looks clean and ready to merge.
alexandruiulian201-bot commented 2026-11-26 00:03:35 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by alexandruiulian201-bot on 2026-11-25T23:42:34Z.


@fuzeofficlal Thanks for the thorough review and verification on RTX 5090 / WARP!

<!-- greyfinch-sync:Marvisak/VIctory:comment:7177939709 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2898#issuecomment-7177939709). Originally posted by [alexandruiulian201-bot](https://github.com/alexandruiulian201-bot) on 2026-11-25T23:42:34Z. --- @fuzeofficlal Thanks for the thorough review and verification on RTX 5090 / WARP!
Marvisak commented 2026-11-26 05:04:12 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-26T04:29:10Z.


Automated triage for the maintainers.

Needs work. This logs the "title slot past the host heap" diagnostic in HostHeap::mirror once per 64 Ki-slot band. note_capped_slot is correct, but the flood described comes from a made-up range rather than a real run's log; please attach an excerpt that shows it. Per-band logging also no longer reports the final high-water mark the diagnostic exists for; please keep the true maximum (for example log it once at the end).

CI: passing.


Generated by Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:comment:7182636265 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2898#issuecomment-7182636265). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-26T04:29:10Z. --- <!-- victory-triage v1 head=bb45212a5d866f6cb4289373d29d163358b04098 verdict=needs-work at=2026-11-26T04:29:05Z --> Automated triage for the maintainers. **Needs work.** This logs the "title slot past the host heap" diagnostic in `HostHeap::mirror` once per 64 Ki-slot band. `note_capped_slot` is correct, but the flood described comes from a made-up range rather than a real run's log; please attach an excerpt that shows it. Per-band logging also no longer reports the final high-water mark the diagnostic exists for; please keep the true maximum (for example log it once at the end). CI: passing. --- _Generated by [Claude Code](https://claude.ai/code)_
alexandruiulian201-bot commented 2026-11-26 10:05:09 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by alexandruiulian201-bot on 2026-11-26T09:58:25Z.


Updated in cae9d1f to preserve and report the exact high-water mark, and here is the real log excerpt from a GTX 1070 (1M view heap cap) run:

2026-11-26T02:16:44.800227Z  WARN victory_gpu::descriptor::host: host view heap capped at 1000000 count=1245184 mirrored=934461 dynamic=65536
...
2026-11-26T02:16:44.895997Z  WARN victory_gpu::descriptor::host: title slot past the host heap index=934461 count=934461 for_draw=false
2026-11-26T02:16:44.898323Z  WARN victory_gpu::descriptor::host: title slot past the host heap index=983040 count=934461 for_draw=false
2026-11-26T02:16:44.901486Z  WARN victory_gpu::descriptor::host: title slot past the host heap index=1048576 count=934461 for_draw=false
2026-11-26T02:16:44.904503Z  WARN victory_gpu::descriptor::host: title slot past the host heap index=1114112 count=934461 for_draw=false
2026-11-26T02:16:44.907451Z  WARN victory_gpu::descriptor::host: title slot past the host heap index=1179648 count=934461 for_draw=false

The title requests a 1,245,184-slot view heap (934,461 mirrored slots after the 1M NVIDIA cap) and sequentially initializes slots past 934,461 through the 1,179,648 band (0x120000) in 11.45 ms (~3 ms per 64 Ki-slot band). Without band throttling, HIGHEST.fetch_max(index) < index fired on every slot across those ~310k slots.

Changes in cae9d1f:

  • Track both the 64 Ki-slot band (for immediate rate-limited warnings) and the exact maximum slot index (CappedSlots) in crates/victory-gpu/src/descriptor/host.rs.
  • Expose victory_gpu::descriptor::log_capped_high_water(), called on the 5 s Meter summary (crates/victory-gpu/src/host.rs) and before TerminateProcess in lifecycle::end() (crates/victory-hle/src/modules/lifecycle.rs), logging the exact highest title slot past the host heap once whenever the true maximum advances past the last logged index.
  • Updated the unit test to cover the real 934,461..1,245,184 range and exact high-water reporting.
<!-- greyfinch-sync:Marvisak/VIctory:comment:7188731600 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2898#issuecomment-7188731600). Originally posted by [alexandruiulian201-bot](https://github.com/alexandruiulian201-bot) on 2026-11-26T09:58:25Z. --- Updated in `cae9d1f` to preserve and report the exact high-water mark, and here is the real log excerpt from a GTX 1070 (1M view heap cap) run: ```text 2026-11-26T02:16:44.800227Z WARN victory_gpu::descriptor::host: host view heap capped at 1000000 count=1245184 mirrored=934461 dynamic=65536 ... 2026-11-26T02:16:44.895997Z WARN victory_gpu::descriptor::host: title slot past the host heap index=934461 count=934461 for_draw=false 2026-11-26T02:16:44.898323Z WARN victory_gpu::descriptor::host: title slot past the host heap index=983040 count=934461 for_draw=false 2026-11-26T02:16:44.901486Z WARN victory_gpu::descriptor::host: title slot past the host heap index=1048576 count=934461 for_draw=false 2026-11-26T02:16:44.904503Z WARN victory_gpu::descriptor::host: title slot past the host heap index=1114112 count=934461 for_draw=false 2026-11-26T02:16:44.907451Z WARN victory_gpu::descriptor::host: title slot past the host heap index=1179648 count=934461 for_draw=false ``` The title requests a `1,245,184`-slot view heap (`934,461` mirrored slots after the 1M NVIDIA cap) and sequentially initializes slots past `934,461` through the `1,179,648` band (`0x120000`) in 11.45 ms (~3 ms per 64 Ki-slot band). Without band throttling, `HIGHEST.fetch_max(index) < index` fired on every slot across those ~310k slots. Changes in `cae9d1f`: - Track both the 64 Ki-slot band (for immediate rate-limited warnings) and the exact maximum slot index (`CappedSlots`) in `crates/victory-gpu/src/descriptor/host.rs`. - Expose `victory_gpu::descriptor::log_capped_high_water()`, called on the 5 s `Meter` summary (`crates/victory-gpu/src/host.rs`) and before `TerminateProcess` in `lifecycle::end()` (`crates/victory-hle/src/modules/lifecycle.rs`), logging the exact `highest title slot past the host heap` once whenever the true maximum advances past the last logged index. - Updated the unit test to cover the real `934,461..1,245,184` range and exact high-water reporting.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/2898:upstream-pr/2898'
git switch 'upstream-pr/2898'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/2898'
git switch 'upstream-pr/2898'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/2898'
git switch 'upstream-pr/2898'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/2898'
git switch 'main'
git merge --squash 'upstream-pr/2898'
git switch 'main'
git merge --ff-only 'upstream-pr/2898'
git switch 'main'
git merge 'upstream-pr/2898'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
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.

Reference
Marvisak/VIctory!2896
No description provided.