Skip to content

Commit cefcad1

Browse files
Update performance notes
1 parent e426920 commit cefcad1

1 file changed

Lines changed: 36 additions & 21 deletions

File tree

development/flow/PERFORMANCE_NOTES.md

Lines changed: 36 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,28 @@ Kept so these avenues are not blindly re-attempted.
365365
regressed the EPYC 3D fixture by about 5% at 1T and 2% at 8T. The warm-kernel
366366
counter run reported only about 1.45% L1-data load misses, so the extra
367367
prefetch instructions cost more than the avoided demand-load latency.
368+
- **Next-sample software prefetching** (closed after the `perf` gate,
369+
2026-07-13; not implemented). A production, plain-flag build of `e426920` was
370+
measured on an AMD EPYC 7513 (Zen 3) with the registered 3D fixture, pinned to
371+
one core. Each `perf stat -r 3` process loaded the fixture once, made one warm
372+
kernel call, then made eight more calls; process setup and loading were
373+
included but amortized by the repeated kernel work. The performance governor
374+
was active (boost remained enabled), so cycles and counter repeatability were
375+
used as the gate rather than wall time alone.
376+
- Measurement noise was low enough for the decision: cycles varied by
377+
0.03--0.12% and wall time by 0.3--0.7% across the three runs.
378+
- The warm process sustained 2.77 instructions/cycle. L1 data-load misses
379+
were about 1.54% (roughly 500 million misses from 32.3 billion loads).
380+
- Of the observed demand data reads reaching L2, about 453.5 million hit and
381+
19.5 million missed (approximately a 4.1% L2 miss rate). An L2 fill was
382+
pending for roughly 7% of counted cycles; this is an upper bound on cycles
383+
prefetching might overlap, not a direct stall measurement.
384+
These counters do not show enough residual cache-miss cost to justify the
385+
extra instructions and code complexity. The existing 3-way RK2 interleave
386+
already overlaps independent load chains, current-sample prefetching regressed
387+
on this CPU, and a next-iteration address is only known late in the dependent
388+
trajectory update. The prefetch target is therefore closed unless a future
389+
workload or architecture supplies contrary profile evidence.
368390
- **Interleaved (channel-last) layout + hand-written AVX2 FMA** (earlier, rolled
369391
back, 2026-06-12) — codegen was confirmed optimal via `objdump` (8× packed
370392
`vfmadd132ps`, zero gathers) yet was no faster than scalar, and `VS=4` padding
@@ -416,27 +438,20 @@ Kept so these avenues are not blindly re-attempted.
416438
now propagated through `trace_particle` (landed; instruction streams verified
417439
identical to the pre-change build in both TUs).
418440

419-
## What remains worth trying
420-
421-
Lower priority than the landed work; all need a fixed-clock host with `perf`
422-
(the Tiger Lake laptop's ~±8 % thermal-throttle noise swamps sub-10 % effects).
423-
424-
1. **Software prefetching of the next sample's cache lines.** Targets the residual
425-
load latency on the existing channel-first layout. Expected modest; the failed
426-
16-block experiment shows added machinery to expose independent loads can lose
427-
more than it gains, so measure carefully. The rejected midpoint-reuse
428-
experiment further weakens this idea: eliminating half the per-step loads
429-
outright bought only ~2–3 % at 1T, so the loads are already latency-hidden.
430-
2. **A real `perf stat`** around a warm-kernel harness (fixture loaded once,
431-
several kernel calls) to confirm where the remaining cycles go (front-end vs
432-
back-end memory vs back-end core) and to provide a low-noise environment for
433-
evaluating (1).
434-
3. **Cross-architecture confirmation** on macOS x86-64 and Windows x86-64 for
435-
the FMA dispatch, plus the truncation gain magnitude on arm64 (macOS
436-
AppleClang and Linux aarch64). The particle-major and direct-interpolation
437-
gains are portable C++20; the x86 dispatch is compiler-specific and the
438-
truncation magnitude depends on how `floor` is lowered without SSE4.1 / on
439-
the arm equivalent.
441+
## Optimization status and future validation
442+
443+
The 2026-07-13 Zen 3 counter run completed the final `perf` gate and did not
444+
support another kernel implementation experiment. Flow-density optimization is
445+
concluded for now at `e426920`; reopen it only for a demonstrated regression, a
446+
new representative workload, or hardware-counter evidence of a substantial
447+
bottleneck not covered above.
448+
449+
Cross-architecture validation remains useful but is not an active optimization
450+
target: confirm the FMA dispatch on macOS x86-64 and Windows x86-64, and confirm
451+
the truncation gain magnitude on arm64 (macOS AppleClang and a Linux arm64 wheel
452+
environment). The particle-major and direct-interpolation changes are portable
453+
C++20; the x86 dispatch is compiler-specific and the truncation magnitude can
454+
vary with how `floor` is lowered on each target.
440455

441456
## Reproducing these measurements
442457

0 commit comments

Comments
 (0)