gpu(native): VICTORY_TRACE_HEAP_SET reports what the heaps keep resident that no bound table named for N frames (#79) #292

Merged
Olima34 merged 1 commit from upstream-pr/292 into main 2026-11-27 10:37:28 +00:00
Olima34 commented 2026-11-27 09:06:03 +00:00 (Migrated from github.com)

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by Olima34 on 2026-11-27T09:06:03Z.


Refs #79. This is the diagnostic asked for there, so that 16 and 24 GB Macs can send the same table as the 48 GB one. It is off by default.

What it logs. With VICTORY_TRACE_HEAP_SET=<frames>, every 64 frames (with the native draws so far line), it logs what the descriptor heaps' residency sets hold. Textures and buffers are counted apart, and each underlying allocation is counted once over all heaps: a texture view counts as its parent's memory. The total is split three ways:

  • all of it;
  • idle: named by a table a draw or dispatch bound, but not within the last <frames> frames, which is what a time-based eviction could free;
  • never: never named by a bound table.

Each entry's last use is noted where tables are remirrored (NativeHeap::used). Entries a shader reaches by indexing the heap itself aren't seen, so idle and never are upper bounds.

For testers:

VICTORY_TRACE_HEAP_SET=300 tools/macos/run-native.sh --seconds 300 --console series-s <game folder>
grep "heap set:" runs/<date>/victory.log | tail -5

Compare the totals with the Mac's RAM and with the heap_set_mb= of the native draws so far lines, and check whether idle stays at 0.

Reference (M5 Pro, 48 GB, Series S, world frames 2176–2496, 300 frames): 9.2 GB of textures and 7.6 GB of buffers (the title's pools) in the sets. 0 MB idle, and 8.3 GB of textures never named by a bound table.

Test: heap_allocations_give_each_allocation_once_with_its_latest_use (Metal) checks that a view counts with its parent and keeps the latest use over the entries.

Checks: victory-gpu and victory-metal tests pass on arm64 (373). Windows clippy is clean with -D warnings, cargo xtask policy passes, and docs/native-host.md lists the switch.

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:issue:5524014022 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/292). Originally posted by [Olima34](https://github.com/Olima34) on 2026-11-27T09:06:03Z. --- Refs #79. This is the diagnostic asked for there, so that 16 and 24 GB Macs can send the same table as the 48 GB one. It is off by default. **What it logs.** With `VICTORY_TRACE_HEAP_SET=<frames>`, every 64 frames (with the `native draws so far` line), it logs what the descriptor heaps' residency sets hold. Textures and buffers are counted apart, and each underlying allocation is counted once over all heaps: a texture view counts as its parent's memory. The total is split three ways: - **all of it;** - **idle:** named by a table a draw or dispatch bound, but not within the last `<frames>` frames, which is what a time-based eviction could free; - **never:** never named by a bound table. Each entry's last use is noted where tables are remirrored (`NativeHeap::used`). Entries a shader reaches by indexing the heap itself aren't seen, so idle and never are upper bounds. **For testers:** ```bash VICTORY_TRACE_HEAP_SET=300 tools/macos/run-native.sh --seconds 300 --console series-s <game folder> grep "heap set:" runs/<date>/victory.log | tail -5 ``` Compare the totals with the Mac's RAM and with the `heap_set_mb=` of the `native draws so far` lines, and check whether idle stays at 0. **Reference** (M5 Pro, 48 GB, Series S, world frames 2176–2496, 300 frames): 9.2 GB of textures and 7.6 GB of buffers (the title's pools) in the sets. 0 MB idle, and 8.3 GB of textures never named by a bound table. **Test:** `heap_allocations_give_each_allocation_once_with_its_latest_use` (Metal) checks that a view counts with its parent and keeps the latest use over the entries. **Checks:** victory-gpu and victory-metal tests pass on arm64 (373). Windows clippy is clean with `-D warnings`, `cargo xtask policy` passes, and `docs/native-host.md` lists the switch.
LakshanSivakumar commented 2026-11-27 10:37:39 +00:00 (Migrated from github.com)

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by LakshanSivakumar on 2026-11-27T10:37:39Z.


Thank you. Merged.

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:comment:7216112883 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/292#issuecomment-7216112883). Originally posted by [LakshanSivakumar](https://github.com/LakshanSivakumar) on 2026-11-27T10:37:39Z. --- Thank you. Merged.
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
LakshanSivakumar/Native-Victory-macOS!292
No description provided.