Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
364a1cc
Add libfabric implementation of the Fabrics API for grains. Modify de…
jonasohland Nov 14, 2025
644616c
Add transfer protocol abstraction.
jonasohland Nov 17, 2025
860f274
RCTarget modify how shutdown event are handled. Now go back to listen…
jonasohland Nov 18, 2025
f3a2db0
Add Fabrics integration tests.
jonasohland Nov 20, 2025
a19b8dc
Make the code of fabrics.cpp less redundant.
jonasohland Nov 23, 2025
f38143d
Remove std references in fabrics.h.
jonasohland Nov 24, 2025
a12b6da
Catch possible throws in some destructors and log an error instead.
jonasohland Nov 24, 2025
6669d61
Get rid of payloadOffset in transferGrain method.
jonasohland Nov 24, 2025
7ac15a5
Handle flushing after shutdown. In the makeProgress function also che…
jonasohland Nov 24, 2025
f9a3510
Add support for EFA in demo app.
jonasohland Nov 25, 2025
e7ab09b
Change mxlFabricsTargetWait|TryNewGrain for Read and ReadNonBlocking.
jonasohland Nov 25, 2025
08bc0cb
Move non mxl fabrics API function to its seperate module (fabrics_ext…
jonasohland Nov 25, 2025
554c267
Handle invalid grains in demo app.
jonasohland Nov 25, 2025
1f48de0
Abstract protocol specifics into its own layer
jonasohland Dec 2, 2025
b171e9c
Fix initiator memory registration.
mlefebvre1 Dec 3, 2025
19c4563
Add some missing docs.
mlefebvre1 Dec 3, 2025
fdff15d
Add more missing docs.
mlefebvre1 Dec 4, 2025
ca40a0d
Minor cleanup, remove some debug logs
jonasohland Dec 4, 2025
aa311f4
Rename protocol destroy() to reset()
jonasohland Dec 4, 2025
fd01ee6
Add missing license headers
jonasohland Dec 4, 2025
a51f9f0
Enable fabrics api build in CI
jonasohland Dec 4, 2025
1207eea
Fix a use-after-moved error in RCInitiator
jonasohland Dec 4, 2025
e921349
Add missing caps for RDMInitiator. Fix CLI arguments. Fix completion …
mlefebvre1 Dec 5, 2025
e412915
Run tests with more space in /dev/shm
jonasohland Dec 5, 2025
e3a700e
Set a value for the runAsInitiator flag in demo app always
jonasohland Dec 5, 2025
47275f0
Address Kimons comments
jonasohland Dec 14, 2025
92ef69e
Rename mxlFabricsTargetRead* to mxlFabricsTargetReadGrain*. Add missi…
mlefebvre1 Dec 15, 2025
22fb10b
Fix formatting issues
jonasohland Dec 15, 2025
7f8d458
Fix more formatting issues
jonasohland Dec 15, 2025
7d6ce88
Fix blockOnCq function signature in implements.
mlefebvre1 Dec 17, 2025
245b711
Add tests for multi targets
mlefebvre1 Dec 17, 2025
7f74d98
Adapt fabrics tests to new flow management api
jonasohland Dec 24, 2025
6d199f9
Remove fabrics_ext, because this module would break the promise of se…
mlefebvre1 Jan 7, 2026
6e36e31
fabrics demo: when launched as an initiator, fix the file path by usi…
mlefebvre1 Jan 13, 2026
59c1814
Use std::string::ends_with() in FILogging
jonasohland Jan 14, 2026
d33a6cf
Use std::bit_cast correctly to cast between packed/unpacked ImmData
jonasohland Jan 14, 2026
61eeec7
Separate begin and end iterator types for rmaIovsFromGroup
jonasohland Jan 14, 2026
0d90269
fabrics.cpp: Put try_run into an anonymous namespace
jonasohland Jan 14, 2026
7345bec
Enable to use of the FI_LOG_LEVEL variable
jonasohland Jan 14, 2026
8f5e1de
Import the correct headers in FILogging.cpp
jonasohland Jan 14, 2026
d4bde8c
Interpret FI_LOG_LEVEL case insensitive
jonasohland Jan 14, 2026
c927298
Deal with the weird severity level ordering in libfabric
jonasohland Jan 15, 2026
d96aa32
Do not use imm-data buffer after re-posting for recv
jonasohland Feb 4, 2026
b95fdf5
Use the _configInfo member in the demo app instead of one on the stack
jonasohland Feb 4, 2026
882705b
Read imm data from completion instead of posted buffer.
jonasohland Feb 4, 2026
02a6203
Fix some typos.
jonasohland Feb 11, 2026
c3524b3
Update copyright date on files that are changed by fabrics PR.
jonasohland Feb 11, 2026
a2f8b98
Some very minor improvements
jonasohland Feb 11, 2026
e349b3d
Return grain index from read functions instead of buffer index
jonasohland Feb 11, 2026
26ee2c8
Handle 'validSlices' update internally
jonasohland Feb 11, 2026
0436f4e
Fix remote index packing
jonasohland Feb 11, 2026
ac69bd2
Fix compile warnings for GCC-Release
jonasohland Feb 11, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project.
# SPDX-FileCopyrightText: 2026 Contributors to the Media eXchange Layer project.
# SPDX-License-Identifier: Apache-2.0

name: Build and Test the MXL Project
Expand Down Expand Up @@ -145,7 +145,8 @@ jobs:
cmake -S /workspace/mxl -B /workspace/mxl/build/${{ matrix.compiler }} \
--preset ${{ matrix.compiler }} \
-DMXL_BUILD_NUMBER=${{ github.run_number }} \
-DCMAKE_INSTALL_PREFIX=/workspace/mxl/install
-DCMAKE_INSTALL_PREFIX=/workspace/mxl/install \
-DMXL_ENABLE_FABRICS_OFI=ON
"

- name: Save vcpkg cache
Expand All @@ -165,6 +166,7 @@ jobs:
- name: Run Tests
run: |
docker run --mount src=${{ github.workspace }},target=/workspace/mxl,type=bind \
--shm-size=1g \
-i mxl_build_container_with_source \
bash -c "
cd /workspace/mxl/build/${{ matrix.compiler }} && \
Expand Down
119 changes: 48 additions & 71 deletions lib/fabrics/include/mxl/fabrics.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project.
// SPDX-FileCopyrightText: 2026 Contributors to the Media eXchange Layer project.
//
// SPDX-License-Identifier: Apache-2.0

#pragma once
Expand Down Expand Up @@ -32,7 +33,7 @@ extern "C"
/** The TargetInfo object holds the local fabric address, keys and memory region addresses for a target. It is returned after setting
* up a new target and must be passed to the initiator to connect it.
*/
typedef struct mxlTargetInfo_t* mxlTargetInfo;
typedef struct mxlFabricsTargetInfo_t* mxlFabricsTargetInfo;

/** The initiator is the logical sender of grains over the network. It is the initiator of transfer requests
* to registered memory regions of a target.
Expand All @@ -43,15 +44,15 @@ extern "C"
* Can be obtained by using a flow reader or writer, and converting it to a regions collection
* with mxlFabricsRegionsForFlowReader() or mxlFabricsRegionsForFlowWriter().
*/
typedef struct mxlRegions_t* mxlRegions;
typedef struct mxlFabricsRegions_t* mxlFabricsRegions;

typedef enum mxlFabricsProvider
typedef enum mxlFabricsProvider_t
{
MXL_SHARING_PROVIDER_AUTO = 0, /**< Auto select the best provider. ** This might not be supported by all implementations. */
MXL_SHARING_PROVIDER_TCP = 1, /**< Provider that uses linux tcp sockets. */
MXL_SHARING_PROVIDER_VERBS = 2, /**< Provider for userspace verbs (libibverbs) and librdmcm for connection management. */
MXL_SHARING_PROVIDER_EFA = 3, /**< Provider for AWS Elastic Fabric Adapter. */
MXL_SHARING_PROVIDER_SHM = 4, /**< Provider used for moving data between 2 memory regions inside the same system. Supported */
MXL_FABRICS_PROVIDER_AUTO = 0, /**< Auto select the best provider. ** This might not be supported by all implementations. */
MXL_FABRICS_PROVIDER_TCP = 1, /**< Provider that uses linux tcp sockets. */
MXL_FABRICS_PROVIDER_VERBS = 2, /**< Provider for userspace verbs (libibverbs) and librdmcm for connection management. */
MXL_FABRICS_PROVIDER_EFA = 3, /**< Provider for AWS Elastic Fabric Adapter. */
MXL_FABRICS_PROVIDER_SHM = 4, /**< Provider used for moving data between 2 memory regions inside the same system. Supported */
} mxlFabricsProvider;

/** Address of a logical network endpoint. This is analogous to a hostname and port number in classic ipv4 networking.
Expand All @@ -60,48 +61,31 @@ extern "C"
* `node` and `service` pointers are expected to live at least until the target or initiator `setup` function is executed and are
* internally cloned.
*/
typedef struct mxlEndpointAddress_t
typedef struct mxlFabricsEndpointAddress_t
{
char const* node;
char const* service;
} mxlEndpointAddress;
} mxlFabricsEndpointAddress;

