MXL : Media eXchange Layer
MXL
Loading...
Searching...
No Matches
mxl::lib::fabrics::ofi::LocalRegion Struct Reference

Represent a source memory region used for for data transfer. More...

#include <LocalRegion.hpp>

Public Member Functions

LocalRegion sub (std::uint64_t offset, std::size_t length) const
 Create a sub-region of this LocalRegion.
::iovec toIovec () const noexcept
 Convert this LocalRegion to a struct iovec used by libfabric transfer functions.

Public Attributes

std::uint64_t addr
void * desc
std::size_t len

Detailed Description

Represent a source memory region used for for data transfer.

This can be constructed directly if no memory registration is needed. Otherwise, it can be generated from a RegisteredRegion.

Definition at line 21 of file LocalRegion.hpp.

Member Function Documentation

◆ sub()

LocalRegion mxl::lib::fabrics::ofi::LocalRegion::sub ( std::uint64_t offset,
std::size_t length ) const
nodiscard

Create a sub-region of this LocalRegion.

Parameters
offsetThe offset within this region where the sub-region starts.
lengthThe length of the sub-region.
Returns
A new LocalRegion representing the specified sub-region.

Definition at line 13 of file LocalRegion.cpp.

14 {
15 if (offset + length > len)
16 {
17 throw Exception::invalidState("Tried to access out-of-bounds sub region of LocalRegion");
18 }
19
20 return LocalRegion{
21 .addr = addr + offset,
22 .len = length,
23 .desc = desc,
24 };
25 }
static Exception invalidState(fmt::format_string< T... > fmt, T &&... args)
Make an MXL_ERR_INVALID_STATE exception.
Definition Exception.hpp:59

◆ toIovec()

iovec mxl::lib::fabrics::ofi::LocalRegion::toIovec ( ) const
nodiscardnoexcept

Convert this LocalRegion to a struct iovec used by libfabric transfer functions.

Definition at line 27 of file LocalRegion.cpp.

28 {
29 return ::iovec{.iov_base = reinterpret_cast<void*>(addr), .iov_len = len}; // NOLINT(performance-no-int-to-ptr): No way to avoid this
30 }

Member Data Documentation

◆ addr

std::uint64_t mxl::lib::fabrics::ofi::LocalRegion::addr

Definition at line 39 of file LocalRegion.hpp.

◆ desc

void* mxl::lib::fabrics::ofi::LocalRegion::desc

Definition at line 41 of file LocalRegion.hpp.

◆ len

std::size_t mxl::lib::fabrics::ofi::LocalRegion::len

Definition at line 40 of file LocalRegion.hpp.


The documentation for this struct was generated from the following files: