perf(v2): shared activation cache - further 1.66-2.00x real speedup (DEC-0016)
Implements optimization #2 from the final benchmark campaign's own recommendation, on top of DEC-0015's word-level burst rewrite: a new shared activation_cache.v module fetches a given activation (X) vector from PSRAM once instead of once per neuron sharing it - the exact redundant traffic pattern the dense-layer workloads in this project's benchmark suite exhibit. Each memory_manager's own prefetch_engine now fetches WEIGHTS only; the activation half is requested from the shared cache instead (single-tag, tile-granular, N_SLOTS request ports, its own real word-level PSRAM backend via a new dedicated arbiter port). dataflow_core.v/slot_mem_arbiter.v/neural_multiprocessor.v widened to N_SLOTS+1 ports to arbitrate the cache's traffic alongside each slot's weight traffic. Two real bugs found and fixed during implementation (ERR-0010): a target-bank/pending-bank race in memory_manager.v's activation-cache wiring (the same bug class ERR-0006 already fixed once for pf_target_bank - a later handoff's queued request can overwrite which bank an earlier, still-in-flight request's ack applies to), and a repeat of ERR-0009's N_SLOTS=1 zero-width replication bug in activation_cache.v itself. Real, measured results: the full final-benchmark campaign (24/24 workload/config combinations) re-verified bit-exact. D-Stress cycles fall a further 1.66-2.00x on top of DEC-0015 (~4x combined vs the original byte-level baseline). But the cache's real Fmax cost is much steeper than DEC-0015's own: N_SLOTS=2 (the recommended default, DEC-0014) drops from 133.58 to 87.72 MHz (-34%, margin over 80MHz shrinks from +67% to +9.7%), and N_SLOTS=4 drops to 65.01 MHz - now FAILING the 80MHz target it previously passed. Combined real wall-clock speedup vs the original baseline: N=1 3.86x, N=2 2.45x (both real net wins); N=4 is a real regression once its own now-failing Fmax is honestly used, though N=4 was never the recommended configuration. N_SLOTS=2 remains the recommended default (DEC-0014 unaffected) with a thinner but still real Fmax margin. Cache hit-detection pipelining is flagged as concrete follow-up work if N_SLOTS>2 is ever needed with the cache active - not attempted this round. Logged: simulation/synthesis/timing/benchmark/decisions (DEC-0016)/ experiments (EXP-0016)/errors (ERR-0010)/development.log, ROADMAP.md updated. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013xXuuRUWZScuo1DeYJxs3v
This commit is contained in:
@@ -331,3 +331,35 @@ decision: vedi decisions.log DEC-0015.
|
||||
next_action: ottimizzazione #2 -- cache condivisa on-chip per il
|
||||
vettore di attivazione (X), per eliminare le letture ridondanti tra
|
||||
neuroni che condividono lo stesso input di layer.
|
||||
|
||||
[2026-09-05] Ottimizzazione #2 -- cache condivisa on-chip per il
|
||||
vettore di attivazione, su richiesta esplicita dell'utente
|
||||
reason: dopo l'ottimizzazione #1 (burst a livello di parola), l'utente
|
||||
ha chiesto di implementare anche la #2: cache condivisa per evitare
|
||||
che ogni neurone rilegga da PSRAM lo stesso vettore X gia' letto da
|
||||
un altro neurone dello stesso layer.
|
||||
result: nuovo modulo activation_cache.v (single-tag, granularita' a
|
||||
tile, condiviso tra tutti gli slot). Trovati e risolti 2 bug reali
|
||||
durante l'implementazione (errors.log ERR-0010): una race
|
||||
target-bank/pending-bank (stessa classe di ERR-0006) e una ripetizione
|
||||
del bug a larghezza zero di ERR-0009 (N_SLOTS=1). Dopo il fix: 24/24
|
||||
PASS bit-exact. Beneficio reale misurato: ulteriore riduzione cicli
|
||||
1.66-2.00x oltre l'ottimizzazione #1 (circa 4x combinato rispetto
|
||||
alla baseline originale byte-level). MA costo reale in Fmax molto piu'
|
||||
ripido del previsto: N_SLOTS=2 scende da 133.58 a 87.72 MHz (-34%,
|
||||
ancora sopra 80MHz ma con margine molto piu' sottile), N_SLOTS=4
|
||||
scende a 65.01 MHz e ORA FALLISCE il target 80MHz (prima passava).
|
||||
Speedup reale in wall-clock rispetto alla baseline originale:
|
||||
N=1 3.86x, N=2 2.45x, N=4 2.29x (ma con una regressione reale
|
||||
rispetto alla sola ottimizzazione #1, dato che N=4 ora fallisce il
|
||||
timing).
|
||||
errors: vedi errors.log ERR-0010 (2 bug RTL reali, trovati e risolti).
|
||||
decision: vedi decisions.log DEC-0016 -- vittoria reale netta
|
||||
confermata per N_SLOTS=1/2 (l'intervallo raccomandato, DEC-0014
|
||||
resta valida), regressione reale a N_SLOTS=4 (mai la configurazione
|
||||
raccomandata, ma un costo reale onestamente riportato, non nascosto).
|
||||
Pipeline della logica di hit-check della cache segnalato come lavoro
|
||||
futuro concreto se servisse N_SLOTS>2 con la cache attiva.
|
||||
next_action: nessuna ulteriore richiesta esplicitamente dall'utente per
|
||||
questo giro. Datasheet V2 professionale, ora con dati definitivi
|
||||
post-ottimizzazione da includere.
|
||||
|
||||
Reference in New Issue
Block a user