Skip to content

Feature/fabrics/caps#33

Open
jonasohland wants to merge 49 commits into
mainfrom
feature/fabrics/caps
Open

Feature/fabrics/caps#33
jonasohland wants to merge 49 commits into
mainfrom
feature/fabrics/caps

Conversation

@jonasohland

Copy link
Copy Markdown
Owner

No description provided.

@github-actions

Copy link
Copy Markdown

Test Results

0 tests   0 ✅  0s ⏱️
0 suites  0 💤
0 files    0 ❌

Results for commit 6763fa6.

@github-actions

github-actions Bot commented Jun 12, 2026

Copy link
Copy Markdown

Test Results

94 tests  +20   94 ✅ +20   12s ⏱️ -1s
 1 suites ± 0    0 💤 ± 0 
 1 files   ± 0    0 ❌ ± 0 

Results for commit a72e371. ± Comparison against base commit 0ae1dc5.

♻️ This comment has been updated with latest results.

@mlefebvre1 mlefebvre1 left a comment

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.

I'm not done reviewing yet, but here's what I have so far..

Comment thread lib/fabrics/include/mxl/fabrics.h Outdated
Comment thread lib/fabrics/ofi/src/internal/FabricAddress.cpp Outdated
Comment thread lib/fabrics/ofi/src/internal/Address.hpp Outdated
Comment thread lib/fabrics/ofi/src/internal/AddressVector.cpp Outdated
Comment thread lib/fabrics/ofi/src/internal/CompletionQueue.cpp
Comment thread lib/fabrics/ofi/src/internal/ProviderConfig.hpp Outdated
Comment thread lib/fabrics/ofi/src/internal/ProviderConfig.cpp
Comment thread lib/fabrics/ofi/src/internal/ProviderConfig.cpp Outdated
@jonasohland
jonasohland force-pushed the feature/fabrics/caps branch from be8e7a1 to 0bb0699 Compare June 14, 2026 14:36
Comment thread lib/fabrics/ofi/src/internal/Target.cpp
Comment thread lib/fabrics/ofi/src/internal/ProviderConfig.cpp Outdated
.memoryRegistrationModes = FI_MR_VIRT_ADDR | FI_MR_LOCAL | FI_MR_ALLOCATED | FI_MR_PROV_KEY,
.endpointType = FI_EP_MSG,
.caps = libfabricCaps(capabilities, isTarget),
.supportedAddressFormats = {FI_SOCKADDR_IN, FI_SOCKADDR_IN6},

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.

FI_SOCKADDR_IB ?

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

I need to test if that actually works and how devices with multiple ports present through libfabric. Right now all providers let you choose the port by specifying the node address. I suspect with raw infiniband addresses, the node address is shared between ports.
I would have to find out how that maps to the node/service scheme.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Yeah, the problem is that the host (or node) portion of FI_SOCKADDR_IB and FI_SOCKADDR_IN6 is the same for interfaces with and auto-assigned ipv6 address.

Comment thread lib/fabrics/ofi/src/internal/ProviderConfig.cpp Outdated
.supportedAddressFormats = {FI_SOCKADDR_IN, FI_SOCKADDR_IN6},
.supportedProtocols = {FI_PROTO_SOCK_TCP},
.requiredCaps = libfabricRequiredCaps(capabilities) | FI_MSG,
.filteredCaps = FI_TAGGED,

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.

