Hardware flush-to-zero RAII guard for the audio callback boundary. More...
#include <cstdint>Go to the source code of this file.
Classes | |
| class | pulp::signal::ScopedFlushDenormals |
Namespaces | |
| namespace | pulp |
| namespace | pulp::signal |
| namespace | pulp::signal::detail |
| Round-2 effect-wave vocabulary. | |
Functions | |
| bool | pulp::signal::denormals_are_flushed () noexcept |
Variables | |
| constexpr bool | pulp::signal::kHardwareFlushSupported = false |
| True when this build sets the hardware flush-to-zero mode. | |
Hardware flush-to-zero RAII guard for the audio callback boundary.
Denormal (subnormal) floating-point values cause severe CPU stalls when they enter recursive DSP state — IIR/SVF filter memory, reverb and delay feedback, envelope tails. pulp::signal::snap_to_zero (denormal.hpp) fixes this per-value where DSP opts in, but it cannot protect code that forgets to call it. ScopedFlushDenormals sets the CPU's flush-to-zero mode for the lifetime of the scope so every operation flushes denormal results to zero, then restores the caller's previous mode on exit.
Wrap the audio callback body (alongside runtime::ScopedNoAlloc):
This is part of Pulp's numeric-mode policy; see docs/guides/dsp-threading.md ("Numeric mode: denormals & determinism").
Intended usage: wrap the audio callback boundary — a region whose body is an opaque function call such as Processor::process(). Setting the FP mode is not a compiler reordering barrier for FP arithmetic, so do not rely on it around arbitrary inline DSP in the same function; the compiler may schedule such arithmetic across the mode change. An opaque call in between (the normal case) prevents that hoisting. For inline recursive math, use snap_to_zero (denormal.hpp) instead/as well.
Platform coverage: