rexlib 0.1.0
Device-agnostic array computing library for CryoEM and CryoET image processing, with a pluggable backend architecture
Loading...
Searching...
No Matches
Public Member Functions | List of all members
rexlib::program_scratch_requirement Class Reference

Describes a scratch buffer requirement for program execution. More...

#include <rexlib/core/hardware/program_scratch_requirement.hpp>

Public Member Functions

 program_scratch_requirement (std::size_t size, std::size_t alignment, memory_resource_affinity affinity) noexcept
 Constructs a scratch buffer requirement.
 
 program_scratch_requirement (const program_scratch_requirement &other)=default
 
 program_scratch_requirement (program_scratch_requirement &&other)=default
 
program_scratch_requirement & operator= (const program_scratch_requirement &other)=default
 
program_scratch_requirement & operator= (program_scratch_requirement &&other)=default
 
std::size_t get_size () const noexcept
 Returns the required scratch buffer size in bytes.
 
std::size_t get_alignment () const noexcept
 Returns the required alignment in bytes for the scratch buffer.
 
memory_resource_affinity get_affinity () const noexcept
 Returns the memory affinity for the scratch buffer.
 

Detailed Description

Describes a scratch buffer requirement for program execution.

A program may require scratch (temporary) memory buffers during execution. This class encapsulates a single scratch buffer requirement, specifying:

This is an immutable value object. Once constructed, its properties cannot be changed. Instances are typically lightweight and efficiently copied or moved.

Constructor & Destructor Documentation

◆ program_scratch_requirement()

rexlib::program_scratch_requirement::program_scratch_requirement ( std::size_t  size,
std::size_t  alignment,
memory_resource_affinity  affinity 
)
noexcept

Constructs a scratch buffer requirement.

Parameters
sizeSize in bytes of the required scratch buffer.
alignmentRequired alignment in bytes for the scratch buffer. Must be a power of two.
affinityWhere the memory should be allocated.
Note
The constructor does not validate that alignment is a power of two; callers are responsible for providing valid values.

Member Function Documentation

◆ get_affinity()

memory_resource_affinity rexlib::program_scratch_requirement::get_affinity ( ) const
noexcept

Returns the memory affinity for the scratch buffer.

Returns
memory_resource_affinity indicating whether the buffer should be allocated for host or device access.

◆ get_alignment()

std::size_t rexlib::program_scratch_requirement::get_alignment ( ) const
noexcept

Returns the required alignment in bytes for the scratch buffer.

Returns
Alignment in bytes (a power of two).

◆ get_size()

std::size_t rexlib::program_scratch_requirement::get_size ( ) const
noexcept

Returns the required scratch buffer size in bytes.

Returns
Size in bytes.

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