GPU: render targets are demoted last, and upload-heap copies take a share of the VRAM budget #2220

Closed
0xkn0wh3r3 wants to merge 8 commits from upstream-pr/2222 into main
0xkn0wh3r3 commented 2026-11-25 08:15:54 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by 0xkn0wh3r3 on 2026-11-25T08:15:54Z.


Stacked on #2130 (which is stacked on #2120): the copies in GPU upload heaps that this change sizes come from there, UPLOAD_BUDGET included. The first five commits here are #2120's (two) and #2130's (three). The last two are this change: 05160205 (priorities, the budget pool, the warning) and 2f74d7bd (priorities for heaps and committed resources only). Once #2120 and #2130 are settled, this rebases to those two.

Problem

When the process uses more video memory than DXGI's budget, Windows' video memory manager demotes some of its allocations to system memory. VIctory sets no residency priorities, so the manager chooses among all of them alike, including render targets and depth buffers drawn every frame. Frames then take seconds. VIctory's own copies in GPU upload heaps also had a fixed 2 GiB allowance (UPLOAD_BUDGET). It did not depend on how much the card has, or on how much the title's own textures already take.

Fix

Residency priorities. host::keep_resident (with host::Residency) is called where each heap or committed resource is made:

allocation priority why
host textures with the render target, depth stencil or unordered access flag (make_texture) HIGH the GPU writes them every frame, and they hold the only copy of what it wrote
view heaps' stride, mark and address tables HIGH every draw reads them
the views' written-pages bitmap HIGH shaders that mark their writes set it every frame
list scratch chunks HIGH the list's commands read them
host copies in GPU upload heaps HIGH shaders read them every frame, and they are budgeted (below)
textures uploaded from title memory (texture::title_written) NORMAL (no call) streamed, each read by some frames only; sampling one from system memory is slower but does not stall the frame. Most are placed in upstream's heaps of textures and keep their heap's normal priority

MAXIMUM is not used: the system keeps such allocations even past the budget, at the cost of other processes. LOW is not used either: it would demote streamed textures before allocations with no priority set (depth twins, upload staging).

Descriptor heaps get no priority. On an RTX 5070 Ti (driver 621.24), a priority on a shader-visible descriptor heap removed the device at the next submission, and every later GPU test failed with 0x887A0005. Resources placed in a heap get none either: their residency is their heap's. A priority asked of a placed texture also removed the device at the next submission, so make_texture sets one only on textures it commits.

Video memory budget. crate::budget calls IDXGIAdapter3::QueryVideoMemoryInfo on the host device's adapter, for the local and non-local segment groups. It reads at most every 250 ms, and again as soon as the system signals a change (RegisterVideoMemoryBudgetChangeNotificationEvent), so pools can ask as often as they like. Bytes a pool takes between readings (Budget::charge) count as used until the next reading includes them. Budget::limit(pool, own) answers how many bytes a pool may hold now: a part of what the rest of the process leaves of the local budget, up to a ceiling. Other use shrinks the answer; the pool's own bytes do not. Without a reading, the answer is the ceiling.

Upload-heap copies. UPLOAD_POOL takes half of what the rest of the process leaves. Its ceiling is 2 GiB, as before, or a quarter of the budget where that is more:

local budget used by the rest of the process copies may hold
7.5 GB (8 GB card) 2 GB 2 GiB (ceiling)
7.5 GB 5 GB 1.25 GB
7.5 GB 7.5 GB or more nothing
15 GB (16 GB card) 4 GB 3.75 GB (a quarter of the budget)

A warning, once per run. The first time local use passes nine tenths of the budget, a warning names what VIctory knows takes the memory:

  • host textures: all of them, and those lists used;
  • host copies of title memory: all of them, and those in GPU upload heaps;
  • the non-local segment's use and budget.

The check runs with each frame-rate line, whether or not a pool asks. Upstream (69d1e8e) starts giving up unused host textures fed from title memory at the same point, 90 % of the card's budget, so the warning marks where that eviction begins.

What stays the same

  • VICTORY_GPU_UPLOAD and VICTORY_GPU_UPLOAD_WRITES work as before, and both are still off by default.
  • A copy that does not fit in an upload heap goes to system memory, as before.
  • Charges are still given back when D3D12 destroys a copy's buffer.
  • On a host that does not report a budget, the pool keeps its fixed 2 GiB.

