WIP: fix(vk): pause VRAM compaction after a slow allocator pass #2032

Draft
khuongngo0310 wants to merge 2 commits from khuongngo0310/Longshot:codex/vram-compaction-stall into main
First-time contributor

Summary

A slow VMA defragmentation pass can leave the texture compaction sweep running. Finish the sweep if beginning or ending a pass takes at least 50 ms, and wait five seconds before starting another one.

A slow begin returns the unused temporary allocations. A slow end keeps the completed GPU copies and the freed-byte totals. Keep the image reaper excluded while VMA opens or closes the context because those operations change the pool's sorting mode.

Testing

Tested: Windows 11, RTX 3060 Ti, NVIDIA 621.01, 2560×1440. Loaded the Market and Kakariko Village, then completed a scripted 600-frame camera pan in Hyrule Field. The texture pool opened and closed 29 compaction sweeps with the reduced threshold. The game exited normally. The game-free regression reproduced the unclosed sweep on main and passed with this change. The threaded reaper check and independent code review also passed.

Still to test:

  • Windows, by hand: run the full game-free suite against main and check for new failures.
  • Hardware that reproduces the long hitch, by hand: trigger a slow allocator pass and check that the sweep closes and does not restart for five seconds.
  • Linux, by hand: build the renderer and run the allocator and image reaper checks.

Measurements

Verdict: The game-free tests reproduced the slow-pass failure and verified the recovery. Gameplay exercised normal compaction. Neither build hit a slow allocator pass or a frame of 50 ms or more in the timed route. The patch had higher average FPS and higher p99 frame time in both pairs. These runs leave the effect on the reported long hitch unmeasured.

Two interleaved runs per build on Windows 11, RTX 3060 Ti (NVIDIA 621.01), with the same copied save and 2560x1440 output. Loaded the Market and Kakariko Village, then recorded the same 600-frame camera sweep in Hyrule Field. Both builds used a lowered compaction threshold, disabled image preallocation, uncapped FPS, and frame generation and VSync off.

Check Before: main @ 85a59e6f After: this PR @ bcb7cf16
Hyrule Field FPS, each run (median) 61.51 / 61.22 (61.36) 62.60 / 63.22 (62.91)
Hyrule Field p99 frame time, each run 23.82 / 26.59 ms 27.67 / 27.27 ms
Compaction sweeps started, each run 16 / 15 12 / 15
Frames at or above 50 ms 0 / 0 0 / 0
Slow allocator begin in the game-free fixture Sweep stays active Sweep closes and unused moves are returned
Slow end in the threaded fixture An incomplete pass can keep the context open Completed copies are kept, the context closes and the reaper resumes

Risks

After a slow sweep, the five-second pause may retain VRAM longer under sustained memory pressure. The first slow allocator call can still hitch. The existing RX_VK_COMPACT=0 switch disables texture compaction.

Checklist

Ready for review

  • One topic, on current main; the title is a Conventional Commit.
  • Tested on my own PC, in the game for a change the game runs, as Testing says.
  • mise run test passes (any failure that also fails on main is named).
  • Measured against main, or Measurements says why there is nothing to measure.
  • No game files, build output or hand-edited generated files; third_party/ untouched; nothing GPL-incompatible.

When it applies

  • A fix: a game-free test that fails on main and passes here.
  • A check under tests/ that reads changed source is updated, not weakened.
  • Host code builds on Windows (llvm-mingw) and Linux, with UTF-8 paths.
  • AI assistance recorded with Assisted-by: / Co-Authored-By: trailers.

Ready to merge

  • Everything in Still to test has run, its results in Tested.
  • Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers").
  • Approved in review, every comment answered.
  • CI passes on the head; on current main, measured again or a comment says why the numbers still hold.
