MTL5 -- Matrix Template Library C++ API
mtl:: -- C++20 header-only linear algebra for mixed-precision algorithm design
Loading...
Searching...
No Matches
blocking.hpp File Reference
#include <cstddef>
#include <cstdlib>
#include <limits>
#include <mtl/simd/batch.hpp>
#include <mtl/util/cache_info.hpp>

Classes

struct  mtl::simd::hw_traits
 Hardware description for blocking-parameter derivation. All sizes in bytes. More...
struct  mtl::simd::blocking_params
 GEMM blocking parameters: mr x nr register microtile, kc/mc/nc cache blocks. 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.

Enumerations

enum class  mtl::simd::detect_levels : unsigned { mtl::simd::none = 0u , mtl::simd::l1 = 1u << 0 , mtl::simd::l2 = 1u << 1 , mtl::simd::both = l1 | l2 }
 target_hw_traits with the CACHE fields replaced by what the running machine reports (#222). More...

Functions

bool mtl::simd::detail::env_block_size (const char *name, std::size_t &out)
 A blocking override from environment variable name: a whole positive decimal that fits in std::size_t (digits only, no sign, space or trailing characters); false otherwise, and the derived value stays.
constexpr std::size_t mtl::simd::detail::ceil_div (std::size_t a, std::size_t b)
constexpr std::size_t mtl::simd::detail::round_up (std::size_t n, std::size_t m)
constexpr std::size_t mtl::simd::detail::round_down (std::size_t n, std::size_t m)
constexpr std::size_t mtl::simd::detail::isqrt_ceil (std::size_t n)
constexpr std::size_t mtl::simd::target_vec_registers ()
 The architectural vector register file of the build's target ISA (#643).
template<typename T>
constexpr blocking_params mtl::simd::derive_blocking (std::size_t nvec, const hw_traits &hw=default_hw_traits)
 Derive GEMM blocking parameters for element type T with nvec SIMD lanes (e.g.
template<typename T>
constexpr blocking_params mtl::simd::detail::default_blocking_for_target ()
constexpr detect_levels mtl::simd::operator| (detect_levels a, detect_levels b)
constexpr bool mtl::simd::has_level (detect_levels set, detect_levels one)
constexpr hw_traits mtl::simd::with_detected_caches (hw_traits base, const util::cache_info &c, detect_levels lv=detect_levels::both)
 Overlay the detected hierarchy on base, one level group at a time.
constexpr detect_levels mtl::simd::configured_detect_levels ()
 The levels this translation unit was compiled to detect.
const hw_traits & mtl::simd::detected_hw_traits ()
 Runtime cache detection is OPT-IN: define MTL5_ENABLE_CACHE_DETECTION to let the detected hierarchy feed kc/mc.
template<typename T>
const blocking_params & mtl::simd::runtime_blocking ()
 Blocking parameters for T derived against the DETECTED hardware.

Variables

constexpr hw_traits mtl::simd::default_hw_traits
 Generic modern-x86 (AVX2-class) default; override per architecture.
constexpr hw_traits mtl::simd::target_hw_traits
 The hardware description default_blocking and detected_hw_traits start from: default_hw_traits, with the register file and accumulator budget MEASURED for the target ISA (#643).
template<typename T>
constexpr blocking_params mtl::simd::default_blocking = detail::default_blocking_for_target<T>()