Skip to content

Support 16-node distributed Soft-RoCE routing - #39

Merged
vickiegpt merged 4 commits into
mainfrom
agent/soft-roce-distributed-16node
Aug 9, 2026
Merged

Support 16-node distributed Soft-RoCE routing#39
vickiegpt merged 4 commits into
mainfrom
agent/soft-roce-distributed-16node

Conversation

@vickiegpt

@vickiegpt vickiegpt commented Aug 8, 2026

Copy link
Copy Markdown
Collaborator

What changed

  • make the distributed CXLMemSim server route reads and writes across all configured nodes
  • harden RDMA connection setup, framing, retries, and shutdown behavior for Soft-RoCE
  • expose distributed request counters used to verify that traffic crossed the remote path
  • add bounded bulk read/write operations and transfer remote ranges in 64 KiB RDMA chunks
  • use direct range access for RAM/SSD backing and size the registered send/receive region correctly
  • reject overflowing or oversized LSA ranges and cap each connection at 1 GiB, while supporting the 255 MiB/rank vLLM offload pool

Why

The previous path was not robust enough for one 16-node memory pool. The vLLM experiment needs every tensor-parallel rank to reach a different remote memory node instead of forming independent pairs or silently using local memory.

Validation

  • started one 16-node Soft-RoCE CXLMemSim cluster on AWS r7i.large instances
  • verified all 16 servers remained connected and running
  • completed MPI/Splash full-pool tests
  • completed vLLM TP16 tests with TinyLlama and Llama 3.1 70B AWQ INT4
  • server counters confirmed remote reads and writes on the distributed path
  • 5 MiB node 0 to node 1 bulk round trip: 43.0 ms write, 39.9 ms read, byte-for-byte equality passed
  • optimized 70B AMX A/B: two LegoMem replays at 2.263/2.225 s vs 7.141 s No-LegoMem (3.182x median)
  • 6/6 CTest tests passed after the LSA bounds hardening
  • 70B block-size sweep completed at 16/32/64/128 tokens; best single-pair result was 3.136x at block size 32

Signed-off-by: victoryang00 <yangyiwei2000@gmail.com>
Signed-off-by: victoryang00 <yangyiwei2000@gmail.com>
Signed-off-by: victoryang00 <yangyiwei2000@gmail.com>
@vickiegpt
vickiegpt marked this pull request as ready for review August 9, 2026 00:41
Copilot AI lite review requested due to automatic review settings August 9, 2026 00:41
@vickiegpt
vickiegpt merged commit 2bd898e into main Aug 9, 2026
1 check passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR extends CXLMemSim’s distributed server to reliably route memory traffic across a 16-node Soft-RoCE mesh, adding bulk transfer support and strengthening RDMA connection lifecycle handling so distributed workloads (e.g., vLLM TP16) consistently exercise remote memory paths.

Changes:

  • Added bulk read/write operations with bounded sizes and 64 KiB RDMA chunking, plus stricter LSA bounds handling.
  • Reworked RDMA connection setup/accept, buffer sizing, and completion handling to reduce Soft-RoCE QP wedging and improve shutdown behavior.
  • Improved cluster bring-up robustness (RDMA peer connect retries) and added bookkeeping needed for distributed routing/counters.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/shared_memory_manager.cc Adds direct range read/write helpers used by distributed/RDMA bulk paths.
include/shared_memory_manager.h Exposes new read_range / write_range APIs.
src/rdma_communication.cpp Adjusts RDMA buffer registration and completion handling (timeouts, polling, accept flow).
include/rdma_communication.h Updates RDMA message sizing (64 KiB) and server accept API to support many peers.
src/main_server.cc Adds retry loop when connecting RDMA peers during distributed startup.
src/distributed_server.cpp Adds bulk TCP ops, RDMA reconnect retries, LSA hardening, and RDMA server message handling for persistence.
include/distributed_server.h Extends distributed/RDMA connection state and adds bulk API declarations.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +613 to +631
const uint64_t capacity = header->num_cachelines * SHM_CACHELINE_SIZE;
const uint64_t base = header->base_addr;
if (capacity == 0 || (base != 0 && addr < base))
return false;
const uint64_t offset = base == 0 ? addr % capacity : addr - base;
if (offset > capacity || size > capacity - offset)
return false;

if (backing_mode == BackingMode::SsdStream) {
#ifdef CXLMEMSIM_HAS_SSD_STREAMING_BACKEND
return ssd_backend && call_backend_bool([&]() { return ssd_backend->read(offset, buffer, size); });
#else
return false;
#endif
}
if (!data_area)
return false;
memcpy(buffer, data_area + offset, size);
return true;
Comment on lines +637 to +656
const uint64_t capacity = header->num_cachelines * SHM_CACHELINE_SIZE;
const uint64_t base = header->base_addr;
if (capacity == 0 || (base != 0 && addr < base))
return false;
const uint64_t offset = base == 0 ? addr % capacity : addr - base;
if (offset > capacity || size > capacity - offset)
return false;

if (backing_mode == BackingMode::SsdStream) {
#ifdef CXLMEMSIM_HAS_SSD_STREAMING_BACKEND
return ssd_backend && call_backend_bool([&]() { return ssd_backend->write(offset, data, size); });
#else
return false;
#endif
}
if (!data_area)
return false;
memcpy(data_area + offset, data, size);
__atomic_thread_fence(__ATOMIC_RELEASE);
return true;
Comment on lines +2196 to +2214
bool delivered = false;
for (int attempt = 0; attempt < 16; ++attempt) {
if (it->second.client && it->second.client->send_request(rdma_req, rdma_resp) == 0) {
delivered = true;
break;
}

// A Soft-RoCE QP can remain nominally RTS while no completion ever
// arrives. Recreate that one directed connection and replay the
// idempotent cacheline READ/WRITE instead of wedging the whole MPI job.
SPDLOG_WARN("Reconnecting RDMA peer node {} after request failure (attempt {}/16)", dst_node, attempt + 1);
auto replacement = std::make_unique<RDMAClient>(it->second.endpoint_addr, it->second.endpoint_port);
if (replacement->connect() == 0) {
it->second.client = std::move(replacement);
it->second.connected = true;
} else {
it->second.connected = false;
std::this_thread::sleep_for(std::chrono::milliseconds(100));
}
Comment on lines 622 to 627
return -1;
}

if (receive_message(msg) < 0) {
if (receive_message(msg, 5000) < 0) {
return -1;
}
Comment on lines +2098 to 2102
bool DistributedRDMATransport::connect_to_node(uint32_t node_id, const std::string &addr, uint16_t port,
uint64_t remote_addr, size_t remote_buffer_size) {
std::lock_guard<std::mutex> lock(connections_mutex_);

auto it = connections_.find(node_id);
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.

2 participants