MTL5 -- Matrix Template Library C++ API
mtl:: -- C++20 header-only linear algebra for mixed-precision algorithm design
Loading...
Searching...
No Matches
mtl::util::cache_info Struct Reference

Detected data-cache hierarchy, in bytes. More...

#include <cache_info.hpp>

Public Attributes

std::size_t l1d_bytes = 0
 L1 DATA cache (never the I-cache).
std::size_t l1d_assoc = 0
 L1d ways.
std::size_t l1d_sharing_cores = 0
 physical cores sharing it (0 = unknown)
std::size_t l2_bytes = 0
std::size_t l2_sharing_cores = 0
std::size_t l3_bytes = 0
 0 is legitimate: many parts have none
std::size_t l3_sharing_cores = 0
std::size_t line_bytes = 0

Detailed Description

Detected data-cache hierarchy, in bytes.

0 = not detected.

*_bytes is the cache's TOTAL size as the hardware reports it, and *_sharing_cores is how many distinct PHYSICAL cores share that instance, so the per-core budget a model should use is bytes / sharing_cores. The two are reported separately rather than pre-divided: this struct describes the machine, and how to spend a shared cache is a modelling decision that belongs with the model (simd::with_detected_caches makes it).

Sharing is counted in CORES, not logical CPUs, and the difference is not pedantic. An SMT pair shares its L1d and L2, so counting CPUs would halve both on any hyperthreaded machine – while the benchmark pinning policy runs one thread per physical core and leaves the sibling idle. Counting cores gives 1 there (no division) and 4 for a 4-core E-cluster sharing one L2, which is the case that actually needs discounting.

Member Data Documentation

◆ l1d_assoc

std::size_t mtl::util::cache_info::l1d_assoc = 0

L1d ways.

◆ l1d_bytes

std::size_t mtl::util::cache_info::l1d_bytes = 0

L1 DATA cache (never the I-cache).

◆ l1d_sharing_cores

std::size_t mtl::util::cache_info::l1d_sharing_cores = 0

physical cores sharing it (0 = unknown)

◆ l2_bytes

std::size_t mtl::util::cache_info::l2_bytes = 0

◆ l2_sharing_cores

std::size_t mtl::util::cache_info::l2_sharing_cores = 0

◆ l3_bytes

std::size_t mtl::util::cache_info::l3_bytes = 0

0 is legitimate: many parts have none

◆ l3_sharing_cores

std::size_t mtl::util::cache_info::l3_sharing_cores = 0

◆ line_bytes

std::size_t mtl::util::cache_info::line_bytes = 0

The documentation for this struct was generated from the following file: