Skip to content

Refactor HT mode - #846

Merged
Binyang Li (Binyang2014) merged 11 commits into
feature/epfrom
binyli/ep
Jul 17, 2026
Merged

Refactor HT mode#846
Binyang Li (Binyang2014) merged 11 commits into
feature/epfrom
binyli/ep

Conversation

@Binyang2014

Copy link
Copy Markdown
Contributor

No description provided.

Binyang Li (Binyang2014) and others added 8 commits July 16, 2026 04:25
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

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 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_padding plumbing for LL TOKEN_MAJOR dispatch (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;

Comment thread src/ext/ep/ht_runtime.cc
Comment thread src/ext/ep/low_latency/dispatch.cu Outdated
Comment thread src/ext/ep/README.md Outdated
Comment thread src/ext/ep/ht_runtime.cc Outdated
Comment thread src/ext/ep/ht_runtime.cc Outdated
Comment thread src/ext/ep/high-throughput/config.cuh
Comment thread src/ext/ep/high-throughput/combine.cu Outdated
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
@Binyang2014
Binyang Li (Binyang2014) merged commit b051c1e into feature/ep Jul 17, 2026
5 checks passed
@Binyang2014
Binyang Li (Binyang2014) deleted the binyli/ep branch July 17, 2026 23:03
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