[Engine] explicit --layer-split reloads CUDA0 dense weights a second time at startup (0 MiB freed)

Abierto Apto para principiantes
#6,110 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 5 días

@wronglebowsk ya está trabajando en esto.

Desde el 17/11/2026.

  • #6149 de @wronglebowsk — abierto

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
82/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
cpp
Área
backend

Línea de trabajo

Lee la lógica de trim en src/program/generate.cpp alrededor de las líneas 6554–6557 y el bloque de trim posterior alrededor de la línea 7168; compara esas rutas con el manejo anterior de stage_trim alrededor de las líneas 5580 y 5607–5612. Reproduce el problema con el comando proporcionado --layer-split 18,33 --trim-stage-weights y comprueba que se omitan el escaneo redundante y la recarga cuando stage_trim ya está activo. El objetivo se cumple cuando, al iniciar, se cargan las matrices de proyección nativas una sola vez y deja de notificarse 0 MiB freed para ese trim.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Area

[Engine] (speed, kernels, models, the server and API)

Desktop app, Terminal or source?

Source (START-HERE.bat, setup.sh or a build)

What happened

On an explicit --layer-split (for example --layer-split 18,33 --trim-stage-weights, or when the early spill walk converts auto into an explicit split), stage_trim (src/program/generate.cpp:5580) already trims CUDA0 before its initial wt.load and native_dense.load (src/program/generate.cpp:5607-5612):

strata generate: layer split: CUDA0 loads the dense weights of layers 0-17 only
strata generate: 95 MiB of weights loaded from .../packs/unsloth_iq3_xxs in 0.2 s (855 canonical tensors skipped: served natively)
strata: STRATA_HC_Q8=1: 0.24 GiB of Q8_0 hyper-connection projections for the verify read
strata generate: 191 native projection matrices, 1146.24 MiB of weights, in 5.1 s

However, const bool trim = o.trim_stage_weights && multi_gpu && !stages.empty(); at src/program/generate.cpp:6554 (added for --layer-split auto post-search trimming) does not check !stage_trim. As a result, on an explicit split:

  1. if (trim) at src/program/generate.cpp:6557 scans index.txt and runs WeightTable::pool_bytes 48 times over the already-trimmed skip set.
  2. if (trim) at src/program/generate.cpp:7168 frees CUDA0's already-trimmed weight arena and NativeDense projections, re-allocates the same size, and reloads all 191 native projection matrices (1,146.24 MiB) from the GGUF shards a second time, adding ~5-7 seconds to startup and logging 0 MiB freed:
strata: STRATA_HC_Q8=1: 0.24 GiB of Q8_0 hyper-connection projections for the verify read
strata generate: 191 native projection matrices, 1146.24 MiB of weights, in 5.0 s
strata generate: layer split: CUDA0 keeps only its own layers' dense weights (0.43 GiB in all): CUDA0 0-17 (0 MiB freed) (the later cards trim in late_weights)

Expected behavior: when stage_trim is already true (const bool trim = o.trim_stage_weights && multi_gpu && !stages.empty() && !stage_trim;), skip the redundant post-search trim_prefix scan and CUDA0 reload.

Smallest steps or command that reproduce it
./build/strata --serve \
  --pack /path/to/packs/unsloth_iq3_xxs \
  --native /path/to/Qwen3.8-Flash-Next-UD-IQ3_XXS-00001-of-00004.gguf \
  --ple-gguf /path/to/Qwen3.8-Flash-Next-UD-IQ3_XXS-00004-of-00004.gguf \
  --layer-split 18,33 --trim-stage-weights
Reproduction status

Reproduced locally

Strata version

Strata 0.2.15 · engine 0.1.61 (commit c77572806)

Graphics card, memory and system

RTX 5060 Ti 16 GB + RTX 2080 Ti 11 GB + RTX 3080 Ti 12 GB · 2x Xeon E5-2683 v4 · 188 GiB DDR4 RAM · Ubuntu Linux 7.3.4

Model, size and settings

Qwen3.8-Flash-Next UD-IQ3_XXS · 512K context (--kv k8v4) · --layer-split 18,33 --trim-stage-weights

Logs
strata generate: layer split: CUDA0 loads the dense weights of layers 0-17 only
strata generate: 95 MiB of weights loaded from .../packs/unsloth_iq3_xxs in 0.2 s (855 canonical tensors skipped: served natively)
strata: STRATA_HC_Q8=1: 0.24 GiB of Q8_0 hyper-connection projections for the verify read
strata generate: 191 native projection matrices, 1146.24 MiB of weights, in 5.1 s
...
strata: STRATA_HC_Q8=1: 0.24 GiB of Q8_0 hyper-connection projections for the verify read
strata generate: 191 native projection matrices, 1146.24 MiB of weights, in 5.0 s
strata generate: layer split: CUDA0 keeps only its own layers' dense weights (0.43 GiB in all): CUDA0 0-17 (0 MiB freed) (the later cards trim in late_weights)
Lenguaje dominante
C++
Estrellas
11.6k
Forks
1k
Merge medio
18 d 13 h
PR fusionados (30 d)
4

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

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de Niko1221/Strata

Todos los issues de Niko1221/Strata

Issues similares

Más issues de C++

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.