Tests

  • budget::tests replace the DXGI source with a fake and check that:
    • the limit shrinks as other use rises, down to nothing at the budget, and the pool's own bytes do not shrink it;
    • the ceiling grows only on large budgets;
    • readings are cached until they are old or a change is signalled, and charges count in between;
    • passing nine tenths is logged once;
    • the host adapter answers.
  • host::tests::upload_copies_take_their_share_of_the_budget: the upload pool's admission against a fake budget.
  • host::tests::textures_the_gpu_writes_are_kept_resident_first: the level chosen from texture flags.
  • Creation paths. ID3D12Device1 has no getter for priorities, so in test builds the helper records what it was asked for each object. These tests check that each path calls it:
    • resource::tests::host_textures_are_kept_resident_by_use (make_texture);
    • host::tests::list_scratch_chunks_are_kept_resident;
    • descriptor::host::tests::view_heap_tables_are_kept_resident (the heap itself gets no priority);
    • shadow::tests::the_written_pages_bitmap_is_kept_resident;
    • shadow::tests::upload_budget_is_given_back_when_copies_go (copies in GPU upload heaps).

Run on Windows 11 with an RTX 5070 Ti (driver 621.24):

  • cargo clippy --workspace --all-targets, with and without --features victory-gpu/diagnostics: no warnings.
  • cargo test --workspace --exclude victory-shader: everything passes except two tests that fail the same way on upstream main on this machine: descriptor::host::tests::dynamic_slots_are_held_until_released and memory::tests::lists_share_a_table_and_copies_keep_their_views.
  • cargo test -p victory-shader -- --test-threads=1: three hardware comparisons fail (a_heap_buffer_read_by_element_takes_the_views_stride, a_heap_buffer_read_where_no_buffer_view_is_reads_zeros, gathers_at_a_level_match_the_hardware). This change does not touch victory-shader.

Docs

None: docs/gpu-memory.md is gone from #2130, and this PR no longer adds to it. The budget and the priorities are described where they are code: the budget.rs module docs and host::keep_resident.

Rebased onto 13f91ca

  • Upstream 11e9a54 places textures fed from title memory in heaps of textures. keep_resident is now for heaps and committed resources only: make_texture sets a priority on the textures it commits, and placed ones keep their heap's normal priority. host_textures_are_kept_resident_by_use expects no call for a placed streamed texture.
  • Upstream 69d1e8e evicts least recently used title-fed host textures past 90 % of the budget, down to 85 %. That is the same threshold as this PR's warning. The two work together: the warning still names what takes the memory.
  • Still stacked on #2130 and #2120 (the first five commits). #2120's mapped_buffer(size, upload) is now shared_mapped_buffer.

