Commit 3c2377f
feat(observer): adaptive detect cadence — first ≥ 2× saturated-regime win (4.29×)
ADR-154 §16 named three observer-side levers for closing the
saturated-regime throughput gap that (a) SIMD (commit 2) and (b) Opt D
delay-sorted CSR (commit 7) left on the table. The first lever —
dropping the sparse-Fiedler dispatch threshold — was measured in
commit 9 and turned out to be a 3× regression. This commit implements
the second: adaptive detect cadence.
Logic (14 LOC addition to src/observer/core.rs): a helper
`current_detect_interval_ms(&self)` reads the co-firing-window
density per `on_spike` call. If the window holds more than
`5 × num_neurons` spikes — equivalent to ≥ 100 Hz average per
neuron over the 50 ms window — back off to a 4× cadence (20 ms
instead of 5 ms). Drop back to 5 ms as soon as density falls below
threshold. Both sides are deterministic given the spike stream, so
AC-1 repeatability is preserved.
Measured on the reference host (N=1024, 120 ms saturated, SIMD
default on Ryzen-class CPU):
lif_throughput_n_1024/baseline : 6.86 s → 1.70 s (4.03× vs pre)
lif_throughput_n_1024/optimized : 6.74 s → 1.57 s (4.29× vs pre)
ADR-154 §3.2 saturated-regime target was ≥ 2× over scalar-opt.
**Measured: 4.29×. HIT — the first optimization on this branch to
clear that target at the top-line bench.**
Acceptance-test suite impact (proportional to detector share each
test spent in saturation):
acceptance_causal (AC-5) 395 s → 100 s (4.0×)
acceptance_core (AC-1..AC-4) 63 s → 16 s (4.0×)
integration 32 s → 8.5 s (3.8×)
sparse_fiedler_10k 20 ms unchanged (well below threshold)
AC-4-strict guarantee preserved. The 20 ms backoff interval gives
≥ 2 detects inside any 50 ms lead window, so the precognitive claim
(≥ 50 ms lead on ≥ 70 % of 30 trials) is unaffected. Test passes
with 30/30 trials detecting the constructed-collapse marker on the
new cadence.
AC-1 bit-exactness preserved. Two repeat runs produce identical
spike traces — the adaptive interval is deterministic per
`(connectome_seed, engine_seed, stimulus_schedule)`.
Knock-on effect on Opt D (commit 7): with the detector no longer
dominating by 450:1, Opt D's ~5 ms-per-step kernel savings should
now represent ~120 ms of the new 1.57 s median. A clean paired-
sample criterion bench to isolate the Opt-D-attributable share is
named as follow-up.
Commit arc summary at head:
Commit 2 SIMD (Opt C) 1.013× — MISS
Commit 7 Opt D delay-sorted CSR 1.00× — MISS at top-line
Commit 9 Drop sparse-Fiedler threshold 3× regression (disproven)
Commit 10 Adaptive detect cadence 4.29× — HIT ≥ 2× target
The lesson the full arc makes concrete: throughput gaps diagnosed
as "kernel-bound" via a pre-measurement guess can turn out to be
*detector-bound* (commit 7's surprise), and even after that
correction the right remediation is not necessarily the
structurally-obvious one (commit 9's regression). The win came
from changing *when* the detector runs, not *what* it does or *how*
it is represented.
All 58 tests pass. Positioning rubric held across all 10 commits.
Co-Authored-By: claude-flow <ruv@ruv.net>1 parent 3a6b70d commit 3c2377f
3 files changed
Lines changed: 77 additions & 6 deletions
File tree
- docs/adr
- examples/connectome-fly
- src/observer
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
411 | 411 | | |
412 | 412 | | |
413 | 413 | | |
414 | | - | |
415 | | - | |
| 414 | + | |
| 415 | + | |
416 | 416 | | |
417 | | - | |
| 417 | + | |
418 | 418 | | |
419 | 419 | | |
420 | 420 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
12 | | - | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| |||
201 | 202 | | |
202 | 203 | | |
203 | 204 | | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
204 | 248 | | |
205 | 249 | | |
206 | 250 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
117 | 117 | | |
118 | 118 | | |
119 | 119 | | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
120 | 146 | | |
121 | 147 | | |
122 | 148 | | |
| |||
130 | 156 | | |
131 | 157 | | |
132 | 158 | | |
133 | | - | |
| 159 | + | |
| 160 | + | |
134 | 161 | | |
135 | 162 | | |
136 | 163 | | |
| |||
0 commit comments