Memory report: say how full the texture blocks are and how many queued textures wait for room #474

Open
github-bot wants to merge 1 commit from github-bot/gh-474 into main AGit
Owner

@⁠LOCKhart07 on GitHub · 2026-12-04 15:36 UTC · original
LOCKhart07:main-texture-report → main · +165 −3 · 3 files · 1 commits · open

Taken out of the structure arena change of #306, where it rode along. It has nothing to do with ray tracing and stands here on main alone. Words in the log only: nothing is placed, kept or freed otherwise. No switch.

What it adds to the memory report

  • A line for the blocks textures are cut from: how many blocks by the tenth of them textures hold (a block goes back to the card only when empty), the bytes held, resting and free, and the largest free range (a texture larger than it needs a new block). Diagnostics builds add the bytes of the textures' copy footprints against the bytes of their pieces, which is what the pieces' rounding to their placement costs; other builds do not ask the layer under us for the footprints and say so.
  • In the texture queue's line: the slots held back for want of room on the card, and how many of those are also counted as waiting for their memory.

Measured

On one machine (x86_64-pc-windows-msvc, tests under Wine on Linux, RADV):

  • pool tests: 11 passed (2 new: the line's words; blocks counted by the tenth held and free bytes by their ranges);
  • clippy (--lib --bins --tests): 51 warning lines, as on main.

Not measured

  • Not run in play on this tree, so no numbers from the line are given.
  • The cost of making the line at report time is not measured.

🤖 Generated with Claude Code

**@⁠LOCKhart07** on GitHub · 2026-12-04 15:36 UTC · [original](https://github.com/lobomfz/VIctory-xmem/pull/474) `LOCKhart07:main-texture-report` → `main` · +165 −3 · 3 files · 1 commits · open Taken out of the structure arena change of #306, where it rode along. It has nothing to do with ray tracing and stands here on main alone. Words in the log only: nothing is placed, kept or freed otherwise. No switch. ### What it adds to the memory report - A line for the blocks textures are cut from: how many blocks by the tenth of them textures hold (a block goes back to the card only when empty), the bytes held, resting and free, and the largest free range (a texture larger than it needs a new block). Diagnostics builds add the bytes of the textures' copy footprints against the bytes of their pieces, which is what the pieces' rounding to their placement costs; other builds do not ask the layer under us for the footprints and say so. - In the texture queue's line: the slots held back for want of room on the card, and how many of those are also counted as waiting for their memory. ### Measured On one machine (`x86_64-pc-windows-msvc`, tests under Wine on Linux, RADV): - pool tests: 11 passed (2 new: the line's words; blocks counted by the tenth held and free bytes by their ranges); - clippy (`--lib --bins --tests`): 51 warning lines, as on main. ### Not measured - Not run in play on this tree, so no numbers from the line are given. - The cost of making the line at report time is not measured. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Two things the memory report did not say, both about textures and neither about ray tracing (taken out of the structure arena change of #306, where they rode along):

- a line for the blocks textures are cut from: how many blocks by the tenth of them textures hold (a block goes back to the card only when empty), the bytes held, resting and free, the largest free range (a texture larger than it needs a new block), and in diagnostics builds the bytes of the textures' copy footprints against the bytes of their pieces, which is what the pieces' rounding to their placement costs. Other builds do not ask the layer under us for the footprints and say so;
- in the texture queue's line, the slots held back for want of room on the card, and how many of those are also counted as waiting for their memory.

Words in the log only: nothing is placed, kept or freed otherwise.

Tests, under Wine: pool 11 passed (2 new: the line's words; blocks counted by the tenth held and free bytes by their ranges). Not run in play on this tree, so no numbers from it are given here.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-04 15:38:31 +00:00
Author
Owner

@⁠Kal0s-design on GitHub · 2026-12-04 17:09 UTC · original

Checked 58aa134 on top of main and ran the tests natively on Windows (MSVC build, not Wine) on an NVIDIA card.

  • pool filter: 12 passed, both new tests among them
  • descriptor::host: 34 passed
  • pool again with --features diagnostics, so the GetCopyableFootprints path gets built: builds clean, 12 passed

The blocks line looks right to me. texture_blocks_report (pool.rs:670) takes the TEXTURES lock once, walks at most 64 blocks and lets go before formatting. The same report already takes that lock through texture_room() and drains() (host.rs:8020, 8032), so the lock order doesn't change. out goes down in give(), so a resting piece drops out of its block's tenth, and free() only counts ranges. The first new test checks both, and it would catch a wrong bucket or resting bytes being counted as free. Every block is BLOCK sized, so blocks * 64 MB holds, and .min(9) puts a full block in the last tenth. Outside diagnostics builds the creation path only adds one relaxed fetch_add of 0 per texture (pool.rs:1131).

Two small things in the queue part, which has no test.

  1. The new count runs every pass, not only when the line is printed. scan (descriptor/host.rs:1303-1309) walks all of held and looks each slot up in slots under the queue lock on every texture_slots_wanted call, which happens once per pass from draw.rs:3661. When the card is full held can grow to hundreds or more. It's cheap, but it could be done at report time or kept as a running count in hold/room/wake.
  2. w.mapped == 0 && w.looks > 0 also matches kind 2 in Waiting::kind (descriptor/host.rs:912-920, looks == 1 && checked.2 != 0, a recheck after a whole upload). Those slots aren't in {away}, which is kinds[3]. Any due slot can be held (draw.rs:4000), so "N of them among those waiting for their memory" can count slots that aren't in that number. w.kind() == 3 would match the wording.

Neither one blocks the PR.

AI-assisted: yes

**@⁠Kal0s-design** on GitHub · 2026-12-04 17:09 UTC · [original](https://github.com/lobomfz/VIctory-xmem/pull/474#issuecomment-7418526050) Checked 58aa134 on top of main and ran the tests natively on Windows (MSVC build, not Wine) on an NVIDIA card. - `pool` filter: 12 passed, both new tests among them - `descriptor::host`: 34 passed - `pool` again with `--features diagnostics`, so the `GetCopyableFootprints` path gets built: builds clean, 12 passed The blocks line looks right to me. `texture_blocks_report` (pool.rs:670) takes the TEXTURES lock once, walks at most 64 blocks and lets go before formatting. The same report already takes that lock through `texture_room()` and `drains()` (host.rs:8020, 8032), so the lock order doesn't change. `out` goes down in `give()`, so a resting piece drops out of its block's tenth, and `free()` only counts ranges. The first new test checks both, and it would catch a wrong bucket or resting bytes being counted as free. Every block is BLOCK sized, so `blocks * 64 MB` holds, and `.min(9)` puts a full block in the last tenth. Outside diagnostics builds the creation path only adds one relaxed `fetch_add` of 0 per texture (pool.rs:1131). Two small things in the queue part, which has no test. 1. The new count runs every pass, not only when the line is printed. `scan` (descriptor/host.rs:1303-1309) walks all of `held` and looks each slot up in `slots` under the queue lock on every `texture_slots_wanted` call, which happens once per pass from draw.rs:3661. When the card is full `held` can grow to hundreds or more. It's cheap, but it could be done at report time or kept as a running count in `hold`/`room`/`wake`. 2. `w.mapped == 0 && w.looks > 0` also matches kind 2 in `Waiting::kind` (descriptor/host.rs:912-920, `looks == 1 && checked.2 != 0`, a recheck after a whole upload). Those slots aren't in `{away}`, which is `kinds[3]`. Any due slot can be held (draw.rs:4000), so "N of them among those waiting for their memory" can count slots that aren't in that number. `w.kind() == 3` would match the wording. Neither one blocks the PR. AI-assisted: yes
Author
Owner

@⁠Luxuride on GitHub · 2026-12-04 17:15 UTC · original · edited 2026-12-04 17:21 UTC

The body already says "taken out of the structure arena change of #306", so the extraction is declared — no title change needed, and this reads as a clean, reviewable slice.

The other side of it is the queue: while #306 stays open carrying the same lines, the same hunks are proposed twice, and #306's rebase after this lands is manual. A line in #306 saying the arena report moved here, next time you touch it, is enough. Nothing to change in this PR.

**@⁠Luxuride** on GitHub · 2026-12-04 17:15 UTC · [original](https://github.com/lobomfz/VIctory-xmem/pull/474#issuecomment-7418662764) · edited 2026-12-04 17:21 UTC The body already says "taken out of the structure arena change of #306", so the extraction is declared — no title change needed, and this reads as a clean, reviewable slice. The other side of it is the queue: while #306 stays open carrying the same lines, the same hunks are proposed twice, and #306's rebase after this lands is manual. A line in #306 saying the arena report moved here, next time you touch it, is enough. Nothing to change in this PR.
This pull request has changes conflicting with the target branch.
  • crates/victory-gpu/src/host.rs
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

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

Merge

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