|
MXL : Media eXchange Layer
MXL
|
An initiator that uses reliable connected endpoints to transfer data to targets. More...
#include <RCInitiator.hpp>


Public Member Functions | |
| virtual void | addTarget (TargetInfo const &targetInfo) 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) final |
| Attempts to progress execution, including connection management and data operations. | |
| virtual void | removeTarget (TargetInfo const &targetInfo) 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< RCInitiator > | setup (mxlFabricsInitiatorConfig const &config, FabricInfoView info, InitiatorSetupOptions const &options={}) |
| Set up a fresh initiator without any targets assigned to it. | |
Private Member Functions | |
| void | activateIdleEndpoints () |
| Try to activate any idle endpoints. | |
| void | activateIfIdle (RCInitiatorEndpoint &target) |
| Try to activate the endpoint if it is idle. Called before a transfer is posted to the endpoint. | |
| Initiator::MakeProgressResult | afterProgressResult () const noexcept |
| Returns true if any of the endpoints contained in this initiator have pending work. | |
| Initiator::MakeProgressResult | blockOnCQ (std::chrono::steady_clock::duration timeout) |
| Block on the completion queue with a timeout. | |
| void | evictDeadEndpoints () |
| Evict any dead endpoints that are no longer used. | |
| void | finishFlushingEndpoints () |
| Move endpoints that have finished flushing to the done state. | |
| bool | hasTarget () const noexcept |
| Returns true if the initiator has at least 1 target added no matter what the state is. | |
| void | pollCQ () |
| Poll the completion queue and process the events until the queue is empty. | |
| void | pollEQ () |
| Poll the event queue and process the returned events until the queue is empty. | |
| RCInitiator (std::shared_ptr< Domain > domain, std::shared_ptr< CompletionQueue > cq, std::shared_ptr< EventQueue > eq, std::unique_ptr< EgressProtocolTemplate > proto) | |
Private Attributes | |
| std::shared_ptr< CompletionQueue > | _cq |
| std::shared_ptr< Domain > | _domain |
| std::shared_ptr< EventQueue > | _eq |
| std::unique_ptr< EgressProtocolTemplate > | _proto |
| std::map< Completion::Token, RCInitiatorEndpoint > | _targets {} |
Static Private Attributes | |
| static constexpr auto | EQPollInterval = std::chrono::milliseconds(100) |
| When making progress and using blocking queue reads, this is the minimum interval at which the event queue will be read. | |
| static constexpr auto | ShutdownPollInterval = std::chrono::milliseconds(1) |
| Sleep time between two queue reads in shutdown(). | |
| static constexpr auto | ShutdownTimeout = RCInitiatorEndpoint::FlushTimeout + std::chrono::seconds(1) |
| Upper bound for shutdown(). It is longer than RCInitiatorEndpoint::FlushTimeout, so that each flush 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 connected endpoints to transfer data to targets.
Definition at line 192 of file RCInitiator.hpp.
|
private |
Definition at line 348 of file RCInitiator.cpp.
|
private |
Try to activate any idle endpoints.
Definition at line 439 of file RCInitiator.cpp.
|
private |
Try to activate the endpoint if it is idle. Called before a transfer is posted to the endpoint.
Definition at line 412 of file RCInitiator.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 356 of file RCInitiator.cpp.
|
nodiscardprivatenoexcept |
Returns true if any of the endpoints contained in this initiator have pending work.
Definition at line 420 of file RCInitiator.cpp.
|
nodiscardprivate |
Block on the completion queue with a timeout.
Definition at line 462 of file RCInitiator.cpp.
|
private |
Evict any dead endpoints that are no longer used.
Definition at line 457 of file RCInitiator.cpp.
|
private |
Move endpoints that have finished flushing to the done state.
Definition at line 449 of file RCInitiator.cpp.
|
nodiscardprivatenoexcept |
Returns true if the initiator has at least 1 target added no matter what the state is.
Definition at line 434 of file RCInitiator.cpp.
|
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 555 of file RCInitiator.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 578 of file RCInitiator.cpp.
|
private |
Poll the completion queue and process the events until the queue is empty.
Definition at line 509 of file RCInitiator.cpp.
|
private |
Poll the event queue and process the returned events until the queue is empty.
Definition at line 532 of file RCInitiator.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 366 of file RCInitiator.cpp.
|
staticnodiscard |
Set up a fresh initiator without any targets assigned to it.
The setup phase includes selecting a provider, register memory regions for all local media buffers and create all libfabric components such as completion and event queues.
| config | The configuration to use for setting up the target. |
| info | Fabric info already resolved from the interface config. |
| options | Optional tuning parameters (e.g. completion queue depth). |
Definition at line 316 of file RCInitiator.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.
Shuts down all endpoints and makes progress until each one has finished flushing.
Implements mxl::lib::fabrics::ofi::Initiator.
Definition at line 620 of file RCInitiator.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 379 of file RCInitiator.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 390 of file RCInitiator.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 403 of file RCInitiator.cpp.
|
private |
Completion Queue shared by all endpoints.
Definition at line 307 of file RCInitiator.hpp.
|
private |
Definition at line 306 of file RCInitiator.hpp.
|
private |
Event Queue shared by all endpoints.
Definition at line 308 of file RCInitiator.hpp.
|
private |
Definition at line 309 of file RCInitiator.hpp.
|
private |
|
staticconstexprprivate |
When making progress and using blocking queue reads, this is the minimum interval at which the event queue will be read.
Definition at line 257 of file RCInitiator.hpp.
|
staticconstexprprivate |
Sleep time between two queue reads in shutdown().
Definition at line 265 of file RCInitiator.hpp.
|
staticconstexprprivate |
Upper bound for shutdown(). It is longer than RCInitiatorEndpoint::FlushTimeout, so that each flush ends on its own.
Definition at line 261 of file RCInitiator.hpp.