fix(vk): sparse mirror blocks stay bound on AMD's Windows driver on GCN #3256

Merged
HumanBean merged 2 commits from tobim6/Longshot:sparse-keep into main 2026-12-05 17:24:15 +00:00
Contributor

Summary

On Windows with AMD's driver on a GCN 1-4 card (RX 580 8 GB, driver 0x800106, Adrenalin 23.10.01.14), the game
stops the whole PC with a bugcheck after some minutes of play: first PAGE_FAULT_IN_NONPAGED_AREA in dxgmms2.sys,
then SYSTEM_THREAD_EXCEPTION_NOT_HANDLED (0x7E, C0000005) in amdkmdag.sys. The kernel dump's stack is in
amdkmdag.sys's DdiBuildPagingBuffer, called by dxgmms2.sys building the update for
VIDMM_PAGE_TABLE::Convert64K_4K while it paged an allocation in. The game's log before it shows ~8,800 sparse mirror
block give-backs in the two minutes before the crash: sparse_release unbinds every block all game pools have left,
and a block wanted again gets a new allocation and a bind. Every one is a page-table update; on this driver one of them
crashes the kernel. RX_VK_MIRROR_SPARSE=0 also avoids it (reported on Discord), at a frame-rate cost.

This adds sparse_keep to device_policy.h: on AMD's Windows driver on GCN (f.amd_win() && f.arch() == GpuArch::AmdGcn, the same devices as a2c_in_pipeline) sparse_release gives nothing back, so a block stays bound
until its mirror goes. Sparse mirrors stay on; only the churn goes. A hidden setting,
system/memory-settings:sparse_keep (RX_VK_SPARSE_KEEP, Auto/Off/On), overrides it on any PC.

