|
NumericAL
A header-only C++20 lexer built on REAL
|
The allocator of numerical::buffer. An element constructed with no value is default-initialised, so a double keeps whatever its memory held, where std::allocator zeroes it; one constructed with a value is constructed from it. A result written in full is then written once, by the threads that compute it, not zeroed first on one of them (a product of order 512 on eight arm64 threads spent a fifth of its time in that zeroing).
More...
#include <buffer.hpp>
Classes | |
| struct | rebind |
| The allocator of another element type, as std::allocator_traits rebinds it. More... | |
Public Types | |
| using | value_type = T |
| The element type. | |
Public Member Functions | |
| default_init_allocator () noexcept=default | |
| template<typename U > | |
| false | default_init_allocator (const default_init_allocator< U > &) noexcept |
| From the allocator of another element type: stateless, as std::allocator. | |
| T * | allocate (std::size_t n) |
n elements: on huge pages from their least bytes on Linux, in a kept block of 4 KiB pages from kept_pages_least, else std::allocator's; a block's size and the data's distance from its start kept before the data. | |
| void | deallocate (T *at, std::size_t n) noexcept |
Frees what allocate gave for n elements. | |
| template<typename U > requires (!is_complex_number<U>) | |
| void | construct (U *at) noexcept(std::is_nothrow_default_constructible_v< U >) |
Default-initialises the element at at. | |
| template<typename U > requires is_complex_number<U> | |
| void | construct (U *at) noexcept |
construct of a complex number, whose default constructor zeroes: left as its memory holds it, as a double is (an implicit-lifetime type: trivial copies and destructor), so that a complex result written in full is written once (a complex128 product of 914 × 337 spent 172 of its 414 µs zeroing it). Built without NDEBUG, it holds NaN parts instead, so that code that relied on zeros fails. | |
| template<typename U , typename ... Args> | |
| void | construct (U *at, Args &&... args) |
Constructs the element at at from args. | |
Static Public Member Functions | |
| static constexpr bool | on_kept_pages (std::size_t n) noexcept |
Whether n elements take a block of 4 KiB pages kept when freed (kept_page_blocks): from kept_pages_least bytes and under kept_pages_largest (from it, on Linux, huge pages). | |
| static T * | placed (std::byte *start, std::size_t offset, std::size_t bytes) noexcept |
The data at offset into the block at start of bytes, the offset and the size kept before it. | |
| template<typename Kept > | |
| static void | deallocate_kept (T *at) noexcept |
Frees the block allocate gave from at, kept by Kept where it takes it. Out of line: inlined where a small buffer's size is known (a QR's columns of 40 complex numbers), GCC 14 took the read before at for one past the buffer's bounds (-Warray-bounds), though a buffer of that size never comes here. | |
Static Public Attributes | |
| static constexpr std::size_t | page_colours {16} |
| The data's offset past a kept block's start goes round 16 multiples of 256 bytes past a cache line that holds the block's size and the offset: blocks all page-aligned fall on the same cache sets. | |
The allocator of numerical::buffer. An element constructed with no value is default-initialised, so a double keeps whatever its memory held, where std::allocator zeroes it; one constructed with a value is constructed from it. A result written in full is then written once, by the threads that compute it, not zeroed first on one of them (a product of order 512 on eight arm64 threads spent a fifth of its time in that zeroing).
Definition at line 253 of file buffer.hpp.
The element type.
Definition at line 255 of file buffer.hpp.
|
defaultnoexcept |
|
inlineexplicitnoexcept |
From the allocator of another element type: stateless, as std::allocator.
Definition at line 269 of file buffer.hpp.
|
inline |
n elements: on huge pages from their least bytes on Linux, in a kept block of 4 KiB pages from kept_pages_least, else std::allocator's; a block's size and the data's distance from its start kept before the data.
Definition at line 312 of file buffer.hpp.
|
inlinenoexcept |
construct of a complex number, whose default constructor zeroes: left as its memory holds it, as a double is (an implicit-lifetime type: trivial copies and destructor), so that a complex result written in full is written once (a complex128 product of 914 × 337 spent 172 of its 414 µs zeroing it). Built without NDEBUG, it holds NaN parts instead, so that code that relied on zeros fails.
Definition at line 406 of file buffer.hpp.
|
inlinenoexcept |
Default-initialises the element at at.
Definition at line 395 of file buffer.hpp.
|
inline |
Constructs the element at at from args.
Definition at line 418 of file buffer.hpp.
|
inlinenoexcept |
Frees what allocate gave for n elements.
Definition at line 346 of file buffer.hpp.
|
inlinestaticnoexcept |
Frees the block allocate gave from at, kept by Kept where it takes it. Out of line: inlined where a small buffer's size is known (a QR's columns of 40 complex numbers), GCC 14 took the read before at for one past the buffer's bounds (-Warray-bounds), though a buffer of that size never comes here.
Definition at line 379 of file buffer.hpp.
|
inlinestaticconstexprnoexcept |
Whether n elements take a block of 4 KiB pages kept when freed (kept_page_blocks): from kept_pages_least bytes and under kept_pages_largest (from it, on Linux, huge pages).
Definition at line 304 of file buffer.hpp.
|
inlinestaticnoexcept |
The data at offset into the block at start of bytes, the offset and the size kept before it.
Definition at line 363 of file buffer.hpp.
|
staticconstexpr |
The data's offset past a kept block's start goes round 16 multiples of 256 bytes past a cache line that holds the block's size and the offset: blocks all page-aligned fall on the same cache sets.
Definition at line 300 of file buffer.hpp.