Skip to content

Cache A2 prewarm state - #319

Merged
sdatkinson merged 3 commits into
mainfrom
318-a2-cache-prewarm
Aug 9, 2026
Merged

Cache A2 prewarm state#319
sdatkinson merged 3 commits into
mainfrom
318-a2-cache-prewarm

Conversation

@sdatkinson

@sdatkinson sdatkinson commented Aug 9, 2026

Copy link
Copy Markdown
Owner

Summary

  • cache one steady-state input sample for each A2 convolution and rebuild ring histories from it on later prewarms
  • support both the specialized A2-fast implementation and the unconditioned generic WaveNet fallback
  • preserve full silence processing for conditioned WaveNets, whose nested DSP state cannot be reconstructed from convolution caches alone
  • use the correct A2-Lite and A2-Full terminology throughout the fast-path code, tests, and benchmark output

Tests

  • cmake --build build --target run_tests -j4 && ./build/tools/run_tests
  • full debug suite with NAM_ENABLE_A2_FAST=OFF
  • full debug suite with NAM_A2_RING_MODE=0
  • A2-Lite and A2-Full tests first prewarm through legacy silence processing, process more than a full receptive field of audio, restore the cached prewarm state without allocations, and require exactly identical output when processing the same audio again; both A2-fast and generic WaveNet paths are covered

Resolves #318

@sdatkinson
sdatkinson force-pushed the 318-a2-cache-prewarm branch from eed9ee7 to 36f3e89 Compare August 9, 2026 22:08
@sdatkinson

Copy link
Copy Markdown
Owner Author

Performance metrics on my M1:

Model Old code: 100 resets New code: 100 resets Per reset, old → new Speedup
A2-Lite 72.981 ms 0.859 ms 729.81 → 8.59 µs 85.0×
A2-Full 517.224 ms 1.123 ms 5,172.24 → 11.23 µs 460.6×

@sdatkinson
sdatkinson merged commit daae2d0 into main Aug 9, 2026
4 checks passed
@sdatkinson
sdatkinson deleted the 318-a2-cache-prewarm branch August 9, 2026 22:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

A2-fast: cache prewarm state

1 participant