gpu(native): VICTORY_TRACE_UNMAPPED_LEVELS=1 — host bytes of wholly unmapped mip levels (#458 measure-first) #500

Open
github-bot wants to merge 2 commits from github-bot/gh-496 into main AGit
Owner

@⁠AnastasisKon on GitHub · 2026-11-27 22:15 UTC · original
AnastasisKon:vibe/unmapped-levels-trace-1705ac → main · +160 −0 · 3 files · 2 commits · open

What this changes

Refs #462, the measure-first step only (no behaviour change; the levels-on-demand remake stays for after the measurement).

  • PoolTable::mapped_len(addr, len): bytes of a range currently mapped in a live pool, coalescing adjacent mappings like read_mapped_with. Pinned by mapped_len_sums_overlaps_and_ignores_gaps_and_dead_pools.
  • VICTORY_TRACE_UNMAPPED_LEVELS=1 (off by default, documented in docs/native-host.md): every 64 submissions, one line unmapped levels: <MB>MB in <n> levels of <n> textures (f<fmt>=<MB>MB …) — the bytes of mip levels whose title pages are all unmapped, total and per format (six largest). Title-level bytes stand in for host bytes (same texel count); slice 0's range stands in for every slice's — both noted in the doc entry. The per-texture aggregation is the pure unmapped_level_bytes, pinned by unmapped_level_bytes_counts_only_wholly_unmapped_levels.

Off, the cost is one OnceLock read of the switch per submission.

How it was tested

  • cargo test -p victory-gpu — 414 passed (incl. the 2 new tests), 0 failed, arm64 host with the Metal Shader Converter present
  • cargo test -p victory-hle -p victory -p xtask — pass
  • cargo clippy --workspace --all-targets --locked --target x86_64-pc-windows-gnullvm -- -D warnings — pass (RC=0, 0 errors)
  • cargo xtask policy — pass (398 files ok)
  • Ran the game: not needed for the switch itself; the follow-up is a world run with VICTORY_TRACE_UNMAPPED_LEVELS=1 on a machine with a game copy, read with run-summary.sh

Checklist

  • No game files, game code, disassembly listings or SDK files are included
  • Guesses about undocumented console behaviour are marked — n/a, diagnostic only; the byte approximations are documented in the native-host.md entry
  • New diagnostics are behind a VICTORY_* variable (VICTORY_TRACE_UNMAPPED_LEVELS) and documented in docs/native-host.md
**@⁠AnastasisKon** on GitHub · 2026-11-27 22:15 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/496) `AnastasisKon:vibe/unmapped-levels-trace-1705ac` → `main` · +160 −0 · 3 files · 2 commits · open ## What this changes Refs #462, the measure-first step only (no behaviour change; the levels-on-demand remake stays for after the measurement). - `PoolTable::mapped_len(addr, len)`: bytes of a range currently mapped in a live pool, coalescing adjacent mappings like `read_mapped_with`. Pinned by `mapped_len_sums_overlaps_and_ignores_gaps_and_dead_pools`. - `VICTORY_TRACE_UNMAPPED_LEVELS=1` (off by default, documented in docs/native-host.md): every 64 submissions, one line `unmapped levels: <MB>MB in <n> levels of <n> textures (f<fmt>=<MB>MB …)` — the bytes of mip levels whose title pages are all unmapped, total and per format (six largest). Title-level bytes stand in for host bytes (same texel count); slice 0's range stands in for every slice's — both noted in the doc entry. The per-texture aggregation is the pure `unmapped_level_bytes`, pinned by `unmapped_level_bytes_counts_only_wholly_unmapped_levels`. Off, the cost is one `OnceLock` read of the switch per submission. ## How it was tested - [x] `cargo test -p victory-gpu` — 414 passed (incl. the 2 new tests), 0 failed, arm64 host with the Metal Shader Converter present - [x] `cargo test -p victory-hle -p victory -p xtask` — pass - [x] `cargo clippy --workspace --all-targets --locked --target x86_64-pc-windows-gnullvm -- -D warnings` — pass (RC=0, 0 errors) - [x] `cargo xtask policy` — pass (398 files ok) - [x] Ran the game: not needed for the switch itself; the follow-up is a world run with `VICTORY_TRACE_UNMAPPED_LEVELS=1` on a machine with a game copy, read with run-summary.sh ## Checklist - [x] No game files, game code, disassembly listings or SDK files are included - [x] Guesses about undocumented console behaviour are marked — n/a, diagnostic only; the byte approximations are documented in the native-host.md entry - [x] New diagnostics are behind a `VICTORY_*` variable (`VICTORY_TRACE_UNMAPPED_LEVELS`) and documented in docs/native-host.md
Refs #458 measure-first step. Every 64 submissions, one line with the
bytes of texture levels whose title pages are all unmapped, total and per
format (top six): mip-streamed textures are placed whole but their fine
levels map as they stream in, while the host texture is made with the whole
chain. New PoolTable::mapped_len (bytes of a range currently mapped in a
live pool); the level aggregation is a pure function, both pinned by unit
tests. Documented in docs/native-host.md.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 22:17:29 +00:00
Author
Owner