/** Configuration object required to set up a new target.
*/
typedef struct mxlTargetConfig_t
typedef struct mxlFabricsTargetConfig_t
{
mxlEndpointAddress endpointAddress; /**< Bind address for the local endpoint. */
mxlFabricsProvider provider; /**< The provider that should be used */
mxlRegions regions; /**< Local memory regions of the flow that grains should be written to. */
bool deviceSupport; /**< Require support of transfers involving device memory. */
} mxlTargetConfig;
mxlFabricsEndpointAddress endpointAddress; /**< Bind address for the local endpoint. */
mxlFabricsProvider provider; /**< The provider that should be used */
mxlFabricsRegions regions; /**< Local memory regions of the flow that grains should be written to. */
bool deviceSupport; /**< Require support of transfers involving device memory. */
} mxlFabricsTargetConfig;

/** Configuration object required to set up an initiator.
*/
typedef struct mxlInitiatorConfig_t
typedef struct mxlFabricsInitiatorConfig_t
{
mxlEndpointAddress endpointAddress; /**< Bind address for the local endpoint. */
mxlFabricsProvider provider; /**< The provider that should be used. */
mxlRegions regions; /**< Local memory regions of the flow that grains should source of remote write requests. */
bool deviceSupport; /**< Require support of transfers involving device memory. */
} mxlInitiatorConfig;