## Summary A slow VMA defragmentation pass can leave the texture compaction sweep running. Finish the sweep if beginning or ending a pass takes at least 50 ms, and wait five seconds before starting another one. A slow begin returns the unused temporary allocations. A slow end keeps the completed GPU copies and the freed-byte totals. Keep the image reaper excluded while VMA opens or closes the context because those operations change the pool's sorting mode. ## Testing **Tested:** Windows 11, RTX 3060 Ti, NVIDIA 621.01, 2560×1440. Loaded the Market and Kakariko Village, then completed a scripted 600-frame camera pan in Hyrule Field. The texture pool opened and closed 29 compaction sweeps with the reduced threshold. The game exited normally. The game-free regression reproduced the unclosed sweep on main and passed with this change. The threaded reaper check and independent code review also passed. **Still to test:** - Windows, by hand: run the full game-free suite against main and check for new failures. - Hardware that reproduces the long hitch, by hand: trigger a slow allocator pass and check that the sweep closes and does not restart for five seconds. - Linux, by hand: build the renderer and run the allocator and image reaper checks. ## Measurements **Verdict:** The game-free tests reproduced the slow-pass failure and verified the recovery. Gameplay exercised normal compaction. Neither build hit a slow allocator pass or a frame of 50 ms or more in the timed route. The patch had higher average FPS and higher p99 frame time in both pairs. These runs leave the effect on the reported long hitch unmeasured. Two interleaved runs per build on Windows 11, RTX 3060 Ti (NVIDIA 621.01), with the same copied save and 2560x1440 output. Loaded the Market and Kakariko Village, then recorded the same 600-frame camera sweep in Hyrule Field. Both builds used a lowered compaction threshold, disabled image preallocation, uncapped FPS, and frame generation and VSync off. | Check | Before: main @ 85a59e6f | After: this PR @ bcb7cf16 | | --- | --- | --- | | Hyrule Field FPS, each run (median) | 61.51 / 61.22 (61.36) | 62.60 / 63.22 (62.91) | | Hyrule Field p99 frame time, each run | 23.82 / 26.59 ms | 27.67 / 27.27 ms | | Compaction sweeps started, each run | 16 / 15 | 12 / 15 | | Frames at or above 50 ms | 0 / 0 | 0 / 0 | | Slow allocator begin in the game-free fixture | Sweep stays active | Sweep closes and unused moves are returned | | Slow end in the threaded fixture | An incomplete pass can keep the context open | Completed copies are kept, the context closes and the reaper resumes | ## Risks After a slow sweep, the five-second pause may retain VRAM longer under sustained memory pressure. The first slow allocator call can still hitch. The existing RX_VK_COMPACT=0 switch disables texture compaction. ## Checklist ### Ready for review - [x] One topic, on current `main`; the title is a Conventional Commit. - [x] Tested on my own PC, in the game for a change the game runs, as Testing says. - [ ] `mise run test` passes (any failure that also fails on `main` is named). - [x] Measured against `main`, or Measurements says why there is nothing to measure. - [x] No game files, build output or hand-edited generated files; `third_party/` untouched; nothing GPL-incompatible. ### When it applies - [x] A fix: a game-free test that fails on `main` and passes here. - [x] A check under `tests/` that reads changed source is updated, not weakened. - [ ] Host code builds on Windows (llvm-mingw) and Linux, with UTF-8 paths. - [x] AI assistance recorded with `Assisted-by:` / `Co-Authored-By:` trailers. ### Ready to merge - [ ] Everything in Still to test has run, its results in Tested. - [ ] Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers"). - [ ] Approved in review, every comment answered. - [ ] CI passes on the head; on current `main`, measured again or a comment says why the numbers still hold.
(cherry picked from commit 7206d076d0a5962c5e601b76deabd3838f6ac878)
Assisted-by: Codex
fix(vk): pause VRAM compaction after a slow allocator pass
Some checks are pending
CI / Conventional Commit title (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Blocked by required conditions
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Blocked by required conditions
CI / Workflow lint (actionlint) (pull_request) Blocked by required conditions
CI / Website build and checks (pull_request) Blocked by required conditions
Guide screenshots / Guide images and local UI source review (pull_request) Blocked by required conditions
Third-party parts / As their notes say (pull_request) Blocked by required conditions
Third-party parts / The same as upstream (pull_request) Blocked by required conditions
Website / Website on Cloudflare (pull_request_target) Has been skipped
PR description / Description follows the template (pull_request_target) Successful in 10s
bcb7cf16be
Finish a sweep if beginning or ending its VMA pass takes at least 50 ms. Discard only unbound temporary moves and keep the reaper excluded until VMA has closed the pass. Wait five seconds before retrying.

Assisted-by: Codex
Author
First-time contributor

Tested in game: Windows 11, RTX 3060 Ti (NVIDIA 621.01), 2560x1440. Loaded Market and Kakariko Village, then completed a 600-frame camera pan in Hyrule Field. All 29 compaction sweeps in the run closed, and the game exited normally.

Tested in game: Windows 11, RTX 3060 Ti (NVIDIA 621.01), 2560x1440. Loaded Market and Kakariko Village, then completed a 600-frame camera pan in Hyrule Field. All 29 compaction sweeps in the run closed, and the game exited normally.
Member

Possibly related, for context:

  • PR #2000 test(vk): the image reaper's threads check ends its process at once, as the game does on Linux — Overlaps image-reaper thread test and compaction exclusion checks
Possibly related, for context: - PR #2000 test(vk): the image reaper's threads check ends its process at once, as the game does on Linux — Overlaps image-reaper thread test and compaction exclusion checks
BeanBot left a comment

Recommendation: Request changes. A slow pass now closes, but repeatedly slow begins can discard every useful move while the machine is short of memory. The tests also miss whether the renderer starts the cooldown and whether the reaper stays excluded until the context closes.

The change stops a texture-compaction sweep after a VMA pass call takes 50 ms or more. It returns unused temporary allocations, preserves completed copies and their freed-byte totals, and consolidates sweep completion in one helper. The cost is delayed memory reclamation and a new reaper mutex acquisition on idle presents.

@fix will do (8)

  1. L1 (its part an edit can do) gpu/vk/vk_vma.cpp:254: Allow useful moves from a slow begin to finish when memory pressure is critical, then close the sweep and back off after committing the copies.
  2. L2 gpu/vk/vk_texture.cpp:4815: The moved queue check takes reap_mu on every idle present with compaction enabled, even when the next check is hundreds of presents away. (more on the line)
  3. L3 tests/test_vram_compact_stall.py:148: The cooldown case calls compact_finish directly and runs a slice of compact_step. (more on the line)
  4. L4 tests/test_image_reaper_threads.py:362: The slow-end case can pass if compact_over moves outside reap_mu while notify_one remains after it. (more on the line)
  5. L5 (its part an edit can do) gpu/vk/vk_vma.cpp:252: Log which VMA call triggered the cutoff, its elapsed milliseconds, and the bytes reclaimed so a stall can be matched to frame and memory samples.
  6. L6 (minor): The PR omits the base reproduction steps, the Measurements setup, and the actual reduced threshold used for the 29-sweep run. The remaining checks also lack per-item hardware, expected results and owners, so the Linux and memory-pressure runs cannot be reproduced from the write-up. Add the exact settings and available fixture output, list who runs each remaining check, and record why the open checklist entries remain open.
  7. L7 (minor) docs/dev/reference/architecture.md:207: The arbiter docs say texture-block compaction runs at the next present. A pressure increase during the cooldown can advance the frame check but still leaves reclamation deferred. Describe the cooldown and its interaction with the pressure wake-up once the policy is settled.
  8. L8 (minor) tests/test_vram_compact.py:15: This updated check still pins g++ in the suite, so it ignores CXX=clang++ and can skip on a Windows setup with only llvm-mingw. Use the suite's {cxx} placeholder as the new stall and threaded fixtures do.

For the author (2) (a run, a measurement or a decision)

  • L1 gpu/vk/vk_vma.cpp:254: A fragmented pool whose first begin stays above 50 ms can lose all compaction progress. (more on the line)
  • L5 (minor) gpu/vk/vk_vma.cpp:252: The smoke run shows that ordinary sweeps close. (more on the line)

Checks: Still running: CI / Conventional Commit title (pull_request), CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request), CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request), CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request), CI / Workflow lint (actionlint) (pull_request), CI / Website build and checks (pull_request), Guide screenshots / Guide images and local UI source review (pull_request), Third-party parts / As their notes say (pull_request), Third-party parts / The same as upstream (pull_request), PR description / Description follows the template (pull_request_target).

