New semaphore constructors (#559)

More intuitive interfaces for creating semaphores and channels. Also
allows channel construction using third-party bootstrappers directly
without overriding MSCCL++ Bootstrap.
This commit is contained in:
Changho Hwang
2025-07-11 17:10:46 -07:00
committed by GitHub
parent 20eca28942
commit ae56698d67
42 changed files with 847 additions and 529 deletions

View File

@@ -39,16 +39,17 @@ void setupMeshTopology(int rank, int worldsize, void* data, size_t dataSize) {
if (r == rank) continue;
mscclpp::Transport transport = mscclpp::Transport::CudaIpc;
// Connect with all other ranks
connections[r] = comm.connect(r, 0, transport);
connections[r] = comm.connect(transport, r);
auto memory = comm.registerMemory(data, dataSize, mscclpp::Transport::CudaIpc | ibTransport);
localMemories.push_back(memory);
comm.sendMemory(memory, r, 0);
remoteMemories.push_back(comm.recvMemory(r, 0));
comm.sendMemory(memory, r);
remoteMemories.push_back(comm.recvMemory(r));
}
for (int r = 0; r < world_size; ++r) {
if (r == rank) continue;
semaphoreIds.push_back(proxyService.buildAndAddSemaphore(comm, connections[r].get()));
auto sema = communicator->buildSemaphore(connections[r].get(), r).get();
semaphoreIds.push_back(proxyService->addSemaphore(sema));
}
std::vector<DeviceHandle<mscclpp::PortChannel>> portChannels;