[Fix] Keep Kimi image dependency baseline for Phase 5

This commit is contained in:
Zhiyi Hong 2026-08-18 12:45:44 +08:00
parent c14f8aa43a
commit b50de8fe99
4 changed files with 27 additions and 9 deletions

View File

@ -18,15 +18,20 @@ RUN python3 -m pip install --no-deps --force-reinstall \
# SM120 AOT artifacts that passed the Phase 3/4 correctness gate. # SM120 AOT artifacts that passed the Phase 3/4 correctness gate.
COPY aot/ /usr/local/lib/python3.12/dist-packages/flashinfer/data/aot/ COPY aot/ /usr/local/lib/python3.12/dist-packages/flashinfer/data/aot/
# Use the complete tested SGLang Python package, not a pair of loose runtime # Apply only the two production source changes from SGLang commit fb929bb. The
# mounts. This preserves API compatibility between the two changed modules and # Kimi base image intentionally pins sglang-kernel 0.4.5, so replacing the
# their surrounding Kimi/MoE integration. # entire newer Python tree would create a false package-version dependency.
COPY sglang/ /sgl-workspace/sglang/python/sglang/ COPY sglang.patch /tmp/sglang.patch
RUN patch --dry-run --batch --forward -p1 -d /sgl-workspace/sglang \
< /tmp/sglang.patch && \
patch --batch --forward -p1 -d /sgl-workspace/sglang \
< /tmp/sglang.patch && \
rm -f /tmp/sglang.patch
# Existing Kimi image compatibility fix: tcgen05 attention-residual is valid on # Existing Kimi image compatibility fix: tcgen05 attention-residual is valid on
# SM100/SM103, not consumer Blackwell SM120. Bake the fallback into the image. # SM100/SM103, not consumer Blackwell SM120. Bake the fallback into the image.
RUN python3 -c "from pathlib import Path; p=Path('/sgl-workspace/sglang/python/sglang/srt/layers/attn_residual.py'); s=p.read_text(); old=' _FAST_SUPPORTED = major >= 10'; new=' _FAST_SUPPORTED = major in (10, 11)'; assert old in s; p.write_text(s.replace(old,new))" && \ RUN python3 -c "from pathlib import Path; p=Path('/sgl-workspace/sglang/python/sglang/srt/layers/attn_residual.py'); s=p.read_text(); old=' _FAST_SUPPORTED = major >= 10'; new=' _FAST_SUPPORTED = major in (10, 11)'; assert old in s; p.write_text(s.replace(old,new))" && \
python3 -m compileall -q /sgl-workspace/sglang/python/sglang && \ python3 -m compileall -q /sgl-workspace/sglang/python/sglang/srt/layers && \
python3 -c "from flashinfer.fused_moe import core; assert core.CUTLASS_FUSED_MOE_SUPPORTS_SITU is True" python3 -c "from flashinfer.fused_moe import core; assert core.CUTLASS_FUSED_MOE_SUPPORTS_SITU is True"
LABEL ai.meta-stone.purpose="Kimi-K3 SM120 FlashInfer MXFP4 Phase 5 acceptance" \ LABEL ai.meta-stone.purpose="Kimi-K3 SM120 FlashInfer MXFP4 Phase 5 acceptance" \

View File

@ -70,3 +70,8 @@ results/<RUN_ID>/
The run aborts on a failed service start, any failed request, a missing result, The run aborts on a failed service start, any failed request, a missing result,
or an image capability smoke failure. Containers are removed on exit. or an image capability smoke failure. Containers are removed on exit.
The candidate image preserves the Kimi base image's dependency set. It installs
the patched FlashInfer wheel/AOT libraries and applies only the two production
source files from SGLang commit `fb929bb`; it does not replace the complete
SGLang Python tree or require a newer `sglang-kernel` package.

View File