Rebased onto 63bcca4 (with #2120 and #2130)

  • The section this PR added to docs/gpu-memory.md is dropped with that file.
  • How the device removals behind "no priority on descriptor heaps or placed textures" were reproduced: both on one GPU and driver, an RTX 5070 Ti with driver 621.24, by the victory-gpu tests. Re-checked on this head, one temporary change at a time, cargo test -p victory-gpu --lib -- --test-threads=1:
    • HIGH on the shader-visible view heap in HostHeap::new: the first test that submits work after making one (bindless::tests::heap_views_are_current) fails with 0x887A0005 (device removed), and every later GPU test fails with it: 60 failures, against 2 on this head without the change.
    • HIGH on textures make_texture places in a heap of textures (and nothing else changed), each test run alone: bindless::tests::heap_views_are_current fails with 0x887A0005, and resource::tests::only_textures_fed_from_title_memory_are_given_up gets no host texture for its placed one. Both pass without the change. First seen merging this with #2226's placed render targets (its aliased_targets_cleared_in_turn_read_their_own_clears and placed_targets_at_overlapping_offsets_share_one_host_heap failed).
    • Neither was tried on another vendor or driver.
  • cargo test -p victory-gpu --lib: 252 passed, with and without both switches; the same 2 failures as on main here (#1835). With both switches and --features diagnostics (skipping compositor_failure_presents_primary_in_the_same_frame, which exits the process on main too here): 265 passed, plus the flaky frame::tests::waits_end_on_ticks_and_count_frames. cargo clippy -p victory-gpu --all-targets, with and without --features diagnostics: clean. cargo xtask policy: ok.
<!-- greyfinch-sync:Marvisak/VIctory:issue:6600171441 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2222). Originally posted by [0xkn0wh3r3](https://github.com/0xkn0wh3r3) on 2026-11-25T08:15:54Z. --- Stacked on #2130 (which is stacked on #2120): the copies in GPU upload heaps that this change sizes come from there, `UPLOAD_BUDGET` included. The first five commits here are #2120's (two) and #2130's (three). The last two are this change: `05160205` (priorities, the budget pool, the warning) and `2f74d7bd` (priorities for heaps and committed resources only). Once #2120 and #2130 are settled, this rebases to those two. ## Problem When the process uses more video memory than DXGI's budget, Windows' video memory manager demotes some of its allocations to system memory. VIctory sets no residency priorities, so the manager chooses among all of them alike, including render targets and depth buffers drawn every frame. Frames then take seconds. VIctory's own copies in GPU upload heaps also had a fixed 2 GiB allowance (`UPLOAD_BUDGET`). It did not depend on how much the card has, or on how much the title's own textures already take. ## Fix **Residency priorities.** `host::keep_resident` (with `host::Residency`) is called where each heap or committed resource is made: | allocation | priority | why | |---|---|---| | host textures with the render target, depth stencil or unordered access flag (`make_texture`) | `HIGH` | the GPU writes them every frame, and they hold the only copy of what it wrote | | view heaps' stride, mark and address tables | `HIGH` | every draw reads them | | the views' written-pages bitmap | `HIGH` | shaders that mark their writes set it every frame | | list scratch chunks | `HIGH` | the list's commands read them | | host copies in GPU upload heaps | `HIGH` | shaders read them every frame, and they are budgeted (below) | | textures uploaded from title memory (`texture::title_written`) | `NORMAL` (no call) | streamed, each read by some frames only; sampling one from system memory is slower but does not stall the frame. Most are placed in upstream's heaps of textures and keep their heap's normal priority | `MAXIMUM` is not used: the system keeps such allocations even past the budget, at the cost of other processes. `LOW` is not used either: it would demote streamed textures before allocations with no priority set (depth twins, upload staging). Descriptor heaps get no priority. On an RTX 5070 Ti (driver 621.24), a priority on a shader-visible descriptor heap removed the device at the next submission, and every later GPU test failed with `0x887A0005`. Resources placed in a heap get none either: their residency is their heap's. A priority asked of a placed texture also removed the device at the next submission, so `make_texture` sets one only on textures it commits. **Video memory budget.** `crate::budget` calls `IDXGIAdapter3::QueryVideoMemoryInfo` on the host device's adapter, for the local and non-local segment groups. It reads at most every 250 ms, and again as soon as the system signals a change (`RegisterVideoMemoryBudgetChangeNotificationEvent`), so pools can ask as often as they like. Bytes a pool takes between readings (`Budget::charge`) count as used until the next reading includes them. `Budget::limit(pool, own)` answers how many bytes a pool may hold now: a part of what the rest of the process leaves of the local budget, up to a ceiling. Other use shrinks the answer; the pool's own bytes do not. Without a reading, the answer is the ceiling. **Upload-heap copies.** `UPLOAD_POOL` takes half of what the rest of the process leaves. Its ceiling is 2 GiB, as before, or a quarter of the budget where that is more: | local budget | used by the rest of the process | copies may hold | |---|---|---| | 7.5 GB (8 GB card) | 2 GB | 2 GiB (ceiling) | | 7.5 GB | 5 GB | 1.25 GB | | 7.5 GB | 7.5 GB or more | nothing | | 15 GB (16 GB card) | 4 GB | 3.75 GB (a quarter of the budget) | **A warning, once per run.** The first time local use passes nine tenths of the budget, a warning names what VIctory knows takes the memory: - host textures: all of them, and those lists used; - host copies of title memory: all of them, and those in GPU upload heaps; - the non-local segment's use and budget. The check runs with each frame-rate line, whether or not a pool asks. Upstream (69d1e8e) starts giving up unused host textures fed from title memory at the same point, 90 % of the card's budget, so the warning marks where that eviction begins. ## What stays the same - `VICTORY_GPU_UPLOAD` and `VICTORY_GPU_UPLOAD_WRITES` work as before, and both are still off by default. - A copy that does not fit in an upload heap goes to system memory, as before. - Charges are still given back when D3D12 destroys a copy's buffer. - On a host that does not report a budget, the pool keeps its fixed 2 GiB. ## Tests - `budget::tests` replace the DXGI source with a fake and check that: - the limit shrinks as other use rises, down to nothing at the budget, and the pool's own bytes do not shrink it; - the ceiling grows only on large budgets; - readings are cached until they are old or a change is signalled, and charges count in between; - passing nine tenths is logged once; - the host adapter answers. - `host::tests::upload_copies_take_their_share_of_the_budget`: the upload pool's admission against a fake budget. - `host::tests::textures_the_gpu_writes_are_kept_resident_first`: the level chosen from texture flags. - Creation paths. `ID3D12Device1` has no getter for priorities, so in test builds the helper records what it was asked for each object. These tests check that each path calls it: - `resource::tests::host_textures_are_kept_resident_by_use` (`make_texture`); - `host::tests::list_scratch_chunks_are_kept_resident`; - `descriptor::host::tests::view_heap_tables_are_kept_resident` (the heap itself gets no priority); - `shadow::tests::the_written_pages_bitmap_is_kept_resident`; - `shadow::tests::upload_budget_is_given_back_when_copies_go` (copies in GPU upload heaps). Run on Windows 11 with an RTX 5070 Ti (driver 621.24): - `cargo clippy --workspace --all-targets`, with and without `--features victory-gpu/diagnostics`: no warnings. - `cargo test --workspace --exclude victory-shader`: everything passes except two tests that fail the same way on upstream `main` on this machine: `descriptor::host::tests::dynamic_slots_are_held_until_released` and `memory::tests::lists_share_a_table_and_copies_keep_their_views`. - `cargo test -p victory-shader -- --test-threads=1`: three hardware comparisons fail (`a_heap_buffer_read_by_element_takes_the_views_stride`, `a_heap_buffer_read_where_no_buffer_view_is_reads_zeros`, `gathers_at_a_level_match_the_hardware`). This change does not touch `victory-shader`. ## Docs None: `docs/gpu-memory.md` is gone from #2130, and this PR no longer adds to it. The budget and the priorities are described where they are code: the `budget.rs` module docs and `host::keep_resident`. ### Rebased onto 13f91ca - Upstream 11e9a54 places textures fed from title memory in heaps of textures. `keep_resident` is now for heaps and committed resources only: `make_texture` sets a priority on the textures it commits, and placed ones keep their heap's normal priority. `host_textures_are_kept_resident_by_use` expects no call for a placed streamed texture. - Upstream 69d1e8e evicts least recently used title-fed host textures past 90 % of the budget, down to 85 %. That is the same threshold as this PR's warning. The two work together: the warning still names what takes the memory. - Still stacked on #2130 and #2120 (the first five commits). #2120's `mapped_buffer(size, upload)` is now `shared_mapped_buffer`. ### Rebased onto 63bcca4 (with #2120 and #2130) - The section this PR added to `docs/gpu-memory.md` is dropped with that file. - How the device removals behind "no priority on descriptor heaps or placed textures" were reproduced: both on one GPU and driver, an RTX 5070 Ti with driver 621.24, by the victory-gpu tests. Re-checked on this head, one temporary change at a time, `cargo test -p victory-gpu --lib -- --test-threads=1`: - `HIGH` on the shader-visible view heap in `HostHeap::new`: the first test that submits work after making one (`bindless::tests::heap_views_are_current`) fails with `0x887A0005` (device removed), and every later GPU test fails with it: 60 failures, against 2 on this head without the change. - `HIGH` on textures `make_texture` places in a heap of textures (and nothing else changed), each test run alone: `bindless::tests::heap_views_are_current` fails with `0x887A0005`, and `resource::tests::only_textures_fed_from_title_memory_are_given_up` gets no host texture for its placed one. Both pass without the change. First seen merging this with #2226's placed render targets (its `aliased_targets_cleared_in_turn_read_their_own_clears` and `placed_targets_at_overlapping_offsets_share_one_host_heap` failed). - Neither was tried on another vendor or driver. - `cargo test -p victory-gpu --lib`: 252 passed, with and without both switches; the same 2 failures as on `main` here (#1835). With both switches and `--features diagnostics` (skipping `compositor_failure_presents_primary_in_the_same_frame`, which exits the process on `main` too here): 265 passed, plus the flaky `frame::tests::waits_end_on_ticks_and_count_frames`. `cargo clippy -p victory-gpu --all-targets`, with and without `--features diagnostics`: clean. `cargo xtask policy`: ok.
catminou4 commented 2026-11-25 09:05:49 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-25T08:48:25Z.

Review: COMMENTED


Render targets demoted last + video-memory budget module (new budget.rs, +2407). Static review only: victory-gpu/victory-hle are Windows-only (D3D12/windows-sys); not compiled or tested on this macOS arm64 host. rustc 1.98.1. Big but well-motivated (system demotion picking pools by residency priority); DXGI QueryVideoMemoryInfo polling capped at 250 ms is reasonable.

<!-- greyfinch-sync:Marvisak/VIctory:review:6054379472 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2222#pullrequestreview-6054379472). Originally posted by [catminou4](https://github.com/catminou4) on 2026-11-25T08:48:25Z. **Review:** COMMENTED --- Render targets demoted last + video-memory budget module (new budget.rs, +2407). Static review only: victory-gpu/victory-hle are Windows-only (D3D12/windows-sys); not compiled or tested on this macOS arm64 host. rustc 1.98.1. Big but well-motivated (system demotion picking pools by residency priority); DXGI QueryVideoMemoryInfo polling capped at 250 ms is reasonable.
Marvisak commented 2026-11-25 19:06:15 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T18:20:02Z.


Automated triage for the maintainers.

Needs work: needs the maintainer's decision. It now merges cleanly into main. CI: not run on this head.

  • Five of the branch's seven commits are #2120 and #2130, and only 55b0b89a and 4495caf0 belong to this PR. UPLOAD_BUDGET, which the description says this replaces, does not exist in main: it comes from #2120. Please rebase once those two are settled, so this PR carries only the residency work: host::Residency/keep_resident, the new budget.rs pool, and the calls in make_texture, the descriptor heap tables and list scratch.
  • The new docs/gpu-memory.md (324 lines, with charts and rationale) goes against the short-docs rule. Please cut it to a few lines or drop it.
  • The test helper rerun_with_gpu_upload re-runs the test binary as a child process, which needs the maintainer's decision.
  • The priority choices (no priority on descriptor heaps or placed textures) rest on device removals seen on one GPU and driver. Please say how those were reproduced.

Generated by Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:comment:7170764054 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2222#issuecomment-7170764054). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T18:20:02Z. --- <!-- victory-triage v1 head=4495caf073b9b104f6573da724be3461955e52a8 verdict=needs-work at=2026-11-25T19:31:00Z --> Automated triage for the maintainers. **Needs work: needs the maintainer's decision.** It now merges cleanly into `main`. CI: not run on this head. - Five of the branch's seven commits are #2120 and #2130, and only `55b0b89a` and `4495caf0` belong to this PR. `UPLOAD_BUDGET`, which the description says this replaces, does not exist in `main`: it comes from #2120. Please rebase once those two are settled, so this PR carries only the residency work: `host::Residency`/`keep_resident`, the new `budget.rs` pool, and the calls in `make_texture`, the descriptor heap tables and list scratch. - The new `docs/gpu-memory.md` (324 lines, with charts and rationale) goes against the short-docs rule. Please cut it to a few lines or drop it. - The test helper `rerun_with_gpu_upload` re-runs the test binary as a child process, which needs the maintainer's decision. - The priority choices (no priority on descriptor heaps or placed textures) rest on device removals seen on one GPU and driver. Please say how those were reproduced. --- _Generated by [Claude Code](https://claude.ai/code)_
0xkn0wh3r3 commented 2026-11-25 21:03:23 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by 0xkn0wh3r3 on 2026-11-25T20:56:30Z.


A note for whichever of #2222 and #2226 lands second: they merge cleanly but clash in make_texture. I found this merging all my open PRs together.

  • #2222 gives every texture that isn't in a heap of textures (placement.is_none()) its own residency priority.
  • #2226 places GPU-written title textures in the title heap's host heap (aliased), so they aren't committed either. Setting a priority on a placed resource isn't allowed: it takes its heap's priority, which #2226 already sets on its host heaps.

With both merged, #2226's aliased_targets_cleared_in_turn_read_their_own_clears and placed_targets_at_overlapping_offsets_share_one_host_heap fail, as does upstream's only_textures_fed_from_title_memory_are_given_up. The fix is one condition: if placement.is_none() && aliased.is_none(). #2222's new test also needs the fourth make_texture argument (None) once #2226 is in. I'll make both changes in whichever branch lands second.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7174396416 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2222#issuecomment-7174396416). Originally posted by [0xkn0wh3r3](https://github.com/0xkn0wh3r3) on 2026-11-25T20:56:30Z. --- A note for whichever of #2222 and #2226 lands second: they merge cleanly but clash in `make_texture`. I found this merging all my open PRs together. - #2222 gives every texture that isn't in a heap of textures (`placement.is_none()`) its own residency priority. - #2226 places GPU-written title textures in the title heap's host heap (`aliased`), so they aren't committed either. Setting a priority on a placed resource isn't allowed: it takes its heap's priority, which #2226 already sets on its host heaps. With both merged, #2226's `aliased_targets_cleared_in_turn_read_their_own_clears` and `placed_targets_at_overlapping_offsets_share_one_host_heap` fail, as does upstream's `only_textures_fed_from_title_memory_are_given_up`. The fix is one condition: `if placement.is_none() && aliased.is_none()`. #2222's new test also needs the fourth `make_texture` argument (`None`) once #2226 is in. I'll make both changes in whichever branch lands second.
0xkn0wh3r3 commented 2026-11-26 01:04:07 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by 0xkn0wh3r3 on 2026-11-26T00:27:55Z.


Thanks. Rebased with #2120 and #2130 onto 63bcca4; head is now 2f74d7bd.

Stack order. Understood. The branch is #2120's two commits, then #2130's three, then this PR's own two: 05160205 (was 55b0b89a) and 2f74d7bd (was 4495caf0). UPLOAD_BUDGET comes from #2120, as you say. Once #2120 and #2130 are settled I'll rebase so only those two remain: host::Residency/keep_resident, budget.rs, and the calls in make_texture, the view heap tables, the written-pages bitmap and list scratch. The description says so now.

docs/gpu-memory.md. Dropped. #2130 removed the file, and this PR no longer adds a section to it; 05160205's message no longer mentions it. What the budget and the priorities do is in the budget.rs module docs and on host::keep_resident.

rerun_with_gpu_upload child process. Your call (the helper comes from #2120).

How the device removals were reproduced. Both were seen on one GPU and driver only: an RTX 5070 Ti with driver 621.24, the machine all my numbers come from. Both showed up in the victory-gpu tests, not in a title run:

  • Descriptor heaps. As recorded in the first commit and the description: with a priority on the shader-visible descriptor heap, the device was removed at the next submission, and every later GPU test failed with 0x887A0005.
  • Placed textures. Found merging this with #2226 (noted in this thread): its placed render targets took HIGH in make_texture, and its aliased_targets_cleared_in_turn_read_their_own_clears and placed_targets_at_overlapping_offsets_share_one_host_heap failed, as did upstream's only_textures_fed_from_title_memory_are_given_up. 2f74d7bd limits priorities to heaps and committed resources.

I re-checked both on this head today, one temporary change at a time (reverted, nothing pushed), with cargo test -p victory-gpu --lib -- --test-threads=1:

  • HIGH on the view heap in HostHeap::new: the first test that submits after making one, bindless::tests::heap_views_are_current, fails with 0x887A0005, and every later GPU test fails with it. That is 60 failures, against 2 without the change.
  • HIGH on the textures make_texture places in a heap of textures, and nothing else changed, each test run alone: heap_views_are_current fails with 0x887A0005, and only_textures_fed_from_title_memory_are_given_up gets no host texture for its placed one. Both pass without the change.

Neither was tried on another vendor or driver. So "no priority there" is what avoids the removal on this one, not a rule shown in general. Leaving those objects at the normal priority costs nothing on hosts where the call would have worked: the heap's tables and committed render targets still get HIGH.

Checks on 2f74d7bd (RTX 5070 Ti, driver 621.24):

  • cargo test -p victory-gpu --lib passes 252, with and without both switches, with the same 2 failures as main here (#1835).
  • With both switches and --features diagnostics it passes 265. That run fails the flaky frame::tests::waits_end_on_ticks_and_count_frames and skips compositor_failure_presents_primary_in_the_same_frame, which exits the process on main too here.
  • cargo clippy -p victory-gpu --all-targets, with and without --features diagnostics: clean. cargo xtask policy: ok.
<!-- greyfinch-sync:Marvisak/VIctory:comment:7178785157 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2222#issuecomment-7178785157). Originally posted by [0xkn0wh3r3](https://github.com/0xkn0wh3r3) on 2026-11-26T00:27:55Z. --- Thanks. Rebased with #2120 and #2130 onto 63bcca4; head is now `2f74d7bd`. **Stack order.** Understood. The branch is #2120's two commits, then #2130's three, then this PR's own two: `05160205` (was `55b0b89a`) and `2f74d7bd` (was `4495caf0`). `UPLOAD_BUDGET` comes from #2120, as you say. Once #2120 and #2130 are settled I'll rebase so only those two remain: `host::Residency`/`keep_resident`, `budget.rs`, and the calls in `make_texture`, the view heap tables, the written-pages bitmap and list scratch. The description says so now. **`docs/gpu-memory.md`.** Dropped. #2130 removed the file, and this PR no longer adds a section to it; `05160205`'s message no longer mentions it. What the budget and the priorities do is in the `budget.rs` module docs and on `host::keep_resident`. **`rerun_with_gpu_upload` child process.** Your call (the helper comes from #2120). **How the device removals were reproduced.** Both were seen on one GPU and driver only: an RTX 5070 Ti with driver 621.24, the machine all my numbers come from. Both showed up in the victory-gpu tests, not in a title run: - *Descriptor heaps.* As recorded in the first commit and the description: with a priority on the shader-visible descriptor heap, the device was removed at the next submission, and every later GPU test failed with `0x887A0005`. - *Placed textures.* Found merging this with #2226 (noted in this thread): its placed render targets took `HIGH` in `make_texture`, and its `aliased_targets_cleared_in_turn_read_their_own_clears` and `placed_targets_at_overlapping_offsets_share_one_host_heap` failed, as did upstream's `only_textures_fed_from_title_memory_are_given_up`. `2f74d7bd` limits priorities to heaps and committed resources. I re-checked both on this head today, one temporary change at a time (reverted, nothing pushed), with `cargo test -p victory-gpu --lib -- --test-threads=1`: - `HIGH` on the view heap in `HostHeap::new`: the first test that submits after making one, `bindless::tests::heap_views_are_current`, fails with `0x887A0005`, and every later GPU test fails with it. That is 60 failures, against 2 without the change. - `HIGH` on the textures `make_texture` places in a heap of textures, and nothing else changed, each test run alone: `heap_views_are_current` fails with `0x887A0005`, and `only_textures_fed_from_title_memory_are_given_up` gets no host texture for its placed one. Both pass without the change. Neither was tried on another vendor or driver. So "no priority there" is what avoids the removal on this one, not a rule shown in general. Leaving those objects at the normal priority costs nothing on hosts where the call would have worked: the heap's tables and committed render targets still get `HIGH`. Checks on `2f74d7bd` (RTX 5070 Ti, driver 621.24): - `cargo test -p victory-gpu --lib` passes 252, with and without both switches, with the same 2 failures as `main` here (#1835). - With both switches and `--features diagnostics` it passes 265. That run fails the flaky `frame::tests::waits_end_on_ticks_and_count_frames` and skips `compositor_failure_presents_primary_in_the_same_frame`, which exits the process on `main` too here. - `cargo clippy -p victory-gpu --all-targets`, with and without `--features diagnostics`: clean. `cargo xtask policy`: ok.
upstream-sync closed this pull request 2026-11-26 09:05:15 +00:00
0xkn0wh3r3 commented 2026-11-26 09:06:03 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by 0xkn0wh3r3 on 2026-11-26T08:05:36Z.


Replaced by #3102, which combines this with the rest of the host-memory placement work in one PR, with measurements on a discrete and an integrated GPU. Closing here.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7186176261 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2222#issuecomment-7186176261). Originally posted by [0xkn0wh3r3](https://github.com/0xkn0wh3r3) on 2026-11-26T08:05:36Z. --- Replaced by #3102, which combines this with the rest of the host-memory placement work in one PR, with measurements on a discrete and an integrated GPU. Closing here.

Pull request closed

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!2220
No description provided.