More: does it help, other systems, switches, what was read

Does it help: Yes for sweep cleanup in the reported game-free comparison of 85a59e6f83 and bcb7cf16be. The author reports 29 completed sweeps in a Windows 11 RTX 3060 Ti smoke run with a reduced threshold. The effect on gameplay hitches and memory pressure is unproven. No timed gameplay comparison or hardware reproduction of the slow pass was supplied.

Other systems: The policy applies to NVIDIA, AMD and Intel on Windows and Linux, including Steam Deck, where texture blocks occupy shared RAM. Reaper synchronization also affects dead render targets and their associated resources. The copy path still waits for GPU completion before destroying old images. The diff leaves the public renderer ABI, shaders, saves, audio and input untouched. Only the Windows NVIDIA smoke run is reported.

Switches: None added, removed or given a new default. RX_VK_COMPACT and RX_VK_REAPER remain on by default, so the 50 ms threshold and five-second cooldown apply in the default configuration. RX_VK_COMPACT_MB retains its allowance-based default. The reduced smoke-test setting was unspecified, and the new cooldown is unvalidated under pressure.

Reviewed: bcb7cf16be against 85a59e6f83: Read all four changed Python tests in full and all changed C++ sections with their surrounding code. Traced the present caller, GPU completion, allocator accounting, reaper writes and readers, and pressure handling. Read AGENTS.md, CONTRIBUTING.md, the PR template and developer standards, plus the relevant architecture and test-writing rules. No separate review checklist or adjacent Tooling checkout was present. Skimmed the screenshot manifest, workflow and other source-reading tests. The rest of the large renderer files and the external VMA implementation were outside the read. No run logs, tester comments or prior reviews were supplied.; nothing run (a code review).

