Repository navigation
Conversation
Ports the first-use half of Marvisak#431 (AntoninMichelq) onto current main; the other half (freeing host objects only after running submissions) is already in main. A title texture's host copy was made when the title created the resource. Most are never used by a list, and on small cards the rest spills into system RAM: with Marvisak#431 on the older base, a 6 GB / 16 GB laptop's story load went from 22.7 to 18.2 GB private and from 7.2 to 3.7 GB of GPU memory in RAM. `Resource::host` now makes it on first use (a view, a target, a copy, a barrier: every `host_resource` / `host_copy` / `host_transition`), from the creation state and clear value kept with the resource, and registers the texture by memory then. Paths that must not create one (`current`, `alias_source` while it holds `TEXTURES_AT`, `Drop`) read `host_made`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
In-title result, and it's weaker than I hoped, so here it is plainly. Setup: RTX 3050 6 GB Laptop, 16 GB RAM.
So at boot it saves ~1–4%, not the 20% that #431 gave on the old base. The reason: What it may still save: textures made after the heap is mirrored and never put in a slot. An earlier local run of the same change on To get #431's old effect on current AI use: Claude Code (Claude Opus 5.5) ran these builds and wrote this; the results are from the runs described. |
catminou4
left a comment
There was a problem hiding this comment.
Static review only: victory-gpu is Windows-only (D3D12/windows_sys) — nothing compiles or runs on macOS; source review of the diff.
Title texture's host texture made on first use: lazy texture creation — memory win; check first-use stall.
…ts first use (the first-use half of Marvisak#431)
|
Automated triage for the maintainers. This pull request no longer merges cleanly into Generated by Claude Code |
|
On an RTX 3070,
AI-assisted. |
|
Second RTX 3070 confirming Slay326's failure.
The 2 failures on AI-assisted (Claude Code). Synthetic tests only. |
Textures the title places in its own memory and views without a resource object get a resource and a host texture on first use (`texture_at`), and were never released: one host texture per address and description ever viewed. On Zettrox/ztrx that was 18,639 of them, 2.5 GB, after nine minutes of Grand Theft Auto VI; past the card's memory budget the system moved video memory into the PC's, which ended two of its runs. Each placed texture now notes its last use (time and frame) under the table's lock when `texture_at` hands it out. Once a second, at present, those that are idle and held by nothing else are let go with their host texture and staging. One goes when: - no view named it for 5 seconds and 4 frames (1 second and 2 frames while the process uses more than nine tenths of the card's memory budget, from DXGI's QueryVideoMemoryInfo); - the title holds no reference, no list not yet reset names its host texture, and no title texture shares that host texture; - the host GPU texture has no other COM reference: no view heap slot keeps it and none was retired; - the host never wrote it (its contents are title memory's). Its host GPU texture is retired (`crate::host::retire`), so a submission running at that moment still has it until it has run. The next view makes it again and uploads title memory again. Placed textures replaced by a newer one (their memory's host texture was replaced) are no longer kept forever either; they go the same way. Dead entries of the memory-to-host-texture map are dropped after a sweep. shortcut: a thread handed a resource by `texture_at` is protected by the idle time alone until its use makes a list or slot hold it; every caller uses it at once, within the title's call. `VICTORY_TEXTURE_SWEEP=0` keeps them all, as before. The fps companion line counts the placed textures let go and their bytes. Tests (no game data): - `idle_placed_textures_go_unless_something_holds_them`: a placed texture in title memory stays while just used, while too few frames or too little time passed, while a list not yet reset names it, while another reference holds its host GPU texture, and while host-written; then it goes, leaves the table, and the next view makes it again. - `past_the_budget_idle_textures_go_sooner`. Idea from Zettrox/ztrx (`let_go_idle`), written for upstream's placed texture table: ztrx makes host copies lazily (as Marvisak#1969 proposes) and lets go of the copy only; here the whole placed resource goes.
…exture's first use) Taken in place of Marvisak#1969: with Marvisak#1969 a placed view used first made the memory's host texture with its own (fewer) uses, and the title texture the GPU writes then got another, so the placed view did not see the GPU's writes (draw test a_texture_written_in_one_format_reads_in_another _through_a_placed_view failed on WARP). Marvisak#2221's `lead` makes it as the title texture of the memory with the most uses. Conflicts in resource.rs: - hand_out_resource: kept layer 4's read-only buffer registration (Marvisak#2120); textures are counted as waiting and listed by memory at creation (Marvisak#2221). - alias_source: kept layer 4's order (cheap tests first, layouts last) with Marvisak#2221's made()/host_texture() in place of the host field. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…arvisak#1873, Marvisak#2221, Marvisak#2161, idle staging buffers released) Marvisak#1873 81ebd7c: one shared scratch buffer for texture detiling. Marvisak#2221 df15bd1 (in place of Marvisak#1969): host textures made on a title texture's first use. Marvisak#2161 e04431f: idle placed textures are let go. 47bb09c: idle staging buffers are let go, their host textures kept. For A/B: VICTORY_STAGING_SWEEP=0, VICTORY_TEXTURE_SWEEP=0. Runtime only. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Ports the first-use half of #431 (by @AntoninMichelq) onto current
main. #431 and #1526 closed each other as duplicates (see #431), so nothing open covered it. The other half of #431, freeing host objects only after running submissions, is already inmain(host::retire/release_retired).What
A title texture's host copy was made when the title created the resource. Most are never used by a list, and on small cards the unused ones spill into system RAM. With #431 on the older base, a 6 GB / 16 GB laptop's story load went from 22.7 to 18.2 GB private and from 7.2 to 3.7 GB of GPU memory in RAM. 0xKaji measured ~7.85 → ~5.39 GiB of host textures on an 8 GB card with #1526.
Resource.hostis aOnceLock.Resource::hostmakes the texture on first use, from the creation state and clear value kept with the resource (made_with), then registers it inTEXTURES_AT. Everyhost_resource/host_copy/host_transitionis a first use: views, targets, copies, barriers.host_madeinstead:current,alias_source(it holdsTEXTURES_AT), andDrop.texture_at(placed views) still makes its texture at once, as before.MEMORY(inshared_texture), thenTEXTURES_AT. Nothing takes them the other way round.Tested
Windows 11 26300, Rust 1.98.1, on
main940d32f:a_texture_gets_its_host_copy_on_first_use: no host texture at creation, made on the firsthost_resource, made once, registered by memory once made.cargo test -p victory-gpu --locked: 140 passed, 3 failed, the same 3 that fail onmainhere (the Intel Iris Xe the tests run on: the 2 heap-cap tests of Test report: RTX 5070 (Blackwell), Windows 11, 70564ae: 471 passed, 5 failed, 7 ignored (4 from the 1,000,000 view heap cap) #1744, and the castable test that GPU tests: the castable pair is two host textures where the host refuses castable formats #1765 fixes).cargo clippy --workspace --all-targets --locked -- -D warnings: clean.cargo xtask policy: ok.Not tested yet: the title on this exact tree. On NVIDIA,
mainstops at boot without #1763 (#1754), so a title run needs that too. I'll post the numbers here once I have them.AI use: Claude Code (Claude Opus 5.5) ported the change (from a local port made earlier in the same setup), wrote the test and ran the checks; the results are from the runs described.
🤖 Generated with Claude Code