MTL5 -- Matrix Template Library C++ API
mtl:: -- C++20 header-only linear algebra for mixed-precision algorithm design
Loading...
Searching...
No Matches
batch.hpp File Reference
#include <cfloat>
#include <cmath>
#include <cstddef>
#include <cstdint>
#include <cstring>
#include <type_traits>
#include <mtl/detail/wrapping_arithmetic.hpp>

Classes

struct  mtl::simd::widen_accumulator< std::int16_t >
struct  mtl::simd::widen_accumulator< std::uint16_t >
struct  mtl::simd::quad_accumulator< std::int8_t, std::int8_t >
struct  mtl::simd::quad_accumulator< std::uint8_t, std::int8_t >
struct  mtl::simd::quad_accumulator< std::uint8_t, std::uint8_t >
class  mtl::simd::batch< T >
struct  mtl::simd::detail::batch_access
 The lane operations the vector math functions are built on (#654), kept out of the public batch API: round to nearest, 2^k from integral lanes, and selects on a comparison. More...

Namespaces

namespace  mtl
namespace  mtl::simd
namespace  mtl::simd::detail
 Blocking parameters for T using the compiled SIMD width and the target hardware traits.

Concepts

concept  mtl::simd::QuadPair
 Is (A, B) a quad-widening pair the hardware op accepts?

Macros

#define MTL5_SIMD_USE_HIGHWAY   0
#define MTL5_QUAD_NATIVE_U8I8   0
#define MTL5_QUAD_NATIVE_I8I8   0
#define MTL5_QUAD_NATIVE_U8U8   0

Typedefs

template<typename Narrow>
using mtl::simd::widen_accumulator_t = typename widen_accumulator<Narrow>::type
template<typename A, typename B>
using mtl::simd::quad_accumulator_t = typename quad_accumulator<A, B>::type

Enumerations

enum class  mtl::simd::quad_dot_support { mtl::simd::none , mtl::simd::partial , mtl::simd::all }
 How much of the quad multiply-accumulate this build gets natively. More...

Functions

const char * mtl::simd::backend_name () noexcept
 Name of the SIMD backend actually compiled – "scalar", or Highway's target ("AVX3_DL", "AVX2", "SSE4", "NEON", ...).
const char * mtl::simd::quad_dot_support_name () noexcept
 "NATIVE", "PARTIAL" or "DECOMPOSED" – the token a benchmark sidecar records.
constexpr std::size_t mtl::simd::vectorizable_length (std::size_t n, std::size_t w) noexcept
 Largest multiple of W not exceeding n – the SIMD body length; iterate the remainder [vectorizable_length(n) .
template<typename T>
T mtl::simd::scalar_fma (T a, T b, T c)
 The SCALAR equivalent of fma(batch,batch,batch) – what one lane of it does.

Variables

template<typename T>
constexpr bool mtl::simd::is_lane_v
 Lane types batch<T> supports.
template<typename T>
constexpr bool mtl::simd::is_integer_lane_v = is_lane_v<T> && std::is_integral_v<T>
 True for the integer lane types – the ones whose arithmetic WRAPS.
template<typename T>
constexpr bool mtl::simd::is_widenable_v
 Narrow integer types that can be WIDENED into a lane by a dot-product accumulate (#451 phase 2).
template<typename T>
constexpr bool mtl::simd::is_quad_widenable_v
 Narrow integer types whose dot product widens by FOUR into a 32-bit lane, via the hardware's quad multiply-accumulate (#451 phase 3) – VNNI's vpdpbusd on x86, SDOT/UDOT on NEON.
template<typename NA, typename NB>
constexpr bool mtl::simd::has_native_quad_dot_v = false
 Does this build have a NATIVE quad multiply-accumulate for the pairing (NA, NB), or will Highway emulate it?
template<>
constexpr bool mtl::simd::has_native_quad_dot_v< std::uint8_t, std::int8_t > = (MTL5_QUAD_NATIVE_U8I8 != 0)
template<>
constexpr bool mtl::simd::has_native_quad_dot_v< std::int8_t, std::int8_t > = (MTL5_QUAD_NATIVE_I8I8 != 0)
template<>
constexpr bool mtl::simd::has_native_quad_dot_v< std::uint8_t, std::uint8_t > = (MTL5_QUAD_NATIVE_U8U8 != 0)
constexpr quad_dot_support mtl::simd::quad_dot_native_support
constexpr bool mtl::simd::has_native_quad_dot = (quad_dot_native_support != quad_dot_support::none)
 Does this build have a native quad multiply-accumulate for ANY pairing?
template<typename T>
constexpr std::size_t mtl::simd::width = batch<T>::size
 Lane count of batch<T> for the current build (1 on the scalar fallback).

Macro Definition Documentation

◆ MTL5_QUAD_NATIVE_I8I8

#define MTL5_QUAD_NATIVE_I8I8   0

◆ MTL5_QUAD_NATIVE_U8I8

#define MTL5_QUAD_NATIVE_U8I8   0

◆ MTL5_QUAD_NATIVE_U8U8

#define MTL5_QUAD_NATIVE_U8U8   0

◆ MTL5_SIMD_USE_HIGHWAY

#define MTL5_SIMD_USE_HIGHWAY   0