Checked and fine:

  • A slow begin marks temporary moves IGNORE before ending the pass. A slow end preserves completed moves and includes earlier passes in the totals.
  • The current code keeps the reaper excluded across VMA context open and close. The renderer owns the context, and GPU completion still gates retirement of the old images.
  • Both commits carry Assisted-by trailers. The diff contains no game-derived artifacts, generated output, third-party edits or public ABI changes.
  • The guide manifest tracks vk_internal.h, but its recorded hashes already differ from the base. The changed declarations do not affect the illustrated controls.
  • The new fixtures compile local test code in temporary directories and stub the runtime switches. They add no downloads, installs or external service calls.

Testing: Read-only review. Git diff --check passed. No builds, tests or project scripts were run. The author reports the game-free regression and threaded fixture passed on head, plus the Windows gameplay smoke run. CI was still running, and the full Windows suite and Linux gameplay were outstanding.

Overlaps and merge order: None found in the supplied PR context or local history.


Automated code review by BeanBot (gpt-6.2-sol), on the pull request's opening. Nothing was run; a maintainer decides.

**Recommendation: Request changes.** A slow pass now closes, but repeatedly slow begins can discard every useful move while the machine is short of memory. The tests also miss whether the renderer starts the cooldown and whether the reaper stays excluded until the context closes. The change stops a texture-compaction sweep after a VMA pass call takes 50 ms or more. It returns unused temporary allocations, preserves completed copies and their freed-byte totals, and consolidates sweep completion in one helper. The cost is delayed memory reclamation and a new reaper mutex acquisition on idle presents. **`@fix` will do (8)** 1. **L1** (its part an edit can do) `gpu/vk/vk_vma.cpp:254`: Allow useful moves from a slow begin to finish when memory pressure is critical, then close the sweep and back off after committing the copies. 2. **L2** `gpu/vk/vk_texture.cpp:4815`: The moved queue check takes reap_mu on every idle present with compaction enabled, even when the next check is hundreds of presents away. (more on the line) 3. **L3** `tests/test_vram_compact_stall.py:148`: The cooldown case calls compact_finish directly and runs a slice of compact_step. (more on the line) 4. **L4** `tests/test_image_reaper_threads.py:362`: The slow-end case can pass if compact_over moves outside reap_mu while notify_one remains after it. (more on the line) 5. **L5** (its part an edit can do) `gpu/vk/vk_vma.cpp:252`: Log which VMA call triggered the cutoff, its elapsed milliseconds, and the bytes reclaimed so a stall can be matched to frame and memory samples. 6. **L6** (minor): The PR omits the base reproduction steps, the Measurements setup, and the actual reduced threshold used for the 29-sweep run. The remaining checks also lack per-item hardware, expected results and owners, so the Linux and memory-pressure runs cannot be reproduced from the write-up. Add the exact settings and available fixture output, list who runs each remaining check, and record why the open checklist entries remain open. 7. **L7** (minor) `docs/dev/reference/architecture.md:207`: The arbiter docs say texture-block compaction runs at the next present. A pressure increase during the cooldown can advance the frame check but still leaves reclamation deferred. Describe the cooldown and its interaction with the pressure wake-up once the policy is settled. 8. **L8** (minor) `tests/test_vram_compact.py:15`: This updated check still pins g++ in the suite, so it ignores CXX=clang++ and can skip on a Windows setup with only llvm-mingw. Use the suite's {cxx} placeholder as the new stall and threaded fixtures do. **For the author (2)** (a run, a measurement or a decision) - **L1** `gpu/vk/vk_vma.cpp:254`: A fragmented pool whose first begin stays above 50 ms can lose all compaction progress. (more on the line) - **L5** (minor) `gpu/vk/vk_vma.cpp:252`: The smoke run shows that ordinary sweeps close. (more on the line) **Checks:** Still running: `CI / Conventional Commit title (pull_request)`, `CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request)`, `CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request)`, `CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request)`, `CI / Workflow lint (actionlint) (pull_request)`, `CI / Website build and checks (pull_request)`, `Guide screenshots / Guide images and local UI source review (pull_request)`, `Third-party parts / As their notes say (pull_request)`, `Third-party parts / The same as upstream (pull_request)`, `PR description / Description follows the template (pull_request_target)`. <details> <summary>More: does it help, other systems, switches, what was read</summary> **Does it help:** Yes for sweep cleanup in the reported game-free comparison of 85a59e6f83b2 and bcb7cf16be3f. The author reports 29 completed sweeps in a Windows 11 RTX 3060 Ti smoke run with a reduced threshold. The effect on gameplay hitches and memory pressure is unproven. No timed gameplay comparison or hardware reproduction of the slow pass was supplied. **Other systems:** The policy applies to NVIDIA, AMD and Intel on Windows and Linux, including Steam Deck, where texture blocks occupy shared RAM. Reaper synchronization also affects dead render targets and their associated resources. The copy path still waits for GPU completion before destroying old images. The diff leaves the public renderer ABI, shaders, saves, audio and input untouched. Only the Windows NVIDIA smoke run is reported. **Switches:** None added, removed or given a new default. RX_VK_COMPACT and RX_VK_REAPER remain on by default, so the 50 ms threshold and five-second cooldown apply in the default configuration. RX_VK_COMPACT_MB retains its allowance-based default. The reduced smoke-test setting was unspecified, and the new cooldown is unvalidated under pressure. **Reviewed:** bcb7cf16be3f against 85a59e6f83b2: Read all four changed Python tests in full and all changed C++ sections with their surrounding code. Traced the present caller, GPU completion, allocator accounting, reaper writes and readers, and pressure handling. Read AGENTS.md, CONTRIBUTING.md, the PR template and developer standards, plus the relevant architecture and test-writing rules. No separate review checklist or adjacent Tooling checkout was present. Skimmed the screenshot manifest, workflow and other source-reading tests. The rest of the large renderer files and the external VMA implementation were outside the read. No run logs, tester comments or prior reviews were supplied.; nothing run (a code review). **Checked and fine:** - A slow begin marks temporary moves IGNORE before ending the pass. A slow end preserves completed moves and includes earlier passes in the totals. - The current code keeps the reaper excluded across VMA context open and close. The renderer owns the context, and GPU completion still gates retirement of the old images. - Both commits carry Assisted-by trailers. The diff contains no game-derived artifacts, generated output, third-party edits or public ABI changes. - The guide manifest tracks vk_internal.h, but its recorded hashes already differ from the base. The changed declarations do not affect the illustrated controls. - The new fixtures compile local test code in temporary directories and stub the runtime switches. They add no downloads, installs or external service calls. **Testing:** Read-only review. Git diff --check passed. No builds, tests or project scripts were run. The author reports the game-free regression and threaded fixture passed on head, plus the Windows gameplay smoke run. CI was still running, and the full Windows suite and Linux gameplay were outstanding. **Overlaps and merge order:** None found in the supplied PR context or local history. </details> --- <sub>Automated code review by BeanBot (gpt-6.2-sol), on the pull request's opening. Nothing was run; a maintainer decides.</sub>
@ -4803,1 +4812,4 @@
}
// (RX_VK_REAPER: the dead images handed to the reaper are freed before a pass opens, as they were here before: a pass VMA
// plans with them still in the blocks moves around them and empties fewer. A present or so later; never a wait here)
if (images_to_reap()) return;
Member

