[GH-ISSUE #2002] 支持 SGLang 的 expert-parallel-size(EP) #1231

Open
opened 2026-10-29 14:50:20 +00:00 by bsakaguchi · 0 comments
Owner

Originally created by @willbed on GitHub (May 13, 2026).
Original GitHub issue: https://github.com/kvcache-ai/ktransformers/issues/2002

Reminder

  • I have read the above rules and searched the existing issues.

Description

目前 kt_ep_wrapper 不支持 SGLang 的 --expert-parallel-size 参数。
TP=8 在 8×L20(无 NVLink)下 PCIe all-reduce 是主要瓶颈,
改用 TP=4+EP=2 通信开销能明显降低。

当前问题

配了 --tensor-parallel-size 4 --expert-parallel-size 2 后,
模型加载阶段崩溃:

RuntimeError: The size of tensor a (192) must match the size of
tensor b (384) at non-singleton dimension 0

gpu_experts_mask 初始化时按 384 个全量 experts 创建,
但 SGLang EP 切分后每个 rank 只剩 192 个 experts,对不上。

期望行为

kt_ep_wrapper 感知 SGLang 的 EP rank,按 EP 切分后的 local expert 数
来创建 gpu_experts_mask,--kt-num-gpu-experts 也应该按 EP rank 自适应。

环境

- 模型:Kimi-K2.6 RAWINT4
- GPU:8×L20(SM89,无 NVLink)
- CPU:双路 Xeon + AMX
- ktransformers:2026 年 5 月 main 分支

Pull Request

No response

Originally created by @willbed on GitHub (May 13, 2026). Original GitHub issue: https://github.com/kvcache-ai/ktransformers/issues/2002 ### Reminder - [x] I have read the above rules and searched the existing issues. ### Description 目前 kt_ep_wrapper 不支持 SGLang 的 --expert-parallel-size 参数。 TP=8 在 8×L20(无 NVLink)下 PCIe all-reduce 是主要瓶颈, 改用 TP=4+EP=2 通信开销能明显降低。 当前问题 配了 --tensor-parallel-size 4 --expert-parallel-size 2 后, 模型加载阶段崩溃: RuntimeError: The size of tensor a (192) must match the size of tensor b (384) at non-singleton dimension 0 gpu_experts_mask 初始化时按 384 个全量 experts 创建, 但 SGLang EP 切分后每个 rank 只剩 192 个 experts,对不上。 期望行为 kt_ep_wrapper 感知 SGLang 的 EP rank,按 EP 切分后的 local expert 数 来创建 gpu_experts_mask,--kt-num-gpu-experts 也应该按 EP rank 自适应。 环境 - 模型:Kimi-K2.6 RAWINT4 - GPU:8×L20(SM89,无 NVLink) - CPU:双路 Xeon + AMX - ktransformers:2026 年 5 月 main 分支 ### Pull Request _No response_
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
kvcache-ai/ktransformers#1231
No description provided.