Skip to content

v0.4.1 — a much faster block path, and an LSTM audio-thread panic fixed

Choose a tag to compare

@OpenSauce OpenSauce released this 30 Nov 00:07
· 28 commits to main since this release
3934e70

A performance release: the block path is roughly 3× faster on WaveNet and 2× faster on LSTM, with no API change. It also fixes a panic on the audio thread.

Performance

process_buffer is much faster on both architectures (#59, thanks to @sreichholf):

Model (512-sample blocks) 0.4.0 0.4.1
WaveNet, standard ~1.02 ms ~0.34 ms
LSTM, standard ~0.65 ms ~0.31 ms

Measured with cargo bench on one core of a Ryzen 7 9800X3D (x86-64, AVX2). Numbers vary with CPU and model size.

What changed underneath:

  • the block conv keeps one linear history row per input channel and computes outputs in register-sized tiles
  • tanh and sigmoid are vectorizable approximations
  • the LSTM stores its gate matrix transposed
  • on x86-64, the conv, activation and gating loops dispatch at run time to an AVX2 build when the CPU has it; no compiler flags are needed

process_sample on WaveNet is a few percent slower. Prefer whole blocks.

Fixed

  • An LSTM model with input_size != 1 used to construct successfully and then panic on the audio thread. It is now rejected at construction with Error::UnsupportedFeature (#56).
  • A .nam file with an architecture this crate does not implement is now reported as an unsupported architecture instead of a JSON error (#50).

Added

Model gains forwarding accessors, so a host no longer needs to keep the NamModel around for them (#51): expected_sample_rate(), loudness(), input_level_dbu(), output_level_dbu().

Compatibility

No breaking changes; nothing public was removed or changed.

Audio output is not bit-identical to 0.4.0, because of the new tanh and sigmoid. It moves by under 1e-6 on the fixture models driven at 0 dBFS, and the measured error against the reference is unchanged, well inside the 1e-5 parity tolerance. The real-time-safety contract is unaffected.

The declared MSRV is lowered from 1.74 to 1.71 (#53).

The aarch64 (NEON-width) path is not exercised by CI.