Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
ARG SGLANG_IMAGE_TAG=v0.5.15.post1-cu129
ARG SGLANG_IMAGE_TAG=v0.5.17-cu129
FROM slimerl/sglang:${SGLANG_IMAGE_TAG} AS sglang

# ======================================== Arguments =============================================

ARG PATCH_VERSION=latest
ARG MEGATRON_COMMIT=1dcf0dafa884ad52ffb243625717a3471643e087
ARG DEEPGEMM_COMMIT=b38a77cd193cf38f670caae192310521d24343be
ARG DEEPEP_COMMIT=6845ffd9d59126ec0030c13e0e155935a61e5b5a
ARG DEEPGEMM_COMMIT=7ad54cbd80ebe24ad36cb5cd3729f37beed420bb
ARG DEEPEP_COMMIT=c5c2b0cfa767b1afeb4d237c4ed7e5ff062a550d
ARG DEEPEP_CUDA_ARCH_LIST=
ARG FLASH_QLA_COMMIT=821fd9d37ede18fdc2a4e707fefe3770bfc32e58
ARG TRANSFORMER_ENGINE_COMMIT=c9877beb87ad7e711e1869dd0b5062167ede447a
Expand Down Expand Up @@ -39,7 +39,7 @@ RUN if [ "$(python -c 'import torch; print(torch.version.cuda.split(".")[0])')"
fi

RUN pip install flash-linear-attention==0.4.2
# FlashQLA currently requires TileLang 0.1.9, while SGLang 0.5.15.post1 on
# FlashQLA currently requires TileLang 0.1.9, while SGLang 0.5.17 on
# CUDA 13 requires 0.1.11. Keep the existing CUDA 12 installation and use
# the default FLA backend on CUDA 13 instead of downgrading SGLang's runtime.
RUN if [ "$(python -c 'import torch; print(torch.version.cuda.split(".")[0])')" = "12" ]; then \
Expand Down Expand Up @@ -69,9 +69,9 @@ RUN git clone https://github.com/NVIDIA/Megatron-LM.git --recursive && \
cd Megatron-LM && git checkout ${MEGATRON_COMMIT} && \
pip install -e .

# zhuzilin fork builds, grouped together right after Megatron-LM:
# torch_memory_saver, plus the GLM-5 train/rollout alignment kernels
# (DeepGEMM batch-invariant selection and the DeepEP low-latency fork).
# Alignment builds, grouped together right after Megatron-LM:
# torch_memory_saver, plus the GLM-5 train/rollout alignment kernels rebased
# onto the DeepGEMM and DeepEP revisions shipped with SGLang 0.5.17.
RUN TMS_CUDA_MAJOR="${TMS_CUDA_MAJOR:-$(python -c 'import torch; print(torch.version.cuda.split(".")[0])')}" && \
export TMS_CUDA_MAJOR && \
pip install git+https://github.com/zhuzilin/torch_memory_saver.git@${TMS_COMMIT} --no-cache-dir --force-reinstall
Expand All @@ -84,7 +84,8 @@ RUN git clone https://github.com/zhuzilin/DeepGEMM.git --recursive && \
pip install --force-reinstall --no-deps dist/sgl_deep_gemm-*.whl && \
cd /root/ && rm -rf DeepGEMM

# DeepEP low-latency alignment fork. CUDA 13 relocated the CCCL/libcu++ headers
# DeepEP fork with low-latency FP8 alignment for SGLang 0.5.15.post1 and 0.5.17.
# CUDA 13 relocated the CCCL/libcu++ headers
# (<cuda/std/*>) under include/cccl, which nvshmem_tensor.h includes, so add that
# directory to the compile search path (nvcc + host compiler) when it exists.
RUN git clone https://github.com/zhuzilin/DeepEP.git /root/DeepEP && \
Expand Down
25 changes: 14 additions & 11 deletions docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ We will publish 2 kinds of docker images:
2. latest version, which aligns to `lmsysorg/sglang:latest`.

current stable version is:
- sglang v0.5.15.post1 (0b3bb0cbe31873994c9f989fddfe2f87ca839fdd), megatron dev 1dcf0dafa884ad52ffb243625717a3471643e087
- sglang v0.5.17 (29481685462732237d80d86076d6563e1f658102), megatron dev 1dcf0dafa884ad52ffb243625717a3471643e087

history versions:
- sglang v0.5.15.post1 (0b3bb0cbe31873994c9f989fddfe2f87ca839fdd), megatron dev 1dcf0dafa884ad52ffb243625717a3471643e087
- sglang v0.5.13 (28b095c01005d4a3a2a5b637b7d028b07fba31b2), megatron dev 1dcf0dafa884ad52ffb243625717a3471643e087
- sglang v0.5.12.post1 (5a15cde858ea09b77116212a39356f2fc51b8584), megatron dev 1dcf0dafa884ad52ffb243625717a3471643e087
- sglang v0.5.10.post1 (7c35342c10e201899e22fe2972d40e60da19ff3e), megatron dev 1dcf0dafa884ad52ffb243625717a3471643e087
Expand All @@ -20,39 +21,41 @@ history versions:
The commands to build and publish:

```bash
just release-primary # CUDA 12 (cu129 base): publishes `latest`, `latest-cu129`, `<version>-cu129`
just release-cu13 # CUDA 13 (cu130 base, Blackwell): publishes `latest-cu130`, `<version>-cu130`
just release-primary # publishes both CUDA 12 and CUDA 13 variants below
just release-cu12 # cu129 base: `latest`, `latest-cu129`, `<version>-cu129`
just release-cu13 # cu130 base: `latest-cu130`, `<version>-cu130`
```

`slimerl/slime:latest` tracks the CUDA 12 build. The tag suffixes (`-cu129` /
`-cu130`) match the SGLang base image. `docker/Dockerfile` branches on the base
image's CUDA version; it defaults to the cu130 SGLang base, and the cu129 base
image's CUDA version; it defaults to the cu129 SGLang base, and the cu130 base
is selected via build args (see `docker/justfile`).

To build a single image directly without publishing:

```bash
# CUDA 12
docker build -f docker/Dockerfile . \
--build-arg SGLANG_IMAGE_TAG=v0.5.15.post1-cu129 \
--build-arg SGLANG_IMAGE_TAG=v0.5.17-cu129 \
-t slimerl/slime:latest-cu129

# CUDA 13 (Blackwell)
docker build -f docker/Dockerfile . \
--build-arg DEEPEP_CUDA_ARCH_LIST='10.0 10.3' \
--build-arg SGLANG_IMAGE_TAG=v0.5.15.post1-cu130 \
--build-arg SGLANG_IMAGE_TAG=v0.5.17-cu130 \
-t slimerl/slime:latest-cu130
```

The following components are pinned and rebuilt in the image:

- Megatron-LM `1dcf0dafa884ad52ffb243625717a3471643e087`, plus
`docker/patch/<version>/megatron.patch`.
- DeepGEMM `b38a77cd193cf38f670caae192310521d24343be` from the
`zhuzilin/DeepGEMM` batch-invariant branch, rebuilt as an SGLang-compatible wheel.
- DeepEP `6845ffd9d59126ec0030c13e0e155935a61e5b5a` from the
`zhuzilin/DeepEP` `align_fp8_quantization` branch (GLM-5 low-latency alignment).
- DeepGEMM `7ad54cbd80ebe24ad36cb5cd3729f37beed420bb` from the
`zhuzilin/DeepGEMM` fork. It adds batch-invariant FP8 kernels directly to
the 0.5.17 `v0.1.5` source baseline.
- DeepEP `c5c2b0cfa767b1afeb4d237c4ed7e5ff062a550d` from the
`zhuzilin/DeepEP` fork. It merges the 0.5.17 baseline and provides aligned
low-latency FP8 modes for both SGLang 0.5.15.post1 and 0.5.17.

For a non-default GPU architecture list, pass
`--build-arg DEEPEP_CUDA_ARCH_LIST='<torch arch list>'`.

22 changes: 9 additions & 13 deletions docker/justfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
# Primary release stays on CUDA 12 (the cu129 SGLang base). Publishes the
# unqualified `latest`, plus the rolling `latest-cu129` and the versioned
# `<version>-cu129` tags. The tag suffix matches the SGLang base image.
release-primary:
ARG_TAG_POSTFIX="-cu129" ARG_TAG_LATEST=1 ARG_BUILD_EXTRA_ARGS='--build-arg SGLANG_IMAGE_TAG=v0.5.15.post1-cu129' just _release-raw

# B200/B300 (Blackwell, x86) CUDA 13 build on the cu130 SGLang base. Publishes
# `latest-cu130` and `<version>-cu130` (tag suffix matches the SGLang base
# image). DeepEP must be compiled for the Blackwell arch list; the Dockerfile
# default (9.0) targets Hopper only. The semicolon separator is normalized to
# spaces by PyTorch's TORCH_CUDA_ARCH_LIST parser and survives the unquoted
# ARG_BUILD_EXTRA_ARGS expansion as one token.
# Publish both supported CUDA variants; CUDA 12 owns the unqualified `latest` tag.
release-primary: release-cu12 release-cu13

# Publish CUDA 12 tags: `latest`, `latest-cu129`, and `<version>-cu129`.
release-cu12:
ARG_TAG_POSTFIX="-cu129" ARG_TAG_LATEST=1 ARG_BUILD_EXTRA_ARGS='--build-arg SGLANG_IMAGE_TAG=v0.5.17-cu129' just _release-raw

# Publish B200/B300 CUDA 13 tags; compile DeepEP for Blackwell via the build arg.
release-cu13:
ARG_TAG_POSTFIX="-cu130" ARG_BUILD_EXTRA_ARGS="--build-arg DEEPEP_CUDA_ARCH_LIST=10.0;10.3 --build-arg SGLANG_IMAGE_TAG=v0.5.15.post1-cu130" just _release-raw
ARG_TAG_POSTFIX="-cu130" ARG_BUILD_EXTRA_ARGS="--build-arg DEEPEP_CUDA_ARCH_LIST=10.0;10.3 --build-arg SGLANG_IMAGE_TAG=v0.5.17-cu130" just _release-raw

_release-raw:
#!/bin/bash
Expand Down
23 changes: 20 additions & 3 deletions docker/patch/latest/megatron.patch
Original file line number Diff line number Diff line change
Expand Up @@ -735,14 +735,31 @@ diff --git a/megatron/core/transformer/moe/moe_utils.py b/megatron/core/transfor
index 75825cd37..445b3fb84 100644
--- a/megatron/core/transformer/moe/moe_utils.py
+++ b/megatron/core/transformer/moe/moe_utils.py
@@ -711,6 +711,9 @@ def topk_routing_with_score_function(
@@ -711,6 +711,25 @@ def topk_routing_with_score_function(
scores, topk, num_groups, group_topk, _compute_topk
)

+ from slime.utils.routing_replay import get_routing_replay_compute_topk
+ from slime.utils.routing_replay import (
+ get_routing_replay_compute_topk,
+ maybe_sglang_fused_sigmoid_topk,
+ )
+ compute_topk = get_routing_replay_compute_topk(compute_topk)
+
if score_function == "softmax":
+ aligned_topk = maybe_sglang_fused_sigmoid_topk(
+ logits,
+ topk,
+ use_pre_softmax=use_pre_softmax,
+ num_groups=num_groups,
+ group_topk=group_topk,
+ scaling_factor=scaling_factor,
+ score_function=score_function,
+ expert_bias=expert_bias,
+ replay_active=router_replay is not None,
+ )
+ if aligned_topk is not None:
+ probs, top_indices = aligned_topk
- if score_function == "softmax":
+ elif score_function == "softmax":
if use_pre_softmax:
scores = torch.softmax(logits, dim=-1, dtype=torch.float32).type_as(logits)
diff --git a/megatron/core/transformer/moe/router.py b/megatron/core/transformer/moe/router.py
Expand Down
Loading
Loading