Refactor HT mode - #846
Merged
Merged
Conversation
Join the server thread during singleton destruction without depending on logging infrastructure whose static lifetime may already have ended. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 7c36271a-777f-4df3-bb1d-6b5569e32e05
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 7c36271a-777f-4df3-bb1d-6b5569e32e05
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 7c36271a-777f-4df3-bb1d-6b5569e32e05
Rename the HT source directory, split dispatch and combine, remove the ring fallback, and tighten cross-rank synchronization. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 59760d2a-e65f-44b6-b2e6-9c271b834d7e
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors the EP high-throughput (HT) backend into a single direct-dispatch/direct-combine path (moving implementation under src/ext/ep/high-throughput/ and simplifying the API/config surface), and adds an opt-in low-latency (LL) TOKEN_MAJOR padding initialization mode intended to support fixed-capacity kernels without a CPU sync.
Changes:
- Refactor HT to a direct receive-pool design (new
high-throughput/{dispatch,combine,layout,runtime}.cu, simplified config, updated bindings and Python backend). - Add
token_major_init_paddingplumbing for LLTOKEN_MAJORdispatch (C++/CUDA + Python + tests/bench flags/docs). - Improve Unix socket server lifecycle management (explicit
shutdown()+ destructor cleanup).
Reviewed changes
Copilot reviewed 30 out of 30 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| test/python/ep/test_low_latency_multirank.py | Adds CLI flag and validation for compact TOKEN_MAJOR offsets + optional padding initialization checks. |
| test/python/ep/test_intranode_multirank.py | Updates HT test to match new direct path and validates returned combined weights. |
| test/python/ep/run_ep_bench.py | Plumbs --token-major-init-padding through benchmark command construction. |
| test/python/ep/ep_bench_ll.py | Adds --token-major-init-padding and passes it into LL communicator config. |
| src/ext/ep/README.md | Updates LL TOKEN_MAJOR description (offsets + padding) and rewrites HT description for direct-only path. |
| src/ext/ep/moe_runtime.hpp | Extends LL MoERuntime ctor with initializeTokenMajorPadding state. |
| src/ext/ep/moe_runtime.cc | Wires initializeTokenMajorPadding into LL dispatch workload; keeps combine disabled for it. |
| src/ext/ep/low_latency/dispatch.cu | Implements token-major offsets and optional padding metadata initialization; tightens dispatch argument asserts. |
| src/ext/ep/low_latency/combine.cu | Switches token-major addressing to rank offsets; tightens combine argument asserts. |
| src/ext/ep/include/launch.cuh | Updates rank-switch macro signature; sets cooperative launch attributes via SETUP_LAUNCH_CONFIG. |
| src/ext/ep/include/api.cuh | Renames HT namespace/API to high_throughput::*; updates docs for token-major layoutRange semantics and adds workload flag. |
| src/ext/ep/ht/layout.cu | Deleted legacy HT ring layout implementation (replaced by high-throughput/layout.cu). |
| src/ext/ep/ht/intranode_kernel.cu | Deleted legacy HT ring + optional-path kernels (replaced by direct-only kernels). |
| src/ext/ep/ht/config.hpp | Deleted legacy HT ring-tuning config. |
| src/ext/ep/ht/buffer.cuh | Deleted legacy HT ring buffer view helpers. |
| src/ext/ep/ht_runtime.hpp | Updates HT runtime interface/state to match direct-only backend and new config type. |
| src/ext/ep/ht_runtime.cc | Refactors HT runtime to direct-only dispatch/combine and adds collective “direct ready” gating. |
| src/ext/ep/high-throughput/runtime.cu | Implements HT barrier launcher under new namespace. |
| src/ext/ep/high-throughput/layout.cu | New HT routing layout kernel under high_throughput. |
| src/ext/ep/high-throughput/dispatch.cu | New cooperative direct dispatch kernel that writes into peer recv pools + drains metadata locally. |
| src/ext/ep/high-throughput/config.cuh | New simplified HT config and receive-pool sizing helpers. |
| src/ext/ep/high-throughput/combine.cu | New cooperative TMA gather/reduce combine kernel for HT. |
| src/ext/ep/CMakeLists.txt | Switches HT sources/includes from ht/ to high-throughput/. |
| src/ext/ep/bindings.cpp | Updates nanobind exports for new LL ctor arg and new HT config/runtime signatures. |
| src/core/unix_socket.cc | Adds shutdown() and destructor cleanup; adjusts stop() behavior/logging. |
| src/core/include/unix_socket.hpp | Declares ~UnixSocketServer() and new private shutdown() helper. |
| python/mscclpp/ep/types.py | Adds token_major_init_padding and LL token-major rank_offsets; trims HT combine context fields. |
| python/mscclpp/ep/README.md | Documents compact token-major offsets + padding option; updates HT combine-handle description. |
| python/mscclpp/ep/low_latency.py | Plumbs token-major padding option; uses offsets tensor; improves layout validation/errors. |
| python/mscclpp/ep/high_throughput.py | Updates HT backend to direct receive-pool only; removes ring-era tensors from dispatch/combine API. |
Comments suppressed due to low confidence (1)
src/core/unix_socket.cc:153
- shutdown() is now called from both stop() and the destructor, but it is not fully idempotent: it always calls ::close(listenUnixSockFd_) (which may be -1) and unlinks listenUnixSockPath_ without clearing it. Making shutdown() guard close/unlink and clearing the path avoids spurious errors on repeated shutdown calls and makes cleanup safer if stop() is called explicitly before destruction.
void UnixSocketServer::shutdown() {
*abortFlag_ = 1;
if (mainThread_.joinable()) {
mainThread_.join();
}
::close(listenUnixSockFd_);
listenUnixSockFd_ = -1;
Harden direct-buffer bounds, make the internal receive pool unconditional, move SM tuning to the API, use shared TMA helpers, and update token-major padding sentinels. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 59760d2a-e65f-44b6-b2e6-9c271b834d7e
Resolve token-major padding conflicts by retaining the reviewed num_experts sentinel behavior. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 59760d2a-e65f-44b6-b2e6-9c271b834d7e
Use issueTmaLoad for enqueueing transfers and issueTmaLoadAndExpect for the single-transfer convenience path. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 59760d2a-e65f-44b6-b2e6-9c271b834d7e
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.