/** Configuration for a memory region location.
*/
typedef struct mxlFabricsMemoryRegionLocation_t
{
mxlPayloadLocation type; /**< Memory type of the payload. */
uint64_t deviceId; /**< Device Index when device memory is used, otherwise it is ignored. */
} mxlFabricsMemoryRegionLocation;

/** Configuration for a user supplied memory region.
*/
typedef struct mxlFabricsMemoryRegion_t
{
uintptr_t addr; /**< Start address of the contiguous memory region. */
size_t size; /**< Size of that memory region */
mxlFabricsMemoryRegionLocation loc; /**< Location information for that memory region. */
} mxlFabricsMemoryRegion;
mxlFabricsEndpointAddress endpointAddress; /**< Bind address for the local endpoint. */
mxlFabricsProvider provider; /**< The provider that should be used. */
mxlFabricsRegions regions; /**< Local memory regions of the flow that grains should source of remote write requests. */
bool deviceSupport; /**< Require support of transfers involving device memory. */
} mxlFabricsInitiatorConfig;

/**
* Get the backing memory regions of a flow associated with a flow reader.
Expand All @@ -111,7 +95,7 @@ extern "C"
* \param out_regions A pointer to a memory location where the address of the returned collection of memory regions will be written.
*/
MXL_EXPORT
mxlStatus mxlFabricsRegionsForFlowReader(mxlFlowReader in_reader, mxlRegions* out_regions);
mxlStatus mxlFabricsRegionsForFlowReader(mxlFlowReader in_reader, mxlFabricsRegions* out_regions);

