|
MXL : Media eXchange Layer
MXL
|
An initiator that uses reliable datagram (RDM) endpoints for data transfers. More...
#include <RDMInitiator.hpp>


Public Member Functions | |
| virtual void | addTarget (TargetInfo const &remoteTargetInfo) final |
| Add a target to the initiator. | |
| virtual Initiator::MakeProgressResult | makeProgress () final |
| Attempts to progress execution, including connection management and data operations. | |
| virtual Initiator::MakeProgressResult | makeProgressBlocking (std::chrono::steady_clock::duration timeout) final |
| Attempts to progress execution, including connection management and data operations. | |
| virtual void | removeTarget (TargetInfo const &remoteTargetInfo) final |
| Remove a target from the initiator. | |
| virtual void | shutdown () final |
| Shut down the initiator gracefully. | |
| virtual void | transferGrain (std::uint64_t grainIndex, std::uint16_t startSlice, std::uint16_t endSlice) final |
| Transfer a grain to all targets. | |
| virtual void | transferGrainToTarget (Endpoint::Id targetId, std::uint64_t localIndex, std::uint64_t remoteIndex, std::uint64_t payloadOffset, std::uint16_t startSlice, std::uint16_t endSlice) final |
| Transfer a grain to a specific target. | |
| virtual void | transferSamples (std::uint64_t headIndex, std::size_t count) final |
| Transfer samples to all targets. | |
| Public Member Functions inherited from mxl::lib::fabrics::ofi::Initiator | |
| virtual | ~Initiator ()=default |
Static Public Member Functions | |
| static std::unique_ptr< RDMInitiator > | setup (mxlFabricsInitiatorConfig const &config, FabricInfoView info, InitiatorSetupOptions const &options={}) |
| Set up a new RDMInitiator. | |
Private Member Functions | |
| void | activateIdleEndpoints () |
| Try to activate any idle endpoints. | |
| Initiator::MakeProgressResult | afterProgressResult () const noexcept |
| Returns true if any of the endpoints contained in this initiator have pending work. | |
| void | blockOnCQ (std::chrono::steady_clock::duration timeout) |
| Block on the completion queue until a completion arrives or the timeout elapses, then process all available completions. | |
| void | drainCQ () |
| Process completions until the completion queue is empty. | |
| void | evictRemovedTargets () |
| Complete the removal of targets whose outstanding writes have completed, and evict them. | |
| RDMInitiatorTarget & | findRemoteByEndpoint (Endpoint::Id id) |
| Find a remote target by its endpoint id. | |
| RDMInitiatorTarget & | findRemoteByToken (Completion::Token token) |
| Find a remote target by its completion token. | |
| template<typename F> | |
| void | forEachTarget (F &&transfer) |
| Offer a transfer to every target. | |
| void | handleCompletionData (Completion::Data data) |
| Handle a completion data event. | |
| void | handleCompletionError (Completion::Error error) |
| Handle a completion error event. | |
| void | processCompletion (Completion completion) |
| Consume a completion entry. | |
| RDMInitiator (Endpoint ep, std::unique_ptr< EgressProtocolTemplate > proto) | |
| Construct a new RDMInitiator object. | |
Private Attributes | |
| Endpoint | _endpoint |
| std::unique_ptr< EgressProtocolTemplate > | _proto |
| std::map< Endpoint::Id, Completion::Token > | _remoteEndpoints {} |
| std::map< Completion::Token, RDMInitiatorTarget > | _targets {} |
Static Private Attributes | |
| static constexpr auto | ShutdownPollInterval = std::chrono::milliseconds(1) |
| Sleep time between two queue reads in shutdown(). | |
| static constexpr auto | ShutdownTimeout = RDMInitiatorTarget::RemoveTimeout + std::chrono::seconds(1) |
| Upper bound for shutdown(). It is longer than RDMInitiatorTarget::RemoveTimeout, so that each removal ends on its own. | |
Additional Inherited Members | |
| Public Types inherited from mxl::lib::fabrics::ofi::Initiator | |
| using | MakeProgressResult = std::variant<Ready, NotReady, Interrupted> |
An initiator that uses reliable datagram (RDM) endpoints for data transfers.
RDM endpoints provide connectionless communication with reliability guarantees. An address vector is used to manage destination addresses.
Definition at line 136 of file RDMInitiator.hpp.
|
private |
Construct a new RDMInitiator object.
| ep | The local endpoint to use for all transfers. |
Definition at line 216 of file RDMInitiator.cpp.
|
private |
Try to activate any idle endpoints.
Definition at line 436 of file RDMInitiator.cpp.
|
finalvirtual |
Add a target to the initiator.
The is a non-blocking operation. The local endpoint for this target will only actively start connecting to its remote counterpart when control is passed to makeProgress() or makeProgressBlocking(). The local endpoint for this target will only accept write requests after the progress functions return false.
Implements mxl::lib::fabrics::ofi::Initiator.
Definition at line 221 of file RDMInitiator.cpp.
|
nodiscardprivatenoexcept |
Returns true if any of the endpoints contained in this initiator have pending work.
Definition at line 372 of file RDMInitiator.cpp.
|
private |
Block on the completion queue until a completion arrives or the timeout elapses, then process all available completions.
Definition at line 385 of file RDMInitiator.cpp.
|
private |
Process completions until the completion queue is empty.
Definition at line 403 of file RDMInitiator.cpp.
|
private |
Complete the removal of targets whose outstanding writes have completed, and evict them.
Definition at line 444 of file RDMInitiator.cpp.
|
nodiscardprivate |
Find a remote target by its endpoint id.
| Exception::notFound | if the Endpoint::Id does not map to any known remote endpoints. |
Definition at line 350 of file RDMInitiator.cpp.
|
nodiscardprivate |
Find a remote target by its completion token.
| Exception::notFound | if the Completion::Token does not map to any known target. |
Definition at line 361 of file RDMInitiator.cpp.
|
private |
Offer a transfer to every target.
| transfer | Called once per target. |
| Exception | The first one thrown by transfer, after every target was offered the transfer. Any other exception propagates immediately. |
Definition at line 412 of file RDMInitiator.cpp.
|
private |
Handle a completion data event.
|
private |
Handle a completion error event.
|
finalvirtual |
Attempts to progress execution, including connection management and data operations.
This is the non-blocking version of the progress function.
Implements mxl::lib::fabrics::ofi::Initiator.
Definition at line 300 of file RDMInitiator.cpp.
|
finalvirtual |
Attempts to progress execution, including connection management and data operations.
This is the blocking version of the progress function.
Implements mxl::lib::fabrics::ofi::Initiator.
Definition at line 310 of file RDMInitiator.cpp.
|
private |
Consume a completion entry.
Definition at line 454 of file RDMInitiator.cpp.
|
finalvirtual |
Remove a target from the initiator.
This is a non-blocking operation. The target is only removed after makeProgress() or makeProgressBlocking() returns false.
Implements mxl::lib::fabrics::ofi::Initiator.
Definition at line 236 of file RDMInitiator.cpp.
|
staticnodiscard |
Set up a new RDMInitiator.
| config | The configuration to use for setting up the initiator. |
| info | Fabric info already resolved from the interface config. |
| options | Optional tuning parameters (e.g. completion queue depth). |
Definition at line 161 of file RDMInitiator.cpp.
|
finalvirtual |
Shut down the initiator gracefully.
Initiates a graceful shutdown of the initiator and blocks until the shutdown is complete. Can throw an exception if the shutdown is not successful. If this function throws the initiator can no longer be used.
Removes all targets and makes progress until the outstanding writes to each one have completed.
Implements mxl::lib::fabrics::ofi::Initiator.
Definition at line 250 of file RDMInitiator.cpp.
|
finalvirtual |
Transfer a grain to all targets.
This is a non-blocking operation. The transfer is complete only after makeProgress() or makeProgressBlocking() returns false.
| grainIndex | The index of the grain to transfer. |
| startSlice | The start slice in the slice range to transfer. This is inclusive. |
| endSlice | The end slice in the slice range to transfer. This is exclusive. |
Implements mxl::lib::fabrics::ofi::Initiator.
Definition at line 279 of file RDMInitiator.cpp.
|
finalvirtual |
Transfer a grain to a specific target.
This is a non-blocking operation. The transfer is complete only after makeProgress() or makeProgressBlocking() returns false.
| targetId | The ID of the target to transfer the grain to. |
| localIndex | The index of the local grain to transfer from. |
| remoteIndex | The index of the remote grain to transfer to. |
| payloadOffset | The payload offset within the grain. |
| startSlice | The start slice in the slice range to transfer. This is inclusive. |
| endSlice | The end slice in the slice range to transfer. This is exclusive. |
Implements mxl::lib::fabrics::ofi::Initiator.
Definition at line 287 of file RDMInitiator.cpp.
|
finalvirtual |
Transfer samples to all targets.
This is a non-blocking operation. The transfer is complete only after makeProgress() or makeProgressBlocking() returns false.
| headIndex | The head index to transfer. |
| count | The number of samples per channel to transfer. |
Implements mxl::lib::fabrics::ofi::Initiator.
Definition at line 294 of file RDMInitiator.cpp.
|
private |
Definition at line 264 of file RDMInitiator.hpp.
|
private |
Definition at line 256 of file RDMInitiator.hpp.
|
private |
Definition at line 260 of file RDMInitiator.hpp.
|
private |
Targets managed by this initiator. Each target has its own remote address and remote memory regions.
Definition at line 259 of file RDMInitiator.hpp.
|
staticconstexprprivate |
Sleep time between two queue reads in shutdown().
Definition at line 253 of file RDMInitiator.hpp.
|
staticconstexprprivate |
Upper bound for shutdown(). It is longer than RDMInitiatorTarget::RemoveTimeout, so that each removal ends on its own.
Definition at line 249 of file RDMInitiator.hpp.