You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG] GGUFCudaKernel keeps an extra device copy of the quantized weight for each distinct batch size (up to 8 per layer) #4216
Severity: medium (up to ~9× the GGUF weight VRAM; also against AGENTS.md's storage rule in spirit) Version: 7.11.0 @ 9dad249, with llama-cpp-python 0.3.36 (CUDA)
Summary
In nn_modules/qlinear/gguf_cpp.py:
build_quantized_matmul_cuda_plan (~L610-692) allocates a ggml backend buffer and uploads qweight into every plan;
plans are keyed by input row count (_cuda_plan_key, ~L1088);
up to _MAX_GGML_CUDA_PLANS = 8 plans are kept (L136).
Actual: retained ggml buffers grow 36 → 72 → … → 290 MiB as the batch size changes (qweight itself is 36 MiB).
Expected: one weight copy per device, shared by all plans; only the activation/output tensors vary per batch size.
Found during an AI-assisted review (Claude Code) of 9dad249; repros were run on RTX 4090/5090 (CUDA 13) and/or Radeon AI PRO R9700 (ROCm) unless marked static/suspected.
Activity
fix: share one GGML CUDA weight copy across every batch-size plan (#4216