RAM: drop the renderer's CPU copy of the GPU geometry buffers (~2 GB in heavy regions) #584

Closed
opened 2026-10-09 02:20:12 +00:00 by sky_line · 1 comment
Owner

A jemalloc heap profile in a heavy region (2026-10-09; 7.1 GB live heap, unsampled) attributes about 2.1 GB to LLCleanRendererVK::fillFromCleanStores / placeSlot. That is a full CPU copy of the GPU mega-buffers (mCpuVerts, mCpuIdx, mCpuWeights, plus the slot table), including freed ranges and vector growth capacity.

The GPU buffers are authoritative, and the meshstore keeps the quantized per-slot mirror (#573/#582) that the packer reads from, so this third copy only serves placement and repack.

Goal

Remove the CPU shadow of the GPU geometry buffers.

  • Placement: writes slots straight from the meshstore mirror into the upload staging buffer, at offsets from the existing free-list allocators. Those keep only offset bookkeeping, no bytes.
  • Compaction / full repack: done on the GPU with vkCmdCopyBuffer between ranges (or into a new buffer) instead of rebuilding a CPU image.
  • CPU readers of the packed copy (stats, debug dumps, garbage accounting) switch to bookkeeping or the meshstore mirror.

Done when

  • fillFromCleanStores no longer shows in heap profiles beyond small bookkeeping.
  • RSS drops by about 2 GB in the heavy region.
  • Geometry, rigged meshes, RT and shadows are unchanged, and there are no upload hitches.
A jemalloc heap profile in a heavy region (2026-10-09; 7.1 GB live heap, unsampled) attributes about **2.1 GB** to `LLCleanRendererVK::fillFromCleanStores` / `placeSlot`. That is a full CPU copy of the GPU mega-buffers (`mCpuVerts`, `mCpuIdx`, `mCpuWeights`, plus the slot table), including freed ranges and vector growth capacity. The GPU buffers are authoritative, and the meshstore keeps the quantized per-slot mirror (#573/#582) that the packer reads from, so this third copy only serves placement and repack. ## Goal Remove the CPU shadow of the GPU geometry buffers. - **Placement:** writes slots straight from the meshstore mirror into the upload staging buffer, at offsets from the existing free-list allocators. Those keep only offset bookkeeping, no bytes. - **Compaction / full repack:** done on the GPU with `vkCmdCopyBuffer` between ranges (or into a new buffer) instead of rebuilding a CPU image. - **CPU readers** of the packed copy (stats, debug dumps, garbage accounting) switch to bookkeeping or the meshstore mirror. ## Done when - `fillFromCleanStores` no longer shows in heap profiles beyond small bookkeeping. - RSS drops by about 2 GB in the heavy region. - Geometry, rigged meshes, RT and shadows are unchanged, and there are no upload hitches.
sky_line added this to the Slipstream project 2026-10-09 02:20:12 +00:00
Author
Owner

Shipped in a published release and tested; closing (testing-lane sweep 2026-10-11).

Shipped in a published release and tested; closing (testing-lane sweep 2026-10-11).
sky_line 2026-10-11 13:25:13 +00:00
Sign in to join this conversation.
No milestone
No project
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.

Dependencies

No dependencies set.

Reference
sky_line/Slipstream#584
No description provided.