|
rexlib 0.1.0
Device-agnostic array computing library for CryoEM and CryoET image processing, with a pluggable backend architecture
|
Represents an untyped memory allocation at a given memory resource. More...
#include <rexlib/core/hardware/buffer.hpp>
Public Member Functions | |
| buffer (const buffer &other)=delete | |
| buffer (buffer &&other) noexcept=delete | |
| buffer & | operator= (const buffer &other)=delete |
| buffer & | operator= (buffer &&other) noexcept=delete |
| virtual void * | get_host_ptr () noexcept=0 |
| Get a host accessible pointer to the data. | |
| virtual const void * | get_host_ptr () const noexcept=0 |
| Get a host accessible pointer to the data. | |
| virtual std::size_t | get_size () const noexcept=0 |
| Get the size in bytes for this buffer. | |
| virtual const memory_resource & | get_memory_resource () const noexcept=0 |
| Get the memory resource where this buffer is stored. | |
Represents an untyped memory allocation at a given memory resource.
A buffer is a handle to a contiguous block of memory. It carries no type information of its own.
Get a host accessible pointer to the data.
Const overload of get_host_ptr(); see that method for the conditions under which a non-null pointer is returned and the lifetime/synchronization guarantees that apply.
nullptr if the buffer is not host accessible. Get a host accessible pointer to the data.
This method only returns a non-null pointer if the data is directly addressable by the host, i.e. when the kind of the underlying memory_resource is one of: device_mapped, host_staging, host, unified or managed. For pure device-only resources the buffer must be transferred to a host-accessible buffer first.
The returned pointer is valid for as long as this buffer instance is alive and is aligned to the alignment requested at allocation time. Reads or writes through it may need to be preceded by appropriate synchronization with any in-flight device-side work that uses the same buffer.
nullptr if the buffer is not host accessible.
|
pure virtualnoexcept |
Get the memory resource where this buffer is stored.
|
pure virtualnoexcept |
Get the size in bytes for this buffer.
The size may be larger then the requested in memory_allocator::allocate.