Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
lanes.hpp File Reference

Fixed-width register lanes for per-sample recursive kernels. More...

#include <cstddef>
#include <type_traits>

Go to the source code of this file.

Namespaces

namespace  pulp
namespace  pulp::simd

Macros

#define PULP_SIMD_HAS_VECTOR_LANES   0

Functions

template<typename V>
auto pulp::simd::get_lane (const V &v, std::size_t i) noexcept
 Lane i of v; a scalar is its own lane 0.
template<typename V, typename T>
void pulp::simd::set_lane (V &v, std::size_t i, T x) noexcept
 Set lane i of v to x; a scalar is its own lane 0.

Variables

constexpr bool pulp::simd::kHasVectorLanes = false
template<typename V>
constexpr std::size_t pulp::simd::lane_count
 Number of lanes in V: 1 for a scalar, N for Lanes<T, N>.

Detailed Description

Fixed-width register lanes for per-sample recursive kernels.

A recursive filter cannot vectorize along time, but independent channels or sections can share one register: Lanes<float, 2> holds a left and a right recursion side by side, and ordinary + - * act on each lane. Every lane runs exactly the scalar operation sequence, so each lane's result is bit-identical to the scalar code (subject to the same FMA contraction).

These are GNU vector extensions (GCC and Clang), not Highway. Highway is a private dependency of the compiled pulp-simd kernels, so header-only code such as the DSP layer cannot include it; and its API is shaped for loops over arrays with run-time dispatch, whereas a recursion needs a fixed-width value that stays in a register across a whole per-sample loop and inlines into the caller. Compilers without the extension (MSVC) do not define Lanes; kHasVectorLanes (and the PULP_SIMD_HAS_VECTOR_LANES macro, for preprocessor guards) is false there and callers run each lane as a scalar instead. Defining PULP_SIMD_DISABLE_VECTOR_LANES selects that fallback on GCC and Clang too, so its parity can be tested where the extension exists; a program must define it in every translation unit or in none.

Whether multiply-adds are fused follows the translation unit's floating- point contraction policy; see tools/cmake/PulpFloatingPointContraction.cmake.

Macro Definition Documentation

◆ PULP_SIMD_HAS_VECTOR_LANES

#define PULP_SIMD_HAS_VECTOR_LANES   0