/**
* Get the backing memory regions of a flow associated with a flow writer.
Expand All @@ -121,18 +105,7 @@ extern "C"
* \param out_regions A pointer to a memory location where the address of the returned collection of memory regions will be written.
*/
MXL_EXPORT
mxlStatus mxlFabricsRegionsForFlowWriter(mxlFlowWriter in_writer, mxlRegions* out_regions);

/**
* Create a regions object from a list of memory region groups.
* \param in_regions A pointer to an array of memory region groups.
* \param in_count The number of memory region groups in the array.
* \param out_regions Returns a pointer to the created regions object. The user is responsible for freeing this object by calling
* `mxlFabricsRegionsFree()`.
* \return MXL_STATUS_OK if the regions object was successfully created.
*/
MXL_EXPORT
mxlStatus mxlFabricsRegionsFromUserBuffers(mxlFabricsMemoryRegion const* in_regions, size_t in_count, mxlRegions* out_regions);
mxlStatus mxlFabricsRegionsForFlowWriter(mxlFlowWriter in_writer, mxlFabricsRegions* out_regions);

/**
* Free a regions object previously allocated by mxlFabricsRegionsForFlowReader(), mxlFabricsRegionsForFlowWriter() or
Expand All @@ -141,7 +114,7 @@ extern "C"
* \return MXL_STATUS_OK if the regions object was freed
*/
MXL_EXPORT
mxlStatus mxlFabricsRegionsFree(mxlRegions in_regions);
mxlStatus mxlFabricsRegionsFree(mxlFabricsRegions in_regions);

/**
* Create a new mxl-fabrics from an mxl instance. Targets and initiators created from this mxl-fabrics instance
Expand Down Expand Up @@ -184,31 +157,31 @@ extern "C"
* \param in_target A valid fabrics target
* \param in_config The target configuration. This will be used to create an endpoint and register a memory region. The memory region
* corresponds to the one that will be written to by the initiator.
* \param out_info An mxlTargetInfo_t object which should be shared to a remote initiator which this target should receive data from. The
* \param out_info An mxlFabricsTargetInfo_t object which should be shared to a remote initiator which this target should receive data from. The
* object must be freed with mxlFabricsFreeTargetInfo().
* \return The result code. \see mxlStatus
*/
MXL_EXPORT
mxlStatus mxlFabricsTargetSetup(mxlFabricsTarget in_target, mxlTargetConfig* in_config, mxlTargetInfo* out_info);
mxlStatus mxlFabricsTargetSetup(mxlFabricsTarget in_target, mxlFabricsTargetConfig const* in_config, mxlFabricsTargetInfo* out_info);

/**
* Non-blocking accessor for a flow grain at a specific index.
* \param in_target A valid fabrics target
* \param out_index The index of the grain that is ready, if any.
* \param out_grainIndex The index of the grain that was written, if any.
* \return The result code. MXL_ERR_NOT_READY if no grain was available at the time of the call, and the call should be retried. \see mxlStatus
*/
MXL_EXPORT
mxlStatus mxlFabricsTargetTryNewGrain(mxlFabricsTarget in_target, uint64_t* out_index);
mxlStatus mxlFabricsTargetReadGrainNonBlocking(mxlFabricsTarget in_target, uint64_t* out_grainIndex);

/**
* Blocking accessor for a flow grain at a specific index.
* \param in_target A valid fabrics target
* \param out_index The index of the grain that is ready, if any.
* \param out_grainIndex The index of the grain that was written, if any.
* \param in_timeoutMs How long should we wait for the grain (in milliseconds)
* \return The result code. MXL_ERR_NOT_READY if no grain was available before the timeout. \see mxlStatus
*/
MXL_EXPORT
mxlStatus mxlFabricsTargetWaitForNewGrain(mxlFabricsTarget in_target, uint64_t* out_index, uint16_t in_timeoutMs);
mxlStatus mxlFabricsTargetReadGrain(mxlFabricsTarget in_target, uint16_t in_timeoutMs, uint64_t* out_entryIndex);