Read first: gpu/vk/device_policy.h (the field, its rule, Sw::sparse_keep, the log line),
gpu/vk/vk_memory.cpp (sparse_release's first line). The setting is game/mods/memory-settings/mod.toml;
game/settings_abi.h and settings_abi.rs are schema-gen's.

Testing

Tested: Windows 11 (build 26200), RX 580 8 GB, Adrenalin 23.10.01.14 (driver 0x800106), Xeon E5-2699 v3: played with sparse mirror blocks kept (the same sparse_release return, turned on by RX_VK_SPARSE_KEEP=1 in a build of this branch's first version); the SYSTEM_THREAD_EXCEPTION_NOT_HANDLED BSODs in amdkmdag.sys that the game caused before did not come back.

Before this, the same PC bugchecked in amdkmdag.sys (kernel dump analysed: the stack above); with sparse blocks kept it has not. This PR's policy turns on
the same return by itself on that driver, so it runs the tested path without the switch.

Checks (game-free): schema-gen --check; tests/test_device_policy.py (the new field on all 26 PCs, its switch cases,
and rule edges: on for GCN 0x67DF/0x6FDF on AMD's Windows driver; off for Vega 0x687F, RDNA, Linux, RADV),
test_switch_table.py, test_menu_ini_keys.py, test_i18n_complete.py pass. The whole tree built on Windows by the
builder for the in-game test above. The full suite: CI's tests job on this PR.

Still to test:

  • Windows, AMD RDNA: nothing changes (the log's sparse_keep off), expecting the same as main (@Beanstalk)
  • Windows, AMD GCN with another driver version: a long session, expecting no bugcheck and sparse_keep on in the log (by hand)

Measurements

Nothing to measure for speed: the change only skips unbinds on the one driver; the cost is VRAM, at most the blocks the game has left in still-living mirrors (about 0.5 GB late in a session on the RX 580 8 GB).

Risks

  • Only AMD's Windows driver on GCN 1-4 changes; elsewhere the policy is off and sparse_release runs as on main.
  • On those cards a long session holds more VRAM: blocks the game left keep their memory until their mirror goes.
    If that pushes a 4 GB card over, the setting's Off (RX_VK_SPARSE_KEEP=0) restores main's behaviour.
  • Settings: a new hidden key, sparse_keep, in settings.toml's options; LS_SETTINGS_LAYOUT changes (schema-gen).
    Revert is enough to undo.

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). (CI's tests job: ticked once it passes)
  • 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. (test_device_policy.py's sparse_keep rule edges pass here; the run on main is pending)
  • A switch added or changed: it ships at the default the measurements chose, with its row in gpu/vk/switches.def. (a SETTING row; Auto)
  • A check under tests/ that reads changed source is updated, not weakened. (test_device_policy.py, test_menu_ini_keys.py)
  • Host code builds on Windows (llvm-mingw) and Linux, with UTF-8 paths. (Windows: built for the test above; CI builds Linux)
  • Docs updated.
  • 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.

🤖 Generated with Claude Code

## Summary On Windows with AMD's driver on a GCN 1-4 card (RX 580 8 GB, driver 0x800106, Adrenalin 23.10.01.14), the game stops the whole PC with a bugcheck after some minutes of play: first `PAGE_FAULT_IN_NONPAGED_AREA` in `dxgmms2.sys`, then `SYSTEM_THREAD_EXCEPTION_NOT_HANDLED` (0x7E, `C0000005`) in `amdkmdag.sys`. The kernel dump's stack is in `amdkmdag.sys`'s `DdiBuildPagingBuffer`, called by `dxgmms2.sys` building the update for `VIDMM_PAGE_TABLE::Convert64K_4K` while it paged an allocation in. The game's log before it shows ~8,800 sparse mirror block give-backs in the two minutes before the crash: `sparse_release` unbinds every block all game pools have left, and a block wanted again gets a new allocation and a bind. Every one is a page-table update; on this driver one of them crashes the kernel. `RX_VK_MIRROR_SPARSE=0` also avoids it (reported on Discord), at a frame-rate cost. This adds `sparse_keep` to `device_policy.h`: on AMD's Windows driver on GCN (`f.amd_win() && f.arch() == GpuArch::AmdGcn`, the same devices as `a2c_in_pipeline`) `sparse_release` gives nothing back, so a block stays bound until its mirror goes. Sparse mirrors stay on; only the churn goes. A hidden setting, `system/memory-settings:sparse_keep` (`RX_VK_SPARSE_KEEP`, Auto/Off/On), overrides it on any PC. Read first: `gpu/vk/device_policy.h` (the field, its rule, `Sw::sparse_keep`, the log line), `gpu/vk/vk_memory.cpp` (`sparse_release`'s first line). The setting is `game/mods/memory-settings/mod.toml`; `game/settings_abi.h` and `settings_abi.rs` are schema-gen's. ## Testing **Tested:** Windows 11 (build 26200), RX 580 8 GB, Adrenalin 23.10.01.14 (driver 0x800106), Xeon E5-2699 v3: played with sparse mirror blocks kept (the same sparse_release return, turned on by RX_VK_SPARSE_KEEP=1 in a build of this branch's first version); the SYSTEM_THREAD_EXCEPTION_NOT_HANDLED BSODs in amdkmdag.sys that the game caused before did not come back. Before this, the same PC bugchecked in `amdkmdag.sys` (kernel dump analysed: the stack above); with sparse blocks kept it has not. This PR's policy turns on the same `return` by itself on that driver, so it runs the tested path without the switch. Checks (game-free): `schema-gen --check`; `tests/test_device_policy.py` (the new field on all 26 PCs, its switch cases, and rule edges: on for GCN 0x67DF/0x6FDF on AMD's Windows driver; off for Vega 0x687F, RDNA, Linux, RADV), `test_switch_table.py`, `test_menu_ini_keys.py`, `test_i18n_complete.py` pass. The whole tree built on Windows by the builder for the in-game test above. The full suite: CI's `tests` job on this PR. **Still to test:** - Windows, AMD RDNA: nothing changes (the log's `sparse_keep` off), expecting the same as `main` (@Beanstalk) - Windows, AMD GCN with another driver version: a long session, expecting no bugcheck and `sparse_keep` on in the log (by hand) ## Measurements Nothing to measure for speed: the change only skips unbinds on the one driver; the cost is VRAM, at most the blocks the game has left in still-living mirrors (about 0.5 GB late in a session on the RX 580 8 GB). ## Risks - Only AMD's Windows driver on GCN 1-4 changes; elsewhere the policy is off and `sparse_release` runs as on `main`. - On those cards a long session holds more VRAM: blocks the game left keep their memory until their mirror goes. If that pushes a 4 GB card over, the setting's Off (`RX_VK_SPARSE_KEEP=0`) restores `main`'s behaviour. - Settings: a new hidden key, `sparse_keep`, in `settings.toml`'s options; `LS_SETTINGS_LAYOUT` changes (schema-gen). Revert is enough to undo. ## 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). (CI's `tests` job: ticked once it passes) - [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 - [ ] A fix: a game-free test that fails on `main` and passes here. (`test_device_policy.py`'s `sparse_keep` rule edges pass here; the run on `main` is pending) - [x] A switch added or changed: it ships at the default the measurements chose, with its row in `gpu/vk/switches.def`. (a `SETTING` row; Auto) - [x] A check under `tests/` that reads changed source is updated, not weakened. (`test_device_policy.py`, `test_menu_ini_keys.py`) - [ ] Host code builds on Windows (llvm-mingw) and Linux, with UTF-8 paths. (Windows: built for the test above; CI builds Linux) - [x] Docs updated. - [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. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
fix(vk): sparse mirror blocks stay bound on AMD's Windows driver on GCN
Some checks failed
PR description / Title and description (pull_request_target) Has been cancelled
CI / What the change needs (pull_request) Has been cancelled
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Has been cancelled
CI / Third-party parts and guide screenshots (pull_request) Has been cancelled
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Has been cancelled
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Has been cancelled
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
a25bbd5c90
AMD's Windows driver on GCN 1-4 (RX 580, driver 0x800106) stopped the system
in amdkmdag.sys while building a page-table update for VIDMM_PAGE_TABLE::
Convert64K_4K during a page-in. The log before it showed ~8,800 sparse block
give-backs in two minutes: each one an unbind, then a new allocation and bind
when the block was wanted again.

device_policy.h sparse_keep: on that driver sparse_release gives nothing back,
so a block stays bound until its mirror goes. The cost is the VRAM of blocks
the game left. Hidden setting system/memory-settings:sparse_keep
(RX_VK_SPARSE_KEEP) overrides it (Auto/Off/On).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
Contributor

Tested in game: Windows 11 (build 26200), RX 580 8 GB, Adrenalin 23.10.01.14 (driver 0x800106), Xeon E5-2699 v3: played with sparse mirror blocks kept (the same sparse_release return, turned on by RX_VK_SPARSE_KEEP=1 in a build of this branch's first version); the SYSTEM_THREAD_EXCEPTION_NOT_HANDLED BSODs in amdkmdag.sys that the game caused before did not come back.

Tested in game: Windows 11 (build 26200), RX 580 8 GB, Adrenalin 23.10.01.14 (driver 0x800106), Xeon E5-2699 v3: played with sparse mirror blocks kept (the same sparse_release return, turned on by RX_VK_SPARSE_KEEP=1 in a build of this branch's first version); the SYSTEM_THREAD_EXCEPTION_NOT_HANDLED BSODs in amdkmdag.sys that the game caused before did not come back.
tobim6 changed title from WIP: fix(vk): sparse mirror blocks stay bound on AMD's Windows driver on GCN to fix(vk): sparse mirror blocks stay bound on AMD's Windows driver on GCN 2026-12-05 16:08:08 +00:00
Member
@review
BeanBot left a comment

Recommendation: Approve. The reported RX 580 run supports the workaround, but the game-free test would still pass if the line that prevents sparse releases were removed. The memory and performance cost on smaller GCN cards also needs measurement before the default is settled. Nothing blocking is left: what remains is for the author before merging (below). Recommend approval; not approved on the forge.

Keeps sparse mirror blocks bound by default on AMD Windows GCN drivers to reduce page-table churn associated with a reported system crash. This retains otherwise unused VRAM and can leave less mirror budget for new blocks.

Should fix (1): not blocking, but worth doing before merging.

  • L1 tests/test_device_policy.py:590: The new tests check the policy value but do not check that sparse_release obeys it. (more on the line) Do: Add a game-free behavioral test of sparse release with keep both on and off, including an idle block, so removing the early return fails the test.

Testing before merging (1) (runs on the systems it can change; it doesn't hold the recommendation)

  • L2 gpu/vk/vk_memory.cpp:7131: The cost of retaining unused blocks under the mirror budget is not measured on the smaller cards covered by the default. (more on the line) Do: Compare base and this head over repeated matched long sessions on a 4 GB Windows GCN card, recording retained VRAM, mirror-budget exhaustion, average and 1% low FPS, and frame times.

@fix can do L1.

Questions (1) (not confirmed from the code; they don't hold the recommendation)

  • How long was the RX 580 session with blocks kept, and was the crash reproduced on the stated base under the same route and settings?

Checks: Still running: 11 checks.

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

Does it help: Unproven overall. The author reports that the prior amdkmdag.sys bugcheck did not recur on an RX 580 8 GB with the same early return enabled, but gives no session duration or repeated comparison. The reported approximately 0.5 GB retained late in a session is not a controlled comparison against the base.

Other systems: Auto leaves the policy off on Linux, RADV, NVIDIA, Intel and AMD Windows RDNA; the override can enable it there. Retained blocks count against the shared mirror budget, so later wanted blocks can remain in guest memory and other mirrors can face more pressure. The cost on 4 GB GCN cards and in longer sessions is not established.

Switches: RX_VK_SPARSE_KEEP adds a hidden Auto/Off/On setting, default Auto: on for AMD proprietary Windows GCN and off elsewhere. It has a switches.def row and documentation. The default's memory and performance tradeoff on smaller affected cards remains unmeasured.

Reviewed: a25bbd5c90 against 7bc53f8413: Read the repository rules, PR template, diff and commit message; read the changed sparse release and growth paths, policy changes, setting declaration and relevant test sections. Skimmed generated ABI changes, switch documentation and the remaining portions of the large changed files. docs/review-checklist.md and the sibling Tooling checkout were absent.; nothing run (a code review).

Checked and fine:

  • The commit records AI assistance.
  • The policy's Auto rule and choice override match the declared setting and switch table.
  • No game-derived files or third-party changes appear in the diff; the renderer API structures did not change.

Testing: No code or tests were run, as requested. The author reports a Windows game run and game-free checks; CI was still running.

Overlaps and merge order: Unknown; network access was unavailable.


Automated code review by BeanBot (gpt-6.1-terra), asked for by llun. Nothing was run; a maintainer decides.

**Recommendation: Approve.** The reported RX 580 run supports the workaround, but the game-free test would still pass if the line that prevents sparse releases were removed. The memory and performance cost on smaller GCN cards also needs measurement before the default is settled. Nothing blocking is left: what remains is for the author before merging (below). Recommend approval; not approved on the forge. Keeps sparse mirror blocks bound by default on AMD Windows GCN drivers to reduce page-table churn associated with a reported system crash. This retains otherwise unused VRAM and can leave less mirror budget for new blocks. **Should fix (1)**: not blocking, but worth doing before merging. - **L1** `tests/test_device_policy.py:590`: The new tests check the policy value but do not check that sparse_release obeys it. (more on the line) **Do:** Add a game-free behavioral test of sparse release with keep both on and off, including an idle block, so removing the early return fails the test. **Testing before merging (1)** (runs on the systems it can change; it doesn't hold the recommendation) - **L2** `gpu/vk/vk_memory.cpp:7131`: The cost of retaining unused blocks under the mirror budget is not measured on the smaller cards covered by the default. (more on the line) **Do:** Compare base and this head over repeated matched long sessions on a 4 GB Windows GCN card, recording retained VRAM, mirror-budget exhaustion, average and 1% low FPS, and frame times. `@fix` can do L1. **Questions (1)** (not confirmed from the code; they don't hold the recommendation) - How long was the RX 580 session with blocks kept, and was the crash reproduced on the stated base under the same route and settings? **Checks:** Still running: 11 checks. <details> <summary>More: does it help, other systems, switches, what was read</summary> **Does it help:** Unproven overall. The author reports that the prior amdkmdag.sys bugcheck did not recur on an RX 580 8 GB with the same early return enabled, but gives no session duration or repeated comparison. The reported approximately 0.5 GB retained late in a session is not a controlled comparison against the base. **Other systems:** Auto leaves the policy off on Linux, RADV, NVIDIA, Intel and AMD Windows RDNA; the override can enable it there. Retained blocks count against the shared mirror budget, so later wanted blocks can remain in guest memory and other mirrors can face more pressure. The cost on 4 GB GCN cards and in longer sessions is not established. **Switches:** RX_VK_SPARSE_KEEP adds a hidden Auto/Off/On setting, default Auto: on for AMD proprietary Windows GCN and off elsewhere. It has a switches.def row and documentation. The default's memory and performance tradeoff on smaller affected cards remains unmeasured. **Reviewed:** a25bbd5c904a against 7bc53f841323: Read the repository rules, PR template, diff and commit message; read the changed sparse release and growth paths, policy changes, setting declaration and relevant test sections. Skimmed generated ABI changes, switch documentation and the remaining portions of the large changed files. docs/review-checklist.md and the sibling Tooling checkout were absent.; nothing run (a code review). **Checked and fine:** - The commit records AI assistance. - The policy's Auto rule and choice override match the declared setting and switch table. - No game-derived files or third-party changes appear in the diff; the renderer API structures did not change. **Testing:** No code or tests were run, as requested. The author reports a Windows game run and game-free checks; CI was still running. **Overlaps and merge order:** Unknown; network access was unavailable. </details> --- <sub>Automated code review by BeanBot (gpt-6.1-terra), asked for by llun. Nothing was run; a maintainer decides.</sub>
@ -7128,1 +7128,4 @@
void sparse_release() {
// (device_policy.h sparse_keep: blocks once given memory stay bound until their mirror goes, on the driver that crashed
// in the page-table updates a give-back and a regrow make. The cost: the blocks the game left keep their VRAM)
if (dev.policy.sparse_keep) return;
Member

L2 (should fix): The cost of retaining unused blocks under the mirror budget is not measured on the smaller cards covered by the default.

When: On a 4 GB Windows GCN card, a long session can retain dead blocks in live mirrors; sparse_grow_all counts them against mirror_budget and leaves newly wanted blocks in guest memory when it runs out of room.

Do: Compare base and this head over repeated matched long sessions on a 4 GB Windows GCN card, recording retained VRAM, mirror-budget exhaustion, average and 1% low FPS, and frame times.

**L2** (should fix): The cost of retaining unused blocks under the mirror budget is not measured on the smaller cards covered by the default. *When:* On a 4 GB Windows GCN card, a long session can retain dead blocks in live mirrors; sparse_grow_all counts them against mirror_budget and leaves newly wanted blocks in guest memory when it runs out of room. **Do:** Compare base and this head over repeated matched long sessions on a 4 GB Windows GCN card, recording retained VRAM, mirror-budget exhaustion, average and 1% low FPS, and frame times.
@ -584,6 +587,12 @@ RULES = [
("(long long)[] { DeviceFacts f{}; f.vendor_id = 0x1002; f.device_id = 0x73DF; f.driver_id = VK_DRIVER_ID_AMD_PROPRIETARY; f.windows = true; const DevicePolicy p = device_policy(f); return p.a2c_in_pipeline || p.bc_array_no_cube; }()", 0),
("(long long)[] { DeviceFacts f{}; f.vendor_id = 0x1002; f.device_id = 0x67DF; f.driver_id = VK_DRIVER_ID_AMD_PROPRIETARY; f.windows = false; const DevicePolicy p = device_policy(f); return p.a2c_in_pipeline || p.bc_array_no_cube; }()", 0),
("(long long)[] { DeviceFacts f{}; f.vendor_id = 0x1002; f.device_id = 0x67DF; f.driver_id = VK_DRIVER_ID_MESA_RADV; f.windows = false; const DevicePolicy p = device_policy(f); return p.a2c_in_pipeline || p.bc_array_no_cube; }()", 0),
# (sparse_keep: the same devices, Vega (GFX9) not among them; the driver that crashed in the page-table updates its give-backs made)
Member

L1 (should fix): The new tests check the policy value but do not check that sparse_release obeys it.

When: Deleting the early return in vk_memory.cpp leaves these policy and override cases passing, while GCN players again release blocks and encounter the page-table churn the fix is meant to prevent.

Do: Add a game-free behavioral test of sparse release with keep both on and off, including an idle block, so removing the early return fails the test.

**L1** (should fix): The new tests check the policy value but do not check that sparse_release obeys it. *When:* Deleting the early return in vk_memory.cpp leaves these policy and override cases passing, while GCN players again release blocks and encounter the page-table churn the fix is meant to prevent. **Do:** Add a game-free behavioral test of sparse release with keep both on and off, including an idle block, so removing the early return fails the test.
Author
Contributor
@fix
Member
@fix
test(vk): cover sparse release keep policy
Some checks failed
PR description / Title and description (pull_request_target) Has been cancelled
CI / What the change needs (pull_request) Has been cancelled
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Has been cancelled
CI / Third-party parts and guide screenshots (pull_request) Has been cancelled
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Has been cancelled
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Has been cancelled
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
9a9e0edfde
As the review on #3256 asked.
BeanBot left a comment

Recommendation: Approve. The code is ready: only testing is left. The reported RX 580 session supports the crash workaround, but its retained VRAM cost on smaller cards covered by the default remains unmeasured. Recommend approval; not approved on the forge.

What @fix changed
I changed this pull request: the new head is 9a9e0edfde. I edited its description to match the change.

Changed

  • Sparse release behavior: Added a game-free fixture in tests/test_sparse_mirror.py:20 that executes the production sparse_release function with keep on and off, checking an idle block, a live block, and release side effects. Tests were not run, as requested.

Nothing was built or run: the checks run again on the new head.

The change keeps sparse mirror blocks bound on AMD Windows GCN devices to reduce the page-table churn associated with a driver crash. It trades that reduction for higher VRAM use; the added fixture checks release behavior with the policy on and off.

Testing before merging (1) (runs on the systems it can change; it doesn't hold the recommendation)

  • L2 gpu/vk/vk_memory.cpp:7131: The cost of retaining unused blocks under the mirror budget is not measured on the smaller cards covered by the default. When: On a 4 GB Windows GCN card, a long session can retain dead blocks in live mirrors; sparse_grow_all counts them against mirror_budget and leaves newly wanted blocks in guest memory when it runs out of room. Do: Compare base and this head over repeated matched long sessions on a 4 GB Windows GCN card, recording retained VRAM, mirror-budget exhaustion, average and 1% low FPS, and frame times.

Checks: they run again on this head; a failure shows on the pull request.

Also noticed (3; not asked for, not blocking)
  • The description lists additional Windows RDNA and GCN driver testing as still to do.
  • The new fixture has not yet been run, and the description leaves the test against main pending.
  • The described RDNA and another-driver GCN sessions remain pending.
More: does it help, other systems, switches, what was read

Does it help: Yes for the reported crash: the author reports that the amdkmdag.sys bugchecks did not recur during play on an RX 580 8 GB with the same early return enabled. The duration and retained-block cost on smaller cards are not reported.

Other systems: Auto leaves the policy off on Linux, RADV and AMD RDNA; the override can enable it elsewhere. The author reports about 0.5 GB of retained blocks late in a session on the 8 GB RX 580, but the effect on smaller GCN cards remains open.

Switches: RX_VK_SPARSE_KEEP and system/memory-settings:sparse_keep are added as a hidden Auto/Off/On setting. Auto enables retention for AMD's Windows driver on GCN and disables it elsewhere; its suitability on smaller cards awaits the VRAM measurement.

Reviewed: 9a9e0edfde against 7bc53f8413: Read the repository rules and PR template, the full sparse-mirror test, the release function and its fixture, and the relevant policy and settings changes. Skimmed generated ABI changes, policy test cases and the remaining changed files; not every changed code file was read in full.; nothing run (a code review).

Checked and fine:

  • The fixture exercises the production sparse_release body with keep enabled and disabled, including a live block, an idle block and release side effects.
  • The fix adds a test without removing or bypassing the sparse-keep policy.

Testing: No commands from the project or tests were run. CI has not yet run on this head; the author reports an in-game RX 580 test and game-free checks on the earlier version.

Overlaps and merge order: Not established from the supplied information.


Automated code review by BeanBot (gpt-6.1-terra), asked for by BeanBot, after its fix. Nothing was run; a maintainer decides.

**Recommendation: Approve.** The code is ready: only testing is left. The reported RX 580 session supports the crash workaround, but its retained VRAM cost on smaller cards covered by the default remains unmeasured. Recommend approval; not approved on the forge. **What `@fix` changed** I changed this pull request: the new head is 9a9e0edfde75. I edited its description to match the change. **Changed** - **Sparse release behavior**: Added a game-free fixture in tests/test_sparse_mirror.py:20 that executes the production sparse_release function with keep on and off, checking an idle block, a live block, and release side effects. Tests were not run, as requested. Nothing was built or run: the checks run again on the new head. The change keeps sparse mirror blocks bound on AMD Windows GCN devices to reduce the page-table churn associated with a driver crash. It trades that reduction for higher VRAM use; the added fixture checks release behavior with the policy on and off. **Testing before merging (1)** (runs on the systems it can change; it doesn't hold the recommendation) - **L2** `gpu/vk/vk_memory.cpp:7131`: The cost of retaining unused blocks under the mirror budget is not measured on the smaller cards covered by the default. *When:* On a 4 GB Windows GCN card, a long session can retain dead blocks in live mirrors; sparse_grow_all counts them against mirror_budget and leaves newly wanted blocks in guest memory when it runs out of room. **Do:** Compare base and this head over repeated matched long sessions on a 4 GB Windows GCN card, recording retained VRAM, mirror-budget exhaustion, average and 1% low FPS, and frame times. **Checks:** they run again on this head; a failure shows on the pull request. <details> <summary>Also noticed (3; not asked for, not blocking)</summary> - The description lists additional Windows RDNA and GCN driver testing as still to do. - The new fixture has not yet been run, and the description leaves the test against main pending. - The described RDNA and another-driver GCN sessions remain pending. </details> <details> <summary>More: does it help, other systems, switches, what was read</summary> **Does it help:** Yes for the reported crash: the author reports that the amdkmdag.sys bugchecks did not recur during play on an RX 580 8 GB with the same early return enabled. The duration and retained-block cost on smaller cards are not reported. **Other systems:** Auto leaves the policy off on Linux, RADV and AMD RDNA; the override can enable it elsewhere. The author reports about 0.5 GB of retained blocks late in a session on the 8 GB RX 580, but the effect on smaller GCN cards remains open. **Switches:** RX_VK_SPARSE_KEEP and system/memory-settings:sparse_keep are added as a hidden Auto/Off/On setting. Auto enables retention for AMD's Windows driver on GCN and disables it elsewhere; its suitability on smaller cards awaits the VRAM measurement. **Reviewed:** 9a9e0edfde75 against 7bc53f841323: Read the repository rules and PR template, the full sparse-mirror test, the release function and its fixture, and the relevant policy and settings changes. Skimmed generated ABI changes, policy test cases and the remaining changed files; not every changed code file was read in full.; nothing run (a code review). **Checked and fine:** - The fixture exercises the production sparse_release body with keep enabled and disabled, including a live block, an idle block and release side effects. - The fix adds a test without removing or bypassing the sparse-keep policy. **Testing:** No commands from the project or tests were run. CI has not yet run on this head; the author reports an in-game RX 580 test and game-free checks on the earlier version. **Overlaps and merge order:** Not established from the supplied information. </details> --- <sub>Automated code review by BeanBot (gpt-6.1-terra), asked for by BeanBot, after its fix. Nothing was run; a maintainer decides.</sub>
Owner
@rebase
Member

I rebased this pull request onto main (7c1ffffb57): the new head is ded623b044.

Conflicts resolved

  • game/settings_abi.h: Updated the layout hash for the combined fields.
  • game/crates/host-sys/src/settings_abi.rs: Updated the matching layout hash.

Nothing was built or run: read the resolution before merging.


Automated rebase by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.

I rebased this pull request onto `main` (7c1ffffb5708): the new head is ded623b04412. **Conflicts resolved** - game/settings_abi.h: Updated the layout hash for the combined fields. - game/crates/host-sys/src/settings_abi.rs: Updated the matching layout hash. Nothing was built or run: read the resolution before merging. --- <sub>Automated rebase by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.</sub>
BeanBot force-pushed sparse-keep from 9a9e0edfde
Some checks failed
PR description / Title and description (pull_request_target) Has been cancelled
CI / What the change needs (pull_request) Has been cancelled
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Has been cancelled
CI / Third-party parts and guide screenshots (pull_request) Has been cancelled
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Has been cancelled
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Has been cancelled
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
to ded623b044
Some checks failed
PR description / Title and description (pull_request_target) Has been cancelled
CI / What the change needs (pull_request) Has been cancelled
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Has been cancelled
CI / Third-party parts and guide screenshots (pull_request) Has been cancelled
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Has been cancelled
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Has been cancelled
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
2026-12-05 17:17:54 +00:00
Compare
BeanBot left a comment

Recommendation: Request changes. It conflicts with its base branch: bring it up to date (@​fix or @​rebase try first). (L3) Keeping sparse blocks bound avoided the reported crash in the RX 580 test, but its memory cost and effect on smaller GCN cards remain unmeasured.

The change avoids sparse-block release churn by default on AMD Windows GCN GPUs, retaining the blocks until their mirrors are destroyed. It trades page-table updates for higher retained VRAM and possible pressure on the mirror budget.

Blocking (1): must change before merging.

  1. L3: It conflicts with its base branch: bring it up to date (@​fix or @​rebase try first). (for the author)

Testing before merging (1) (runs on the systems it can change; it doesn't hold the recommendation)

  • L2 gpu/vk/vk_memory.cpp:7131: The cost of retaining unused blocks under the mirror budget is not measured on the smaller cards covered by the default. When: On a 4 GB Windows GCN card, a long session can retain dead blocks in live mirrors; sparse_grow_all counts them against mirror_budget and leaves newly wanted blocks in guest memory when it runs out of room. Do: Compare base and this head over repeated matched long sessions on a 4 GB Windows GCN card, recording retained VRAM, mirror-budget exhaustion, average and 1% low FPS, and frame times.

Since the last review (on 9a9e0edfde)
Still open: L2 (The cost of retaining unused blocks under the mirror budget is not measured on the smaller…)
New: L3 (It conflicts with its base branch: bring it up to date (@​fix or @​rebase try first).)

Checks: Still running: PR description / Title and description (pull_request_target).

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

Does it help: Unproven across the affected cards. The author reports that the tested RX 580 no longer bugchecked during play with the keep behavior enabled; the description estimates about 0.5 GB retained late in that session. It supplies no smaller-card comparison.

Other systems: Auto leaves AMD RDNA, Linux, RADV and other vendors unchanged; the hidden override can enable the behavior elsewhere. The remaining concern is memory pressure and mirror-budget competition on smaller affected GCN cards.

Switches: RX_VK_SPARSE_KEEP / system/memory-settings:sparse_keep is added as a hidden Auto/Off/On setting. Auto enables it for AMD's Windows driver on GCN and disables it elsewhere; its suitability on smaller cards remains unmeasured.

Reviewed: ded623b044 against 7c1ffffb57: Read the repository instructions and pull request template, the diff, the settings definition, sparse-release and memory-budget context, and the rebased ABI changes. The generated ABI files and other changed files were skimmed; the full changed code files were not all read in full.; nothing run (a code review).

Checked and fine:

  • The C and Rust settings layout hashes match, and both layouts place sparse_keep after buffer_mirrors.
  • The setting is represented in the switch table and documented, and the policy defaults to the intended driver and architecture.

Testing: No commands that build or run project code were executed. The author reports an in-game RX 580 test and passing game-free checks; the supplied CI status still has the description check running.

Overlaps and merge order: Not determined from the supplied information.


Automated code review by BeanBot (gpt-6.1-terra), asked for by BeanBot, after its rebase. Nothing was run; a maintainer decides.

**Recommendation: Request changes.** It conflicts with its base branch: bring it up to date (`@​fix` or `@​rebase` try first). (L3) Keeping sparse blocks bound avoided the reported crash in the RX 580 test, but its memory cost and effect on smaller GCN cards remain unmeasured. The change avoids sparse-block release churn by default on AMD Windows GCN GPUs, retaining the blocks until their mirrors are destroyed. It trades page-table updates for higher retained VRAM and possible pressure on the mirror budget. **Blocking (1)**: must change before merging. 1. **L3**: It conflicts with its base branch: bring it up to date (`@​fix` or `@​rebase` try first). *(for the author)* **Testing before merging (1)** (runs on the systems it can change; it doesn't hold the recommendation) - **L2** `gpu/vk/vk_memory.cpp:7131`: The cost of retaining unused blocks under the mirror budget is not measured on the smaller cards covered by the default. *When:* On a 4 GB Windows GCN card, a long session can retain dead blocks in live mirrors; sparse_grow_all counts them against mirror_budget and leaves newly wanted blocks in guest memory when it runs out of room. **Do:** Compare base and this head over repeated matched long sessions on a 4 GB Windows GCN card, recording retained VRAM, mirror-budget exhaustion, average and 1% low FPS, and frame times. **Since the last review** (on 9a9e0edfde75) Still open: L2 (The cost of retaining unused blocks under the mirror budget is not measured on the smaller…) New: L3 (It conflicts with its base branch: bring it up to date (`@​fix` or `@​rebase` try first).) **Checks:** Still running: `PR description / Title and description (pull_request_target)`. <details> <summary>More: does it help, other systems, switches, what was read</summary> **Does it help:** Unproven across the affected cards. The author reports that the tested RX 580 no longer bugchecked during play with the keep behavior enabled; the description estimates about 0.5 GB retained late in that session. It supplies no smaller-card comparison. **Other systems:** Auto leaves AMD RDNA, Linux, RADV and other vendors unchanged; the hidden override can enable the behavior elsewhere. The remaining concern is memory pressure and mirror-budget competition on smaller affected GCN cards. **Switches:** RX_VK_SPARSE_KEEP / system/memory-settings:sparse_keep is added as a hidden Auto/Off/On setting. Auto enables it for AMD's Windows driver on GCN and disables it elsewhere; its suitability on smaller cards remains unmeasured. **Reviewed:** ded623b04412 against 7c1ffffb5708: Read the repository instructions and pull request template, the diff, the settings definition, sparse-release and memory-budget context, and the rebased ABI changes. The generated ABI files and other changed files were skimmed; the full changed code files were not all read in full.; nothing run (a code review). **Checked and fine:** - The C and Rust settings layout hashes match, and both layouts place sparse_keep after buffer_mirrors. - The setting is represented in the switch table and documented, and the policy defaults to the intended driver and architecture. **Testing:** No commands that build or run project code were executed. The author reports an in-game RX 580 test and passing game-free checks; the supplied CI status still has the description check running. **Overlaps and merge order:** Not determined from the supplied information. </details> --- <sub>Automated code review by BeanBot (gpt-6.1-terra), asked for by BeanBot, after its rebase. Nothing was run; a maintainer decides.</sub>
tobim6 force-pushed sparse-keep from ded623b044
Some checks failed
PR description / Title and description (pull_request_target) Has been cancelled
CI / What the change needs (pull_request) Has been cancelled
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Has been cancelled
CI / Third-party parts and guide screenshots (pull_request) Has been cancelled
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Has been cancelled
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Has been cancelled
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
to d2cdf086e6
Some checks failed
CI / What the change needs (pull_request) Blocked by required conditions
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Blocked by required conditions
CI / Third-party parts and guide screenshots (pull_request) Blocked by required conditions
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Blocked by required conditions
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Blocked by required conditions
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Blocked by required conditions
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Blocked by required conditions
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Blocked by required conditions
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Blocked by required conditions
CI / Website build and checks (pull_request) Blocked by required conditions
PR description / Title and description (pull_request_target) Failing after 6s
2026-12-05 17:22:56 +00:00
Compare
Author
Contributor

Rebased onto main (3145d9d4): the conflict was only the generated settings ABI (game/settings_abi.h, game/crates/host-sys/src/settings_abi.rs), made again by schema-gen (--check passes). test_device_policy, test_sparse_mirror, test_switch_table, test_menu_ini_keys, test_i18n_complete pass on the new head.

Rebased onto main (3145d9d4): the conflict was only the generated settings ABI (game/settings_abi.h, game/crates/host-sys/src/settings_abi.rs), made again by schema-gen (--check passes). test_device_policy, test_sparse_mirror, test_switch_table, test_menu_ini_keys, test_i18n_complete pass on the new head.
HumanBean deleted branch sparse-keep 2026-12-05 17:24:15 +00:00
Some checks failed
CI / What the change needs (pull_request) Blocked by required conditions
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Blocked by required conditions
CI / Third-party parts and guide screenshots (pull_request) Blocked by required conditions
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Blocked by required conditions
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Blocked by required conditions
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Blocked by required conditions
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Blocked by required conditions
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Blocked by required conditions
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Blocked by required conditions
CI / Website build and checks (pull_request) Blocked by required conditions
PR description / Title and description (pull_request_target) Failing after 6s
Some workflows are waiting to be reviewed.
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
4 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!3256
No description provided.