MXL : Media eXchange Layer
MXL
Loading...
Searching...
No Matches
mxl::lib::fabrics::ofi::RMASampleEgressProtocolTemplate Class Referencefinal

Template for creating an Egress protocol for RMA writer endpoint to handles transferring audio data to remote targets using remote write operations. More...

#include <ProtocolEgressRMA.hpp>

Inheritance diagram for mxl::lib::fabrics::ofi::RMASampleEgressProtocolTemplate:
Collaboration diagram for mxl::lib::fabrics::ofi::RMASampleEgressProtocolTemplate:

Public Member Functions

virtual std::unique_ptr< EgressProtocol > createInstance (Completion::Token, TargetInfo remoteInfo) override
 Create a new instance of the protocol for a remote target.
virtual void registerMemory (std::shared_ptr< Domain > domain) override
 Register memory required by the protocol.
 RMASampleEgressProtocolTemplate (DataLayout::Continuous layout, Region region)
Public Member Functions inherited from mxl::lib::fabrics::ofi::EgressProtocolTemplate
virtual ~EgressProtocolTemplate ()=default

Private Attributes

DataLayout::Continuous _layout
std::optional< LocalRegion > _localRegion
Region _region

Detailed Description

Template for creating an Egress protocol for RMA writer endpoint to handles transferring audio data to remote targets using remote write operations.

Definition at line 147 of file ProtocolEgressRMA.hpp.

Constructor & Destructor Documentation

◆ RMASampleEgressProtocolTemplate()

mxl::lib::fabrics::ofi::RMASampleEgressProtocolTemplate::RMASampleEgressProtocolTemplate ( DataLayout::Continuous layout,
Region region )

Member Function Documentation

◆ createInstance()

std::unique_ptr< EgressProtocol > mxl::lib::fabrics::ofi::RMASampleEgressProtocolTemplate::createInstance ( Completion::Token token,
TargetInfo remoteInfo )
overridevirtual

Create a new instance of the protocol for a remote target.

Implements mxl::lib::fabrics::ofi::EgressProtocolTemplate.

Definition at line 296 of file ProtocolEgressRMA.cpp.

297 {
298 if (!_localRegion)
299 {
300 throw Exception::invalidState("Cannot create protocol before memory is registered.");
301 }
302
303 if (!remoteInfo.bounceBufferInfo)
304 {
305 throw Exception::invalidArgument("Remote target does not have bounce buffer info required for sample egress protocol.");
306 }
307
308 struct MakeUniqueEnabler : RMASampleEgressProtocol
309 {
310 MakeUniqueEnabler(Completion::Token token, TargetInfo info, DataLayout::Continuous layout, LocalRegion localRegion,
311 std::uint32_t bounceBufferEntryCount)
312 : RMASampleEgressProtocol{token, std::move(info), layout, localRegion, bounceBufferEntryCount}
313 {}
314 };
315
316 return std::make_unique<MakeUniqueEnabler>(token, std::move(remoteInfo), _layout, *_localRegion, remoteInfo.bounceBufferInfo->entryCount);
317 };
static Exception invalidArgument(fmt::format_string< T... > fmt, T &&... args)
Make an MXL_ERR_INVALID_ARG exception.
Definition Exception.hpp:43
static Exception invalidState(fmt::format_string< T... > fmt, T &&... args)
Make an MXL_ERR_INVALID_STATE exception.
Definition Exception.hpp:59

◆ registerMemory()

void mxl::lib::fabrics::ofi::RMASampleEgressProtocolTemplate::registerMemory ( std::shared_ptr< Domain > domain)
overridevirtual

Register memory required by the protocol.

Implements mxl::lib::fabrics::ofi::EgressProtocolTemplate.

Definition at line 276 of file ProtocolEgressRMA.cpp.

277 {
278 // This function should be called once during setup and be the first memory to register, otherwise it's a bug.
279 if (_localRegion)
280 {
281 throw Exception::invalidState("Memory already registered.");
282 }
283 if (!domain->localRegions().empty())
284 {
285 throw Exception::invalidState("No memory should be previously registered.");
286 }
287
288 // Register the audio region provided by the user. When the actual protocol instance is created, the protocol will register additional
289 // regions for the bounce buffer entry headers, but we can only do that once we have the actual protocol instance since the bounce buffer
290 // entry count is a parameter of the protocol instance.
291 domain->registerRegion(_region, FI_WRITE);
292
293 _localRegion = domain->localRegions().front();
294 }

Member Data Documentation

◆ _layout

DataLayout::Continuous mxl::lib::fabrics::ofi::RMASampleEgressProtocolTemplate::_layout
private

Definition at line 156 of file ProtocolEgressRMA.hpp.

◆ _localRegion

std::optional<LocalRegion> mxl::lib::fabrics::ofi::RMASampleEgressProtocolTemplate::_localRegion
private

Registered local region corresponding to the user provided region. This is what will actually be used for remote writes.

Definition at line 158 of file ProtocolEgressRMA.hpp.

◆ _region

Region mxl::lib::fabrics::ofi::RMASampleEgressProtocolTemplate::_region
private

Region provided by the user.

Definition at line 157 of file ProtocolEgressRMA.hpp.


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