/**
* Create a fabrics initiator instance.
Expand All @@ -234,7 +207,7 @@ extern "C"
* \return The result code. \see mxlStatus
*/
MXL_EXPORT
mxlStatus mxlFabricsInitiatorSetup(mxlFabricsInitiator in_initiator, mxlInitiatorConfig const* in_config);
mxlStatus mxlFabricsInitiatorSetup(mxlFabricsInitiator in_initiator, mxlFabricsInitiatorConfig const* in_config);

/**
* Add a target to the initiator. This will allow the initiator to send data to the target in subsequent calls to
Expand All @@ -244,7 +217,7 @@ extern "C"
* \param in_targetInfo The target information. This should be the same as the one returned from "mxlFabricsTargetSetup".
*/
MXL_EXPORT
mxlStatus mxlFabricsInitiatorAddTarget(mxlFabricsInitiator in_initiator, mxlTargetInfo const in_targetInfo);
mxlStatus mxlFabricsInitiatorAddTarget(mxlFabricsInitiator in_initiator, mxlFabricsTargetInfo const in_targetInfo);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could get rid of this const qualification, especially in the context of of this declaration. Feels free to keep it for the definition if it proves to be helpful there (even though I personally tend to not use them on by value arguments).


/**
* Remove a target from the initiator. This function is always non-blocking. If any additional communication for a graceful shutdown is
Expand All @@ -255,17 +228,21 @@ extern "C"
* \param in_targetInfo The target information. This should be the same as the one returned from "mxlFabricsTargetSetup".
*/
MXL_EXPORT
mxlStatus mxlFabricsInitiatorRemoveTarget(mxlFabricsInitiator in_initiator, mxlTargetInfo const in_targetInfo);
mxlStatus mxlFabricsInitiatorRemoveTarget(mxlFabricsInitiator in_initiator, mxlFabricsTargetInfo const in_targetInfo);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could get rid of this const qualification, especially in the context of of this declaration. Feels free to keep it for the definition if it proves to be helpful there (even though I personally tend to not use them on by value arguments).


/**
* Enqueue a transfer operation to all added targets. This function is always non-blocking. The transfer operation might be started right
* away, but is only guaranteed to have completed after mxlFabricsInitiatorMakeProgress*() no longer returns MXL_ERR_NOT_READY.
* \param in_initiator A valid fabrics initiator
* \param in_grainIndex The index of the grain to transfer.
* \param in_grainIndex The grain index to transfer. The ordering was given when mxlFabricsRegions object were created. This is true for both
* local and remote memory regions.
* \param in_startSlice The start slice in the slice range to transfer. This is inclusive.
* \param in_endSlice The end slice in the slice range to transfer. This is exclusive.
* \return The result code. \see mxlStatus
*/
MXL_EXPORT
mxlStatus mxlFabricsInitiatorTransferGrain(mxlFabricsInitiator in_initiator, uint64_t in_grainIndex);
mxlStatus mxlFabricsInitiatorTransferGrain(mxlFabricsInitiator in_initiator, uint64_t in_grainIndex, uint16_t in_startSlice,
uint16_t in_endSlice);

/**
* This function must be called regularly for the initiator to make progress on queued transfer operations, connection establishment
Expand Down Expand Up @@ -314,23 +291,23 @@ extern "C"
* \param in_stringSize The size of the output string.
*/
MXL_EXPORT
mxlStatus mxlFabricsTargetInfoToString(mxlTargetInfo const in_targetInfo, char* out_string, size_t* in_stringSize);
mxlStatus mxlFabricsTargetInfoToString(mxlFabricsTargetInfo const in_targetInfo, char* out_string, size_t* in_stringSize);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could get rid of this const qualification of in_targetInfo, especially in the context of of this declaration. Feels free to keep it for the definition if it proves to be helpful there (even though I personally tend to not use them on by value arguments).


