Low-VRAM GPUs (4 GB, no Resizable BAR; GTX 1650/1660-class laptops): where memory goes today, and a budget-aware placement proposal
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 15/100
- Tipo de issue
- Nueva funcionalidad
- Claridad
- Bastante claro
- Estado de actividad
- Activo
- Área
- computer-graphics, performance
Línea de trabajo
This is a multi-item design proposal, not a single change. Start with the allocation path in runtime/shims/d3d12_vulkan.cpp (DeviceState::allocate near lines 930-948, and the texture allocation near line 1440) and the memory type policy in docs/d3d12_vulkan.md. Done would mean the proposal is split into items with owners, and the budget and spill behaviour is agreed by maintainers.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
The game doesn't boot yet, so this has no frame numbers. It records what the layer does with memory on a 4 GB card without Resizable BAR, measured on hardware and read from main (4eb6155), and proposes an order of work. Most of it builds on items that already have owners. I'm not claiming anything with this issue. The coordinator can split it into items, or close it if the plan is elsewhere.
The hardware
NVIDIA GeForce GTX 1650 Mobile (Turing TU117), NVIDIA 620.70.06, Linux. vulkaninfo: a 4 GiB DEVICE_LOCAL heap, a 246 MiB DEVICE_LOCAL | HOST_VISIBLE heap (no Resizable BAR), 22.65 GiB of host memory, and VK_EXT_memory_budget available. The GPU suite is clean on it (#166 entry). GTX 1650/1660 (Super/Ti), RTX 3050 Laptop 4 GB, RX 6500 XT/6400 and many laptops are in this class, and most of them have no Resizable BAR.
What the layer does today (main 4eb6155)
- Textures: each one gets its own
vkAllocateMemory, preferringDEVICE_LOCAL(runtime/shims/d3d12_vulkan_device.cpp:1440).DeviceState::allocate(:930-948) tries each type frommemory_type_orderand takes the first that succeeds. So when VRAM is full, a texture silently lands in host memory: nothing is logged, and the game is told nothing. - Arena: 256 MiB by default (
LEONIDA_ARENA_MB),HOST_VISIBLE | HOST_COHERENT, preferringDEVICE_LOCAL. It is larger than the 246 MiB BAR heap, somemory_type_orderskips that heap and every default-heap buffer, shader-visible descriptor heap and shader program lives in system memory here. That is the documented M0–M3 policy (docs/d3d12_vulkan.md, "Memory type policy"), with M4+ planned as aDEVICE_LOCALarena plus staging. Not a bug, but on this class of GPU the M4+ step decides whether GPU-read buffers go over PCIe every frame. - Placed textures are charged twice: the
ID3D12Heapreserves its full range in the arena (:1951-1954), and every texture placed in it allocates its own memory as well (:1943-1945). #770 (D3D-88, aliasing) would remove that. - No budget in the layer: the device does not enable
VK_EXT_memory_budget. Only the DXGI shim reads it, forQueryVideoMemoryInfo(runtime/shims/dxgi_com.cpp:585-605).MakeResident/Evictcheck their arguments and do nothing (:3403-3432), because Vulkan has no residency API and paging under pressure is the kernel driver's job. D3D-253 (@wiverlord78, claimed in #313) adds budget reporting at device start and at allocation milestones. - What the game is told:
DedicatedVideoMemoryis the real heap size (dxgi_com.cpp:670-682).XSystemGetAppMemoryUsageLimitreturns total physical RAM (runtime/shims/xgameruntime.cpp:289-293). Whether the game sizes its pools from either is unknown until it boots (docs/d3d12_vulkan.md:1877-1878).
Proposal, in order
None of this changes behaviour on GPUs with enough VRAM.
- Measure first. Land D3D-253. Also log once per device when a resource that preferred
DEVICE_LOCALwas placed elsewhere, with its size and the running total, so a first boot on a 4 GB card shows what spilled. I'll test D3D-253 on the GTX 1650 when it's up, if that helps @wiverlord78. - Spill on purpose, not by accident. Once the budget is known, decide what may live in host memory rather than taking whatever fails last. Render targets, depth and UAV textures stay in VRAM. Large sampled textures created after the budget is reached are the first candidates for host memory. This only uses
memory_type_order's existing fallback, with a budget check before it. - Don't charge placed textures twice (#770).
- M4+ arena staging, already planned in
docs/d3d12_vulkan.md: on a GPU without Resizable BAR this moves GPU-read buffers out of system memory. It costs a few hundred MiB of VRAM, so it competes with item 2, and the budget numbers from item 1 should decide. - Later, only with the game running: the game's own quality profile.
LEONIDA_DEVICE_TYPE=6(Series S,xgameruntime.cpp:259-334) is the obvious first A/B, since it is the console profile with the least memory.
Not proposed: rendering on the CPU, and shrinking render targets inside the layer. The game picks those sizes, and changing them behind its back breaks views, copies and shader constants.
Also looked at, not proposed yet
- The integrated GPU (Radeon Vega next to the GTX 1650 here). On a muxless laptop the iGPU already scans out, and the dGPU's frames are copied to it every frame anyway. Splitting rendering work between the two would need a cross-device copy through system memory per frame, which costs more than it saves. Frame generation on the iGPU already exists outside the project (Lossless Scaling / lsfg-vk on Linux). It needs no layer code, so it has no item here.
- Smaller textures. Leaving the top mips out could save the most memory, but only in one of two ways:
- in the layer: allocate fewer mips in
create_textureand remap every copy's subresource index; - offline: a pool writer served through the
file_system.cppoverlay.
Neither exists yet, and both should wait forttpf_mips.py vram's totals on a real corpus, so we know the saving first.
- in the layer: allocate fewer mips in
- Lighter models and shorter draw distances. These come from the game's own LOD data (
lodDist/childLodDist,docs/world.md:207) and its streaming. Scaling them would mean rewriting map and archetype files, and nothing writes those formats today. Not proposed until the game runs.
What I can offer
- Testing on a GTX 1650 Mobile (4 GB, 246 MiB BAR, Linux): D3D-253, #770, and later the arena staging.
- Two small tools on a local branch (not a PR yet), which I can open if they're wanted:
tools/ttpf_mips.py vramsums the bytes of the 2D TTPF textures at full size and with 1–3 top mips dropped. It reads metadata only and prints counts and byte totals.tools/frametime_stats.pyturns a MangoHud log into average FPS, P95/P99 frame time, 1% low and stutter count, and compares two runs, for one-change-at-a-time tuning once the game renders.
AI-assisted (Claude Code). No game files used.
- Lenguaje dominante
- Python
- Estrellas
- 14.9k
- Forks
- 1.2k
- Merge medio
- 1 h 58 min
- PR fusionados (30 d)
- 40
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de ItsNotRexed/Leonida
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
ItsNotRexed/Leonida#3990 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 3/5 Medio día Aptitud para principiantes 25/100
ItsNotRexed/Leonida#4257 · 18 comentarios ·
Los mantenedores suelen responder en 1 día
-
Python SPIR-V assembler encodes BF16 constants as IEEE halfPosiblemente ocupada @lumenpearson la tomó hoy. Abiertobug
Dificultad 3/5 Medio día Aptitud para principiantes 25/100
ItsNotRexed/Leonida#4237 ·
Los mantenedores suelen responder en 1 día
-
SPIR-V reflection rejects Int8 array length constantsPosiblemente ocupada @lumenpearson la tomó hoy. Abiertobug
Dificultad 3/5 Medio día Aptitud para principiantes 22/100
ItsNotRexed/Leonida#4221 ·
Los mantenedores suelen responder en 1 día
-
Interrupted stub rebuild can truncate a valid SPIR-V outputPosiblemente ocupada @lumenpearson la tomó hoy. Abiertobug
Dificultad 3/5 Medio día Aptitud para principiantes 18/100
ItsNotRexed/Leonida#4183 ·
Los mantenedores suelen responder en 1 día
Todos los issues de ItsNotRexed/Leonida
Issues similares
-
pydanty:is-working
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
pydantic/pydantic-ai#14187 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
Los mantenedores suelen responder en 1 día
-
[Bug]: legacy_json_to_doc crashes on persisted docs with "relationships": nullPosiblemente ocupada @Harsh23Kashyap la tomó hoy. Abierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
run-llama/llama_index#24392 ·
Los mantenedores suelen responder en 2 días
-
Add server: crowllm-mcpAbierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 72/100
pathintegral-institute/mcpm.sh#568 ·
Los mantenedores suelen responder en 21 días