SSD streaming: LRU cache behaves pathologically during prefill

Aperta
#1,119 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 6 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
45/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
c
Ambito
performance

Direzione di ricerca

Look at the SSD streaming and LRU cache implementation, likely in files handling weight loading and caching. The issue describes a specific pathological behavior during prefill where the cache hit rate drops to 0%. Start by understanding the current cache allocation and eviction logic. The proposed fix is to freeze cache allocations after the first prefill batch. Test the change by measuring prefill throughput before and after, as the user did with the GLM-5.3 Flash model.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

During prefill, the activated weights per batch may be larger than the expert cache. When this happens I see a flat 0% hit rate, because the LRU replacement policy always evicts an expert between its allocation and its next use. Prefill is disk-bound as a result.

I did some experiments, and a simple trick that helps quite a bit is to temporarily freeze cache allocations after the first prefill batch. For remaining batches you still query the cache, still use cached experts, but anything not in the cache is filled from disk and immediately discarded after use. This avoids the pathological LRU cycling and ensures you get to hit the cached experts. Enabling cache allocations for the first batch is still useful for cache warming, especially when prefilling from 0 with a cold cache.

This trick increased my prefill from ~110 t/s to ~400 t/s running the Q2 quant of GLM-5.3 Flash on an RTX Pro 6000 using CUDA 13.1. I can provide a patch if it's interesting but I think there's enough info here to have an agent evaluate the idea.

Other issues: I looked at #503 which sounded related from the title, but on closer inspection it seems to be a problem with different cache arenas for different quantisation types, and not about this more general LRU problem.

Lingua principale
C
Stelle
24.4k
Fork
2.4k
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di antirez/ds4

Tutte le issue di antirez/ds4

Issue simili

Altre issue su C

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.