NumericAL
A header-only C++20 lexer built on REAL
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Static Public Attributes | Static Private Member Functions | Private Attributes | Static Private Attributes | List of all members
numerical::detail::packing_storage< T > Class Template Reference

The storage of a product's packed operands, kept by the calling thread from one product to the next. More...

#include <gemm.hpp>

Public Member Functions

 packing_storage (std::size_t a_count, std::size_t b_count)
 Room for a_count packed elements of A and b_count of B.
 
 packing_storage (const packing_storage &)=delete
 
packing_storage & operator= (const packing_storage &)=delete
 
 packing_storage (packing_storage &&)=delete
 
packing_storage & operator= (packing_storage &&)=delete
 
 ~packing_storage ()
 
T * a () const noexcept
 A's packed elements.
 
T * b () const noexcept
 B's packed elements.
 

Static Public Member Functions

static buffer< T > & kept () noexcept
 The storage this thread keeps between products.
 

Static Public Attributes

static constexpr std::size_t kept_limit {(std::size_t {32} << 20U) / sizeof(T)}
 The most elements a thread keeps between products (32 MiB).
 

Static Private Member Functions

static buffer< T > grown (buffer< T > storage, std::size_t count)
 storage with at least count elements (it only grows, so a reuse writes nothing).
 
static T * aligned (T *at) noexcept
 line_aligned.
 

Private Attributes

buffer< T > storage_
 
T * a_
 
T * b_
 

Static Private Attributes

static constexpr std::size_t padding {(packed_line / sizeof(T)) + 1}
 Elements enough to reach a line.
 

Detailed Description

template<typename T>
class numerical::detail::packing_storage< T >

The storage of a product's packed operands, kept by the calling thread from one product to the next.

A fresh allocation of megabytes is mapped anew and faulted in page by page on every product (at order 512 on twenty x86-64 threads, a product took 3.6 times as long). Each operand starts a cache line, so a vector load of a packed row never straddles two (one in two did, which cost an AVX-512 product a fifth of its speed). The storage leaves the thread's keeping while a product uses it: a product nested in another on the same thread (a scalar whose arithmetic multiplies matrices) finds none kept and takes its own. Storage past kept_limit is released, so one huge product holds no memory afterwards.

Definition at line 1496 of file gemm.hpp.

Constructor & Destructor Documentation

◆ packing_storage() [1/3]

template<typename T >
numerical::detail::packing_storage< T >::packing_storage ( std::size_t  a_count,
std::size_t  b_count 
)
inline

Room for a_count packed elements of A and b_count of B.

Definition at line 1504 of file gemm.hpp.

◆ packing_storage() [2/3]

template<typename T >
numerical::detail::packing_storage< T >::packing_storage ( const packing_storage< T > &  )
delete

◆ packing_storage() [3/3]

template<typename T >
numerical::detail::packing_storage< T >::packing_storage ( packing_storage< T > &&  )
delete

◆ ~packing_storage()

Definition at line 1516 of file gemm.hpp.

Member Function Documentation

◆ a()

template<typename T >
T * numerical::detail::packing_storage< T >::a ( ) const
inlinenoexcept

A's packed elements.

Definition at line 1522 of file gemm.hpp.

◆ aligned()

template<typename T >
static T * numerical::detail::packing_storage< T >::aligned ( T *  at)
inlinestaticprivatenoexcept

line_aligned.

Definition at line 1553 of file gemm.hpp.

◆ b()

template<typename T >
T * numerical::detail::packing_storage< T >::b ( ) const
inlinenoexcept

B's packed elements.

Definition at line 1528 of file gemm.hpp.

◆ grown()

template<typename T >
static buffer< T > numerical::detail::packing_storage< T >::grown ( buffer< T >  storage,
std::size_t  count 
)
inlinestaticprivate

storage with at least count elements (it only grows, so a reuse writes nothing).

Definition at line 1545 of file gemm.hpp.

◆ kept()

template<typename T >
static buffer< T > & numerical::detail::packing_storage< T >::kept ( )
inlinestaticnoexcept

The storage this thread keeps between products.

Definition at line 1534 of file gemm.hpp.

◆ operator=() [1/2]

◆ operator=() [2/2]

Member Data Documentation

◆ a_

template<typename T >
T* numerical::detail::packing_storage< T >::a_
private

Definition at line 1559 of file gemm.hpp.

◆ b_

template<typename T >
T* numerical::detail::packing_storage< T >::b_
private

Definition at line 1560 of file gemm.hpp.

◆ kept_limit

template<typename T >
constexpr std::size_t numerical::detail::packing_storage< T >::kept_limit {(std::size_t {32} << 20U) / sizeof(T)}
staticconstexpr

The most elements a thread keeps between products (32 MiB).

Definition at line 1501 of file gemm.hpp.

◆ padding

template<typename T >
constexpr std::size_t numerical::detail::packing_storage< T >::padding {(packed_line / sizeof(T)) + 1}
staticconstexprprivate

Elements enough to reach a line.

Definition at line 1542 of file gemm.hpp.

◆ storage_

template<typename T >
buffer<T> numerical::detail::packing_storage< T >::storage_
private

Definition at line 1558 of file gemm.hpp.


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