Loading...
Searching...
No Matches
gpr::linalg::canonical::AlignedBuffer Class Reference

#include <gpr/linalg/CanonicalTriangular.h>

Public Member Functions

const double * data () const noexcept
double * reserve (std::size_t count)

Static Public Member Functions

static std::size_t padded (std::size_t count) noexcept
 Doubles a packed tile of count entries occupies.

Detailed Description

Growable 64-byte aligned storage for packed tiles. A tile packed at an offset that is a multiple of eight doubles, with its row count as leading dimension, has the address alignment and layout of an AlignedTile, so a tile kernel reads it in place and rounds as it would on a copy.

Definition at line 234 of file CanonicalTriangular.h.

Member Function Documentation

◆ data()

const double * gpr::linalg::canonical::AlignedBuffer::data ( ) const
inlinenodiscardnoexcept

Definition at line 241 of file CanonicalTriangular.h.

242 {
243 return storage_.get();
244 }

◆ padded()

std::size_t gpr::linalg::canonical::AlignedBuffer::padded ( std::size_t count)
inlinestaticnoexcept

Doubles a packed tile of count entries occupies.

Definition at line 237 of file CanonicalTriangular.h.

238 {
239 return (count + 7) / 8 * 8;
240 }

◆ reserve()

double * gpr::linalg::canonical::AlignedBuffer::reserve ( std::size_t count)
inline

Storage for at least count doubles; contents are not preserved when the buffer grows.

Definition at line 248 of file CanonicalTriangular.h.

249 {
250 if (count > capacity_ || !storage_) {
251 const std::size_t doubles = padded(std::max<std::size_t>(count, 1));
252 storage_.reset(static_cast<double*>(
253 std::aligned_alloc(64, doubles * sizeof(double))));
254 if (!storage_) throw std::bad_alloc();
255 capacity_ = doubles;
256 }
257 return storage_.get();
258 }
static std::size_t padded(std::size_t count) noexcept
Doubles a packed tile of count entries occupies.

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