Add a GPU-initiated RDMA WRITE path for the LL dispatch/combine kernels
based on mlx5dv direct verbs, alongside the existing IPC and host-FIFO
PortChannel paths. Selected at runtime via MSCCLPP_EP_USE_IBGDA when
num_rdma_ranks > 1.
Core (src/core, include/mscclpp):
- New ibgda module (ibgda.{hpp,cc}, ibgda_device.cuh): per-peer mlx5
QP/MR/CQ setup, device-side WQE writers (write_rdma_wqe,
write_rdma_write_inl_wqe for 4B/8B), submit_requests / submit_no_db
ring helpers, and a poller thread for send CQs.
- ibgda_port_channel_device.{hpp,cuh}: thin port_put() wrapper over
rdma_write with signal_cqe / ring_db flags so callers can issue
UNSIGNALED batched WRs and ring the doorbell once at the tail.
- mlx5dv_wrapper: expose extra symbols needed for direct WQE
construction; minor connection.cc / proxy.cc / port_channel.cc
plumbing to surface QP / MR handles and rkeys to the EP layer.
EP layer (src/ext/ep):
- ibgda_setup.{hpp,cc}: build per-(local_expert, peer_rank) GpuQp
handles, exchange remote MR addr/rkey via the bootstrap, own the
CQ poller. h.dst is set to the per-peer remote_mrs index.
- buffer.{hpp,cc}: gate IBGDA path with use_ibgda_path_ &&
ibgda_setup_ != nullptr && !use_ipc; pass device_handles to the
kernel launchers.
- kernels/internode_ll.cu: 3-way DISPATCH_LAUNCH_CASE /
COMBINE_LAUNCH_CASE (IPC / IBGDA / port-FIFO), templated on
kIbgdaPath. Data PUTs are issued UNSIGNALED with ring_db=false;
the trailing per-QP count write (dispatch) and flag write
(combine) keep the defaults so each QP gets a single signaled
WR that advances prod_idx past all queued data WRs and rings
the doorbell once.
Test (test/python/ext/ep): extend test_low_latency_multirank.py with
env-driven config knobs (MSCCLPP_EP_LL_TOKENS / _HIDDEN / _TOPK /
_EXPERTS_PER_RANK) for sweeping the new path.
MSCCL++ C++ Test Framework
A lightweight, GTest-like test framework with MPI support for testing MSCCL++ C++ APIs. Defined in framework.hpp / framework.cc.
Adding a New Test (Step-by-Step)
Single-process test (unit/)
-
Create the test file
test/unit/my_feature_tests.cc(or.cufor CUDA):#include "../framework.hpp" #include <mscclpp/my_feature.hpp> TEST(MyFeatureTest, BasicUsage) { EXPECT_EQ(myFunction(), 42); } -
Register it in CMake — add the filename to
test/unit/CMakeLists.txt:target_sources(unit_tests PRIVATE ... my_feature_tests.cc # <-- add here ) -
Build and run:
cmake --build build -j ./build/test/unit_tests --filter=MyFeatureTest
Multi-process test (mp_unit/)
-
Create the test file
test/mp_unit/my_feature_tests.cc(or.cu):#include "mp_unit_tests.hpp" TEST(MyFeatureTest, MultiRank) { int rank = gEnv->rank; EXPECT_GE(rank, 0); }Use fixtures from
mp_unit_tests.hpp(e.g.,CommunicatorTest) if you need pre-established connections. -
Register it in CMake — add the filename to
test/mp_unit/CMakeLists.txt:target_sources(mp_unit_tests PRIVATE ... my_feature_tests.cc # <-- add here ) -
Build and run:
cmake --build build -j mpirun -np 2 ./build/test/mp_unit_tests --filter=MyFeatureTest
Notes
- No separate test registration step is needed —
TEST()auto-registers via static initialization. - The
test_frameworkstatic library is built fromframework.ccin the top-leveltest/CMakeLists.txtand linked into bothunit_testsandmp_unit_tests. You do not need to modify it. - Use
.cuextension for files that contain CUDA kernel code; use.ccfor host-only tests. - Each test binary needs a
main()that callsRUN_ALL_TESTS(). Seeunit/unit_tests_main.cc(single-process) andmp_unit/mp_unit_tests.cc(multi-process withEnvironmentsetup). - Additional run options:
--filter=-Pattern(exclude),--exclude-perf-tests(skipPERF_TESTs).
Macros
| Macro | Behavior |
|---|---|
TEST(Suite, Name) |
Register a test. If Suite is a defined class, it's used as a fixture. |
PERF_TEST(Suite, Name) |
Same as TEST but marked as perf (skippable via --exclude-perf-tests). |
EXPECT_* |
Non-fatal assertions: EXPECT_TRUE, EXPECT_FALSE, EXPECT_EQ, EXPECT_NE, EXPECT_LT, EXPECT_LE, EXPECT_GT, EXPECT_GE |
ASSERT_* |
Fatal assertions (abort test on failure): same variants as EXPECT_*, plus ASSERT_NO_THROW |
FAIL() |
Fail immediately. Supports streaming: FAIL() << "reason"; |
SKIP_TEST() |
Skip the current test. Supports streaming: SKIP_TEST() << "reason"; |
CUDA_CHECK(call) |
Check a CUDA API return code, throw on error. |
Fixtures
Define a class inheriting from mscclpp::test::TestCase with SetUp() / TearDown(), then use the class name as the suite name:
class MyFixture : public mscclpp::test::TestCase {
public:
void SetUp() override { /* per-test setup */ }
void TearDown() override { /* per-test cleanup */ }
protected:
int sharedState_ = 0;
};
TEST(MyFixture, SomeTest) {
sharedState_ = 42;
EXPECT_EQ(sharedState_, 42);
}
See mp_unit/mp_unit_tests.hpp (BootstrapTest, CommunicatorTest, etc.) for real fixture examples.
Global Environments
Register an Environment subclass for one-time global setup/teardown (e.g., MPI bootstrap):
class MyEnv : public mscclpp::test::Environment {
public:
void SetUp() override { /* global init */ }
void TearDown() override { /* global cleanup */ }
};
// In main(), before RUN_ALL_TESTS():
mscclpp::test::TestRegistry::instance().addEnvironment(new MyEnv());
See mp_unit/mp_unit_tests.cc for the MultiProcessTestEnv example.
Utilities
mscclpp::test::utils::isMainRank()— true on MPI rank 0mscclpp::test::utils::getMPIRank()/getMPISize()mscclpp::test::utils::Timer— high-resolution timer withstart(),stop(),elapsedMilliseconds()mscclpp::test::currentTestName()— returns"Suite.Name"for the running test