L2: The moved queue check takes reap_mu on every idle present with compaction enabled, even when the next check is hundreds of presents away. On Linux the reaper can hold that mutex while writing its periodic log line to stderr, so an idle compaction check can stall replay behind logging. Return first when no sweep is active and the frame or cooldown deadline is still pending, then check the queue before opening VMA.

**L2**: The moved queue check takes reap_mu on every idle present with compaction enabled, even when the next check is hundreds of presents away. On Linux the reaper can hold that mutex while writing its periodic log line to stderr, so an idle compaction check can stall replay behind logging. Return first when no sweep is active and the frame or cooldown deadline is still pending, then check the queue before opening VMA.
@ -239,3 +249,4 @@
reap_done_cv.wait(rk, [] { return !reaping; }); // (the frees in flight, done first)
pass_waiting = false;
const auto start = compact_now();
const VkResult r = vmaBeginDefragmentationPass(vma, compact_ctx, &compact_pass);
Member

L5 (minor): The smoke run shows that ordinary sweeps close. It leaves open whether players see fewer hitches at the shipped settings. On a setup that reproduces the slow pass, compare the named base and revised head in at least two interleaved runs each with the same save, route, settings and build. Report pass durations, stalls, average FPS, 1% lows, median and p99 frame times, and peak RAM and VRAM. Cover the affected Tier 1 configurations, including AMD and Steam Deck.