@⁠Olima34 on GitHub · 2026-11-28 00:37 UTC · original · requested changes

Thanks for this PR! We're helping the maintainer clear the queue tonight, and main has moved a lot (the preview branch landed as 86cefd22, then a batch of PRs; main is now a6a58361). This branch now conflicts with main in docs/native-host.md.

Could you merge current main into the branch (a merge commit is fine, no need to rebase) and resolve the conflict? It's only the docs paragraph. Once GitHub shows it as mergeable and CI is green on the new head, we'll read it through and merge it if it holds up.

**@⁠Olima34** on GitHub · 2026-11-28 00:37 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/496#pullrequestreview-6094670152) · **requested changes** Thanks for this PR! We're helping the maintainer clear the queue tonight, and main has moved a lot (the preview branch landed as 86cefd22, then a batch of PRs; main is now a6a58361). This branch now conflicts with main in `docs/native-host.md`. Could you merge current `main` into the branch (a merge commit is fine, no need to rebase) and resolve the conflict? It's only the docs paragraph. Once GitHub shows it as mergeable and CI is green on the new head, we'll read it through and merge it if it holds up.
Keeps both diagnostics entries in docs/native-host.md (main's
VICTORY_SUBMIT_TIMING from the landed batch, this branch's
VICTORY_TRACE_UNMAPPED_LEVELS).
Author
Owner

@⁠AnastasisKon on GitHub · 2026-11-28 10:18 UTC · original

Merged current main into the branch and resolved the conflict keeping both sides, as requested. CI is green on the new head and the PR shows mergeable. Ready for re-review.

**@⁠AnastasisKon** on GitHub · 2026-11-28 10:18 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/496#issuecomment-7237810456) Merged current main into the branch and resolved the conflict keeping both sides, as requested. CI is green on the new head and the PR shows mergeable. Ready for re-review.
Author
Owner

@⁠AnastasisKon on GitHub · 2026-11-28 12:31 UTC · original

Re-requesting review: conflicts with current main are resolved, CI is green on the latest head, and the earlier approval was noted as still standing. Ready to merge when you are.

**@⁠AnastasisKon** on GitHub · 2026-11-28 12:31 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/496#issuecomment-7239290633) Re-requesting review: conflicts with current main are resolved, CI is green on the latest head, and the earlier approval was noted as still standing. Ready to merge when you are.
Author
Owner

@⁠AnastasisKon on GitHub · 2026-11-28 15:27 UTC · original

The branch is now based on the current public main (26817285), which already contains the #471/#494/#503 merges, and GitHub shows mergeable=true (the earlier conflict was against the newer private main). The requested shape is in place: the `VICTORY_TRACE_UNMAPPED_LEVELS` paragraph in `docs/native-host.md`. Could you re-review when you get a chance?

**@⁠AnastasisKon** on GitHub · 2026-11-28 15:27 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/496#issuecomment-7241479707) The branch is now based on the current public `main` (26817285), which already contains the #471/#494/#503 merges, and GitHub shows `mergeable=true` (the earlier conflict was against the newer private main). The requested shape is in place: the \`VICTORY_TRACE_UNMAPPED_LEVELS\` paragraph in \`docs/native-host.md\`. Could you re-review when you get a chance?
Author
Owner

@⁠AnastasisKon on GitHub · 2026-11-28 18:16 UTC · original

Re-requesting review: the head c8dd335e already merges public main 26817285, and git merge-tree shows no conflicts against current main — the docs/native-host.md paragraph is resolved with main's version plus this PR's section. CI is green on this head. Ready to merge when you are.

**@⁠AnastasisKon** on GitHub · 2026-11-28 18:16 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/496#issuecomment-7243669162) Re-requesting review: the head c8dd335e already merges public `main` 26817285, and `git merge-tree` shows no conflicts against current `main` — the `docs/native-host.md` paragraph is resolved with main's version plus this PR's section. CI is green on this head. Ready to merge when you are.
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/500/head:github-bot/gh-496'
git switch 'github-bot/gh-496'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-496'
git switch 'github-bot/gh-496'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-496'
git switch 'github-bot/gh-496'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-496'
git switch 'main'
git merge --squash 'github-bot/gh-496'
git switch 'main'
git merge --ff-only 'github-bot/gh-496'
git switch 'main'
git merge 'github-bot/gh-496'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.