/**
* Parse a targetInfo object from its string representation.
* \param in_string A valid string to deserialize
* \param out_targetInfo A valid target info to deserialize to
*/
MXL_EXPORT
mxlStatus mxlFabricsTargetInfoFromString(char const* in_string, mxlTargetInfo* out_targetInfo);
mxlStatus mxlFabricsTargetInfoFromString(char const* in_string, mxlFabricsTargetInfo* out_targetInfo);

/**
* Free a mxlTargetInfo object obtained from mxlFabricsTargetSetup() or mxlFabricsTargetInfoFromString().
* \param in_info A mxlTargetInfo object
* \return MXL_STATUS_OK if the mxlTargetInfo object was freed.
* Free a mxlFabricsTargetInfo object obtained from mxlFabricsTargetSetup() or mxlFabricsTargetInfoFromString().
* \param in_info A mxlFabricsTargetInfo object
* \return MXL_STATUS_OK if the mxlFabricsTargetInfo object was freed.
*/
MXL_EXPORT
mxlStatus mxlFabricsFreeTargetInfo(mxlTargetInfo in_info);
mxlStatus mxlFabricsFreeTargetInfo(mxlFabricsTargetInfo in_info);

#ifdef __cplusplus
}
Expand Down
46 changes: 33 additions & 13 deletions lib/fabrics/ofi/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project.
# SPDX-FileCopyrightText: 2026 Contributors to the Media eXchange Layer project.
# SPDX-License-Identifier: Apache-2.0

message ("-- Building fabrics library with libfabric/ofi")
Expand All @@ -23,24 +23,40 @@ target_compile_features(mxl-fabrics-objects
target_sources(mxl-fabrics-objects
PRIVATE
src/fabrics.cpp
src/internal/Exception.cpp
src/internal/Provider.cpp
src/internal/FabricVersion.cpp
src/internal/FabricInfo.cpp
src/internal/Fabric.cpp
src/internal/Domain.cpp
src/internal/Region.cpp
src/internal/MemoryRegion.cpp
src/internal/RegisteredRegion.cpp
src/internal/LocalRegion.cpp
src/internal/RemoteRegion.cpp
src/internal/Address.cpp
src/internal/AddressVector.cpp
src/internal/Completion.cpp
src/internal/CompletionQueue.cpp
src/internal/DataLayout.cpp
src/internal/Domain.cpp
src/internal/Endpoint.cpp
src/internal/Event.cpp
src/internal/EventQueue.cpp
src/internal/Endpoint.cpp
src/internal/Exception.cpp
src/internal/FILogging.cpp
src/internal/Fabric.cpp
src/internal/FabricInfo.cpp
src/internal/FabricInstance.cpp
src/internal/FabricVersion.cpp
src/internal/ImmData.cpp
src/internal/Initiator.cpp
src/internal/LocalRegion.cpp
src/internal/MemoryRegion.cpp
src/internal/PassiveEndpoint.cpp
src/internal/Protocol.cpp
src/internal/ProtocolEgressRMA.cpp
src/internal/ProtocolIngressRMA.cpp
src/internal/Provider.cpp
src/internal/RCInitiator.cpp
src/internal/RCTarget.cpp
src/internal/RDMInitiator.cpp
src/internal/RDMTarget.cpp
src/internal/Region.cpp
src/internal/RegisteredRegion.cpp
src/internal/RemoteRegion.cpp
src/internal/GrainSlices.cpp
src/internal/Target.cpp
src/internal/TargetInfo.cpp
)
target_link_libraries(mxl-fabrics-objects
PRIVATE
Expand All @@ -54,6 +70,10 @@ set_target_properties(mxl-fabrics-objects
C_EXTENSIONS OFF
CXX_EXTENSIONS OFF
)
target_include_directories(mxl-fabrics-objects
PUBLIC
"${CMAKE_CURRENT_LIST_DIR}/src/internal"
)

# Enable LTO/IPO on target if enabled and supported
mxl_enable_target_ipo(mxl-fabrics-objects)
Expand Down
Loading
Loading