**L5** (minor): The smoke run shows that ordinary sweeps close. It leaves open whether players see fewer hitches at the shipped settings. On a setup that reproduces the slow pass, compare the named base and revised head in at least two interleaved runs each with the same save, route, settings and build. Report pass durations, stalls, average FPS, 1% lows, median and p99 frame times, and peak RAM and VRAM. Cover the affected Tier 1 configurations, including AMD and Steam Deck.
@ -242,2 +253,2 @@
if (r != VK_INCOMPLETE) { // (VK_SUCCESS: nothing left to move; or an error. The reaper, held for it, goes on)
compact_over(freed_bytes, freed_blocks);
const bool stalled = compact_now() - start >= kCompactStall;
if (stalled || r != VK_INCOMPLETE) {
Member

L1: A fragmented pool whose first begin stays above 50 ms can lose all compaction progress. Even if VMA proposes moves that would empty a block, every retry discards them and starts from scratch. The cooldown also overrides the pressure wake-up. Give critical VRAM or shared-RAM pressure a bounded way to finish useful moves before backing off, and compare reclaimed bytes and frame times with base under sustained pressure.

**L1**: A fragmented pool whose first begin stays above 50 ms can lose all compaction progress. Even if VMA proposes moves that would empty a block, every retry discards them and starts from scratch. The cooldown also overrides the pressure wake-up. Give critical VRAM or shared-RAM pressure a bounded way to finish useful moves before backing off, and compare reclaimed bytes and frame times with base under sustained pressure.
@ -316,0 +359,4 @@
hand_over(m);
passes_left = 1;
slow_end_us = 51'000;
const auto result = image_compact_pass_end(nullptr, nullptr);
Member

L4: The slow-end case can pass if compact_over moves outside reap_mu while notify_one remains after it. A reaper already asleep after the hand-over has no wake-up during the five-millisecond spin and therefore records no overlap. Gate the context-close stub and explicitly make a competing free attempt while it is open. Verify the test fails when context close moves outside the lock.

**L4**: The slow-end case can pass if compact_over moves outside reap_mu while notify_one remains after it. A reaper already asleep after the hand-over has no wake-up during the five-millisecond spin and therefore records no overlap. Gate the context-close stub and explicitly make a competing free attempt while it is open. Verify the test fails when context close moves outside the lock.
@ -0,0 +145,4 @@
void check_cooldown() {
using namespace std::chrono_literals;
compact.pressed = true;
compact_finish(ImageCompactResult::stalled, 240, 3);
Member

L3: The cooldown case calls compact_finish directly and runs a slice of compact_step. Removing the renderer's compact_finish call after a stalled begin would leave both this fixture and the source checks green while the game skipped the cooldown. Drive the production scheduling path with a fake clock and allocator, and assert that neither a stalled begin nor a stalled end can reopen a sweep before the deadline.

**L3**: The cooldown case calls compact_finish directly and runs a slice of compact_step. Removing the renderer's compact_finish call after a stalled begin would leave both this fixture and the source checks green while the game skipped the cooldown. Drive the production scheduling path with a fake clock and allocator, and assert that neither a stalled begin nor a stalled end can reopen a sweep before the deadline.
Author
First-time contributor

Added the paired Hyrule Field timings. Both builds exercised compaction and neither reproduced a slow pass. The game-free regressions cover the recovery path.

Added the paired Hyrule Field timings. Both builds exercised compaction and neither reproduced a slow pass. The game-free regressions cover the recovery path.
Some checks are pending
CI / Conventional Commit title (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Blocked by required conditions
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Blocked by required conditions
CI / Workflow lint (actionlint) (pull_request) Blocked by required conditions
CI / Website build and checks (pull_request) Blocked by required conditions
Guide screenshots / Guide images and local UI source review (pull_request) Blocked by required conditions
Third-party parts / As their notes say (pull_request) Blocked by required conditions
Third-party parts / The same as upstream (pull_request) Blocked by required conditions
Website / Website on Cloudflare (pull_request_target) Has been skipped
PR description / Description follows the template (pull_request_target) Successful in 10s
This pull request is marked as a work in progress.
Some workflows are waiting to be reviewed.
This branch is out-of-date with the base branch
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u 'codex/vram-compaction-stall:khuongngo0310-codex/vram-compaction-stall'
git switch 'khuongngo0310-codex/vram-compaction-stall'
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
MagicBeanDev/Longshot!2032
No description provided.