@ -15,7 +15,8 @@ BASE_IMAGE="${BASE_IMAGE:-lmsysorg/sglang:kimi-k3-fiv617situ-warm}"
CANDIDATE_IMAGE="${CANDIDATE_IMAGE:-local/sglang:kimi-k3-sm120-flashinfer-mxfp4-phase5}" CANDIDATE_IMAGE="${CANDIDATE_IMAGE:-local/sglang:kimi-k3-sm120-flashinfer-mxfp4-phase5}"
FLASHINFER_TARGET="${FLASHINFER_TARGET:-/tmp/hzy-fi-situ-phase3-v3}" FLASHINFER_TARGET="${FLASHINFER_TARGET:-/tmp/hzy-fi-situ-phase3-v3}"
FLASHINFER_WHEEL="${FLASHINFER_WHEEL:-/data/hzy/artifacts/flashinfer-kimi-sm120-situ-phase3-v3/flashinfer_python-0.6.18-py3-none-any.whl}" FLASHINFER_WHEEL="${FLASHINFER_WHEEL:-/data/hzy/artifacts/flashinfer-kimi-sm120-situ-phase3-v3/flashinfer_python-0.6.18-py3-none-any.whl}"
SGLANG_SOURCE="${SGLANG_SOURCE:-/data/hzy/src/sglang-kimi-sm120/python/sglang}" SGLANG_REPO="${SGLANG_REPO:-/data/hzy/src/sglang-kimi-sm120}"
SGLANG_PATCH_COMMIT="${SGLANG_PATCH_COMMIT:-fb929bb}"
BENCH_DATASET_NAME="${BENCH_DATASET_NAME:-random-ids}" BENCH_DATASET_NAME="${BENCH_DATASET_NAME:-random-ids}"
BENCH_MODULE="${BENCH_MODULE:-sglang.benchmark.serving}" BENCH_MODULE="${BENCH_MODULE:-sglang.benchmark.serving}"

View File

@ -79,7 +79,7 @@ sudo_host() {
check_inputs() { check_inputs() {
local path local path
for path in "$MODEL_PATH" "$FLASHINFER_TARGET/flashinfer" \ for path in "$MODEL_PATH" "$FLASHINFER_TARGET/flashinfer" \
"$FLASHINFER_WHEEL" "$SGLANG_SOURCE"; do "$FLASHINFER_WHEEL" "$SGLANG_REPO/.git"; do
[[ -e "$path" ]] || { echo "ERROR: required path missing: $path" >&2; exit 2; } [[ -e "$path" ]] || { echo "ERROR: required path missing: $path" >&2; exit 2; }
done done
[[ -d "$FLASHINFER_TARGET/flashinfer/data/aot/fused_moe_120" ]] || { [[ -d "$FLASHINFER_TARGET/flashinfer/data/aot/fused_moe_120" ]] || {
@ -91,11 +91,18 @@ check_inputs() {
prepare_build_context() { prepare_build_context() {
log "preparing candidate image context at ${BUILD_CONTEXT}" log "preparing candidate image context at ${BUILD_CONTEXT}"
rm -rf "$BUILD_CONTEXT" rm -rf "$BUILD_CONTEXT"
mkdir -p "$BUILD_CONTEXT/aot" "$BUILD_CONTEXT/sglang" mkdir -p "$BUILD_CONTEXT/aot"
cp "$SCRIPT_DIR/Dockerfile" "$BUILD_CONTEXT/Dockerfile" cp "$SCRIPT_DIR/Dockerfile" "$BUILD_CONTEXT/Dockerfile"
cp "$FLASHINFER_WHEEL" "$BUILD_CONTEXT/flashinfer_python-0.6.18-py3-none-any.whl" cp "$FLASHINFER_WHEEL" "$BUILD_CONTEXT/flashinfer_python-0.6.18-py3-none-any.whl"
cp -a "$FLASHINFER_TARGET/flashinfer/data/aot/." "$BUILD_CONTEXT/aot/" cp -a "$FLASHINFER_TARGET/flashinfer/data/aot/." "$BUILD_CONTEXT/aot/"
cp -a "$SGLANG_SOURCE/." "$BUILD_CONTEXT/sglang/" git -C "$SGLANG_REPO" show --format= --binary "$SGLANG_PATCH_COMMIT" -- \
python/sglang/srt/layers/moe/moe_runner/flashinfer_cutlass.py \
python/sglang/srt/layers/quantization/mxfp4.py \
>"$BUILD_CONTEXT/sglang.patch"
[[ -s "$BUILD_CONTEXT/sglang.patch" ]] || {
echo "ERROR: empty SGLang patch from ${SGLANG_PATCH_COMMIT}" >&2
exit 2
}
find "$BUILD_CONTEXT" -type d -name __pycache__ -prune -exec rm -rf {} + find "$BUILD_CONTEXT" -type d -name __pycache__ -prune -exec rm -rf {} +
find "$BUILD_CONTEXT" -type f -name '*.pyc' -delete find "$BUILD_CONTEXT" -type f -name '*.pyc' -delete
du -sh "$BUILD_CONTEXT" | tee "$RESULT_ROOT/build/context_size.txt" du -sh "$BUILD_CONTEXT" | tee "$RESULT_ROOT/build/context_size.txt"