Nitpick, but I don't think it's possible to have FI_TAGGED support for FI_EP_MSG`

@jonasohland
jonasohland force-pushed the feature/fabrics/caps branch 2 times, most recently from f5f57fd to 2e2ad13 Compare June 17, 2026 11:11
jonasohland and others added 21 commits June 23, 2026 09:36
When pull() returned no sample and the next batch time had already
passed, mxlGetNsUntilIndex() returned 0, making the next pull()
non-blocking. With no sleep on the empty-pull path this caused the
loop to spin. Clamp the pull timeout to at least one batch period so
the thread always blocks between retries.

Co-authored-by: Jonas Ohland <jonas.ohland@gmail.com>
Signed-off-by: Jonas Ohland (Riedel) <jonas.ohland@riedel.net>
Co-authored-by: Jonas Ohland <jonas.ohland@gmail.com>
Signed-off-by: Jonas Ohland (Riedel) <jonas.ohland@riedel.net>
…info

Endpoint::Id is a process-local dispatch key -- an initiator routes connection
and completion events to the correct target by this id (RCInitiator's id-keyed
_targets map). randomId() reseeded a fresh std::mt19937 from a single 32-bit,
time-correlated std::random_device draw on EVERY call, so targets set up in the
same tight window (a gateway bringing up many mirrors at once) could draw the
same seed -> the same id; the initiator's map then collapsed two endpoints and
one mirror never connected. Intermittent 'stuck forever' wedge that scaled with
concurrent setups (never with 1, ~1/3 with 9).

- Endpoint::randomId(): seed one 64-bit engine ONCE from full-width entropy and
  serialize draws. Collision-free within and across processes; setup/reconnect
  only, never on the hot path.
- FabricInfoList::get(): serialize fi_getinfo -- libfabric does lazy global
  provider init on first call; concurrent first calls can race it.

Signed-off-by: Dominik Heinrich <d.heinrich@qvest-digital.com>
- condense the randomId/fi_getinfo comments to the essentials
- adopt the auto-left declaration style (mu, lock, getInfoMutex, getInfoLock)
- correct the fi_getinfo comment: fi_ini is mutex-protected upstream, so
  serialize the unlocked per-provider getinfo loop (defensive, setup-only)

Signed-off-by: Dominik Heinrich <d.heinrich@qvest-digital.com>
Address review: fi_ini() is already guarded by libfabric's
common_locks.ini_lock and fi_getinfo is documented as thread-safe, so
the extra serialization in FabricInfoList::get was guarding a non-bug.
Remove the mutex and revert FabricInfo.cpp to baseline.

Also simplify the endpoint random engine to a single mt19937_64 seeded
from std::random_device. The static mutex still guards concurrent
generation; only the redundant seed_seq scaffolding is dropped.

Signed-off-by: Dominik Heinrich <d.heinrich@qvest-digital.com>
Signed-off-by: Vincent Trussart <vincent.trussart@grassvalley.com>
Signed-off-by: Vincent Trussart <vincent.trussart@grassvalley.com>
Signed-off-by: Vincent Trussart <vincent.trussart@grassvalley.com>
Co-authored-by: Michael Lefebvre <michael.lefebvre.31@gmai..com>

Signed-off-by: Michael Lefebvre <michael.lefebvre@riedel.net>
A target receives grains by repeatedly calling mxlFabricsTargetReadGrainNonBlocking(),
which reads one completion per call. The completion queue has a bounded depth, so
on a high-frame-rate or many-stream receiver whose per-grain work is slower than
the grain inter-arrival time, completions can accumulate and overflow the queue.
On connection-oriented providers (verbs) a CQ overflow surfaces as a fatal queue
pair error that tears the connection down.

Two changes:

- Document the two-phase drain pattern in docs/Fabrics.md section 11: a hot phase
  that drains all currently-available completions cheaply into an application
  queue, and a warm phase that performs the bounded heavy per-grain work. Includes
  the overflow failure mode and completion-queue sizing guidance.

- Make the target completion queue depth configurable. The depth was previously
  hardcoded to 8 (with a 'this should be parameterized' note). It can now be set
  per target via the existing, previously-unused 'options' argument of
  mxlFabricsTargetSetup, e.g. {"cqDepth": 256}. This mirrors the JSON options
  mechanism already used by the Flow API. The value is threaded through
  TargetWrapper::setup into RCTarget/RDMTarget; 0 or an absent option selects the
  implementation default, so existing callers are unaffected. cqDepth applies to
  targets and is ignored for initiators.

- Add tests covering a valid cqDepth option, the default (no option), and
  rejection of invalid options (zero, wrong type, malformed JSON) with
  MXL_ERR_INVALID_ARG.

Signed-off-by: Maciej Oleksy <maciej.oleksy@intel.com>
Introduce mxlFabricsTargetReadGrainsNonBlocking() which drains up to a
caller-specified number of available grain completions in a single call,
returning the drained grain indices and count. This lets receivers empty
the completion queue promptly (phase 1) before doing the heavier per-grain
commit work (phase 2), instead of looping the single-grain API by hand.

- fabrics.h: declare the new batch drain entry point and document its
  contract (MXL_STATUS_OK if >=1 drained, MXL_ERR_NOT_READY if none,
  MXL_ERR_INVALID_ARG on bad args).
- fabrics.cpp: implement it over the OFI TargetWrapper by looping
  readGrain(), which also drives connection/EQ progress.
- demo.cpp: convert the target runDiscrete() loop to the two-phase drain.
- Fabrics.md: update section 11.2 to show the batch call.
- test_basics.cpp: add an end-to-end batch drain test plus invalid-arg
  coverage.

Signed-off-by: Maciej Oleksy <maciej.oleksy@intel.com>
Fix clang-format violations flagged by CI in the files touched by this
branch (include ordering in fabrics.cpp, member/keyword and comment
alignment in the target headers).

Signed-off-by: Maciej Oleksy <maciej.oleksy@intel.com>
- Drop mxlFabricsTargetReadGrainsNonBlocking: it duplicated the single-grain
  accessor without real batching (fi_cq_read count stays 1), so the two-phase
  drain is now documented against the existing API instead.
- Introduce an internal TargetSetupOptions struct carrying an
  std::optional<size_t> cqDepth, replacing the size_t=0 sentinel across the
  Target/RCTarget/RDMTarget setup() calls.
- Revert the demo to the simple single-grain proxy loop and add a comment
  pointing to the drain-pattern docs.

Signed-off-by: Maciej Oleksy <maciej.oleksy@intel.com>
Signed-off-by: Maciej Oleksy <maciej.oleksy@intel.com>
Signed-off-by: Maciej Oleksy <maciej.oleksy@intel.com>
Co-authored-by: Jonas Ohland <jonas.ohland@gmail.com>
Signed-off-by: Jonas Ohland (Riedel) <jonas.ohland@riedel.net>
- Replace bare throw with Exception::invalidState in Target/Initiator
- Restore commented-out error status check in try_run
- Remove duplicate copyStringProperty call for link_type
- Remove spurious blank line in Address::fromBase64
- Remove unused FabricSourceInterfaces files and getSources declaration
- Remove unused ProviderConfig.hpp includes, add missing include in
  FabricInterfaceProbe.hpp
- Fill in empty doxygen stubs, add missing [[nodiscard]] attributes
- Rename capabilitiesDummyCheck to validateCapabilities
- Report hostname instead of opaque fi_shm address for SHM interfaces
- Propagate service field in SHM interface descriptions
- Handle unparseable query addresses gracefully in probeInterfaces

Co-authored-by: Jonas Ohland <jonas.ohland@gmail.com>
Signed-off-by: Jonas Ohland (Riedel) <jonas.ohland@riedel.net>
Separate how capability flags behave on the two code paths:
- Query (mxlFabricsGetInterfaces): caps are output-only, not used for
  filtering. Each returned interface reports its detected capabilities.
- Setup (target/initiator): caps express requirements. At least one
  transfer capability must be set; defaults to REMOTE_WRITE with a
  warning if missing.

Move capability normalization from ProviderConfig into
selectSourceInterface so it only applies on the setup path. Derive
libfabric caps and requiredCaps from MXL capability flags via helpers,
supporting both REMOTE_WRITE and SEND_RECEIVE. Store the resolved
ProviderCapabilities in ProviderConfig for later use.

Co-authored-by: Jonas Ohland <jonas.ohland@gmail.com>
Signed-off-by: Jonas Ohland (Riedel) <jonas.ohland@riedel.net>
…selection

Co-authored-by: Jonas Ohland <jonas.ohland@gmail.com>
Signed-off-by: Jonas Ohland (Riedel) <jonas.ohland@riedel.net>
…InfoList

Co-authored-by: Jonas Ohland <jonas.ohland@gmail.com>
Signed-off-by: Jonas Ohland (Riedel) <jonas.ohland@riedel.net>
Co-Authored-By: Jonas Ohland <jonas.ohland@gmail.com>
Signed-off-by: Jonas Ohland (Riedel) <jonas.ohland@riedel.net>
jonasohland and others added 23 commits July 10, 2026 14:20
Co-authored-by: Jonas Ohland <jonas.ohland@gmail.com>
Signed-off-by: Jonas Ohland (Riedel) <jonas.ohland@riedel.net>
Co-authored-by: Jonas Ohland <jonas.ohland@gmail.com>
Signed-off-by: Jonas Ohland (Riedel) <jonas.ohland@riedel.net>
Co-authored-by: Jonas Ohland <jonas.ohland@gmail.com>
Signed-off-by: Jonas Ohland (Riedel) <jonas.ohland@riedel.net>
Co-authored-by: Jonas Ohland <jonas.ohland@gmai.com>
Signed-off-by: Jonas Ohland (Riedel) <jonas.ohland@riedel.net>
Co-authored-by: Jonas Ohland <jonas.ohland@gmail.com>
Signed-off-by: Jonas Ohland (Riedel) <jonas.ohland@riedel.net>
Co-authored-by: Jonas Ohland <jonas.ohland@gmail.com>
Signed-off-by: Jonas Ohland (Riedel) <jonas.ohland@riedel.net>
Co-authored-by: Jonas Ohland <jonas.ohland@gmail.com>
Signed-off-by: Jonas Ohland (Riedel) <jonas.ohland@riedel.net>
Co-authored-by: Jonas Ohland <jonas.ohland@gmail.com>
Signed-off-by: Jonas Ohland (Riedel) <jonas.ohland@riedel.net>
Co-authored-by: Jonas Ohland <jonas.ohland@gmail.com>
Signed-off-by: Jonas Ohland (Riedel) <jonas.ohland@riedel.net>
Co-authored-by: Jonas Ohland <jonas.ohland@gmail.com>
Signed-off-by: Jonas Ohland (Riedel) <jonas.ohland@riedel.net>
Co-authored-by: Jonas Ohland <jonas.ohland@gmail.com>
Signed-off-by: Jonas Ohland (Riedel) <jonas.ohland@riedel.net>
Co-authored-by: Jonas Ohland <jonas.ohland@gmail.com>
Signed-off-by: Jonas Ohland (Riedel) <jonas.ohland@riedel.net>
Co-authored-by: Jonas Ohland <jonas.ohland@gmail.com>
Signed-off-by: Jonas Ohland (Riedel) <jonas.ohland@riedel.net>
Co-authored-by: Jonas Ohland <jonas.ohland@gmail.com>
Signed-off-by: Jonas Ohland (Riedel) <jonas.ohland@riedel.net>
Co-authored-by: Jonas Ohland <jonas.ohland@gmail.com>
Signed-off-by: Jonas Ohland (Riedel) <jonas.ohland@riedel.net>
Co-authored-by: Jonas Ohland <jonas.ohland@gmail.com>
Signed-off-by: Jonas Ohland (Riedel) <jonas.ohland@riedel.net>
Co-authored-by: Jonas Ohland <jonas.ohland@gmail.com>
Signed-off-by: Jonas Ohland (Riedel) <jonas.ohland@riedel.net>
Co-authored-by: Jonas Ohland <jonas.ohland@gmail.com>
Signed-off-by: Jonas Ohland (Riedel) <jonas.ohland@riedel.net>
Co-authored-by: Jonas Ohland <jonas.ohland@gmail.com>
Signed-off-by: Jonas Ohland (Riedel) <jonas.ohland@riedel.net>
Co-authored-by: Jonas Ohland <jonas.ohland@gmail.com>
Signed-off-by: Jonas Ohland (Riedel) <jonas.ohland@riedel.net>
Co-authored-by: Jonas Ohland <jonas.ohland@gmail.com>
Signed-off-by: Jonas Ohland (Riedel) <jonas.ohland@riedel.net>
Co-authored-by: Jonas Ohland <jonas.ohland@gmail.com>
Signed-off-by: Jonas Ohland (Riedel) <jonas.ohland@riedel.net>
Co-authored-by: Jonas Ohland <jonas.ohland@gmail.com>
Signed-off-by: Jonas Ohland (Riedel) <jonas.ohland@riedel.net>
@jonasohland
jonasohland force-pushed the feature/fabrics/caps branch from 6aa56dc to 6f0bf17 Compare July 10, 2026 14:27
jonasohland and others added 5 commits July 10, 2026 17:18
Co-authored-by: Jonas Ohland <jonas.ohland@gmail.com>
Signed-off-by: Jonas Ohland (Riedel) <jonas.ohland@riedel.net>
Co-authored-by: Jonas Ohland <jonas.ohland@gmail.com>
Signed-off-by: Jonas Ohland (Riedel) <jonas.ohland@riedel.net>
Co-authored-by: Jonas Ohland <jonas.ohland@gmail.com>
Signed-off-by: Jonas Ohland (Riedel) <jonas.ohland@riedel.net>
Co-authored-by: Jonas Ohland <jonas.ohland@gmail.com>
Signed-off-by: Jonas Ohland (Riedel) <jonas.ohland@riedel.net>
Co-authored-by: Jonas Ohland <jonas.ohland@gmail.com>
Signed-off-by: Jonas Ohland (Riedel) <jonas.ohland@riedel.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants