fix(radv): keep device-local memory out of a small APU carve-out #483

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

@⁠ChainedTears on GitHub · 2026-12-04 17:28 UTC · original
ChainedTears:fix/apu-carveout-gtt → main · +38 −4 · 1 files · 1 commits · open

What is wrong

On an APU, RADV's device-local memory types point at the VRAM domain, which on such a machine is only the BIOS carve-out. RADV places a device-local allocation in VRAM first and spills to GTT only once it is full. On a Ryzen AI Max+ 395 (Radeon 8060S, gfx1151) the carve-out is 512 MB and the desktop alone holds about 316 MB of it, so the title keeps the carve-out full and the compositor's buffers no longer fit:

gnome-shell: amdgpu: The CS has been rejected, see dmesg for more information (-12).
systemd: [email protected]: Main process exited, code=killed, status=6/ABRT

GNOME Shell aborts and the session logs out, mid-run. Before that, runs on this machine ended now and then in device removed with the title's context reported innocent.

The change

In patches/mesa.patch, on a GPU without dedicated VRAM whose carve-out is under 1 GB:

  • radv_physical_device_init_mem_types: the memory types that targeted RADEON_DOMAIN_VRAM take RADEON_DOMAIN_GTT with RADEON_FLAG_GTT_WC (write-combined, uncached for the GPU), without RADEON_FLAG_NO_CPU_ACCESS. The heaps and the property flags the application sees are unchanged.
  • radv_amdgpu_winsys_bo_create: RADV's own buffers created directly in VRAM (shader arenas and the like) take write-combined GTT the same way.

RADV_APU_CARVEOUT=1 keeps the old placement. A carve-out of 1 GB or more (a Steam Deck's) is left as it was: not tested there.

Measured (one machine: Ryzen AI Max+ 395, 128 GB, 512 MB carve-out, Proton Experimental)

  • Carve-out in use during a run (mem_info_vram_used): 460+ MB before, 316-320 MB after (what the desktop holds without the title).
  • Frame rate unchanged: the built-in benchmark (VICTORY_BENCH, 3 minutes of the same cutscene, Series X, 2560x1440, ray tracing on): 26.1 fps (3 runs) before, 26.6 after.
  • No session logout since, over the runs that followed.

The first start after the driver changes prepares the pipelines again (the driver's cache key changes).

This change was written with an AI assistant (Claude Code); the Mesa part carries the Generated-by: LLM trailer per Mesa's policy.

Generated with Claude Code

**@⁠ChainedTears** on GitHub · 2026-12-04 17:28 UTC · [original](https://github.com/lobomfz/VIctory-xmem/pull/483) `ChainedTears:fix/apu-carveout-gtt` → `main` · +38 −4 · 1 files · 1 commits · open ### What is wrong On an APU, RADV's device-local memory types point at the VRAM domain, which on such a machine is only the BIOS carve-out. RADV places a device-local allocation in VRAM first and spills to GTT only once it is full. On a Ryzen AI Max+ 395 (Radeon 8060S, gfx1151) the carve-out is 512 MB and the desktop alone holds about 316 MB of it, so the title keeps the carve-out full and the compositor's buffers no longer fit: ``` gnome-shell: amdgpu: The CS has been rejected, see dmesg for more information (-12). systemd: [email protected]: Main process exited, code=killed, status=6/ABRT ``` GNOME Shell aborts and the session logs out, mid-run. Before that, runs on this machine ended now and then in `device removed` with the title's context reported innocent. ### The change In `patches/mesa.patch`, on a GPU without dedicated VRAM whose carve-out is under 1 GB: - `radv_physical_device_init_mem_types`: the memory types that targeted `RADEON_DOMAIN_VRAM` take `RADEON_DOMAIN_GTT` with `RADEON_FLAG_GTT_WC` (write-combined, uncached for the GPU), without `RADEON_FLAG_NO_CPU_ACCESS`. The heaps and the property flags the application sees are unchanged. - `radv_amdgpu_winsys_bo_create`: RADV's own buffers created directly in VRAM (shader arenas and the like) take write-combined GTT the same way. `RADV_APU_CARVEOUT=1` keeps the old placement. A carve-out of 1 GB or more (a Steam Deck's) is left as it was: not tested there. ### Measured (one machine: Ryzen AI Max+ 395, 128 GB, 512 MB carve-out, Proton Experimental) - Carve-out in use during a run (`mem_info_vram_used`): 460+ MB before, 316-320 MB after (what the desktop holds without the title). - Frame rate unchanged: the built-in benchmark (`VICTORY_BENCH`, 3 minutes of the same cutscene, Series X, 2560x1440, ray tracing on): 26.1 fps (3 runs) before, 26.6 after. - No session logout since, over the runs that followed. The first start after the driver changes prepares the pipelines again (the driver's cache key changes). This change was written with an AI assistant (Claude Code); the Mesa part carries the `Generated-by: LLM` trailer per Mesa's policy. Generated with [Claude Code](https://claude.com/claude-code)
On an APU whose BIOS carve-out ("VRAM") is under 1 GB, RADV still placed
every device-local allocation in VRAM first and spilled to GTT only when it
was full. On a Ryzen AI Max+ 395 (Radeon 8060S) with a 512 MB carve-out the
desktop holds about 316 MB of it: the title kept the carve-out full, a
GNOME Shell submission was rejected with -ENOMEM ("amdgpu: The CS has been
rejected (-12)"), the shell aborted and the session logged out mid-run.

On a GPU without dedicated VRAM and a carve-out under 1 GB, memory types
that targeted VRAM, and RADV's own buffers created in VRAM, now take
write-combined GTT. During a run the carve-out then stays at what the
desktop holds (about 316-320 MB, from 460+ MB), with the same frame rate
(Series X, 2560x1440: 26.6 fps against 26.1 before; with the translator
options 28.1-29.2). RADV_APU_CARVEOUT=1 restores the old placement. A Steam
Deck's 1 GB carve-out is left as it was.

Generated-by: LLM
Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-04 17:31:53 +00:00
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

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

Merge

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