Dockerfile.canary 4.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. # Upstream dsv4.1 branch image (optional TP4 image without RoCEnante, docs/tp4-optional-setups.md).
  2. # Same pinned base image as Dockerfile, but the SGLang python tree is replaced by the upstream
  3. # dsv4.1 branch at f80c91a4b (2026-09-16), fetched at build at the commit and sha256 in
  4. # runtime/sources.manifest, together with the kernel packages that branch pins (sglang-kernel
  5. # 0.4.7, sgl-deep-gemm 0.2.0; aarch64 wheels from PyPI). The SM120 page-split fix from
  6. # runtime/flash_mla_sm120.py is re-applied on top of the branch's kernel file
  7. # (runtime/flash_mla_sm120.canary.py). Everything else is identical to Dockerfile.
  8. #
  9. # docker build -f Dockerfile.canary -t dsv41-4x-spark:canary . # on every node
  10. # IMAGE=dsv41-4x-spark:canary in .env.tp4, plus SGLANG_DSPARK_FOLDED_SAMPLING=2
  11. FROM lmsysorg/sglang:dev-dsv41@sha256:3dbc313030a6ef2c5d7de8ecf48e9aece722694a82182cb618cc82b588816349 AS fetch
  12. COPY runtime/sources.manifest runtime/sglang-rocenante.patch runtime/flash_mla_sm120.canary.py /src/runtime/
  13. COPY scripts/fetch_runtime.sh scripts/b12x_next-compact-n64-m64.patch scripts/roce_ring-sparkring-f16b5f4.patch /src/scripts/
  14. RUN bash /src/scripts/fetch_runtime.sh /fetched sglang-canary
  15. FROM lmsysorg/sglang:dev-dsv41@sha256:3dbc313030a6ef2c5d7de8ecf48e9aece722694a82182cb618cc82b588816349
  16. # The two kernel wheels come from PyPI. A network without pypi.org points this at a
  17. # mirror: `docker build --build-arg PIP_INDEX=https://<mirror>/simple`, or BUILD_ARGS
  18. # in .env.tp4 when `./start.sh build` builds the image for you.
  19. ARG PIP_INDEX=https://pypi.org/simple
  20. RUN pip install --no-deps --no-cache-dir -i "$PIP_INDEX" "sglang-kernel==0.4.7" "sgl-deep-gemm==0.2.0"
  21. RUN rm -rf /sgl-workspace/sglang/python
  22. COPY --from=fetch /fetched/sglang-canary/python /sgl-workspace/sglang/python
  23. RUN python3 -c "import sglang, sglang.srt.models.deepseek_v4, sglang.srt.layers.attention.deepseek_v4_backend, sglang.srt.models.deepseek_v4_dspark; print('import ok')"
  24. WORKDIR /opt/dsv41
  25. COPY adapter /opt/dsv41/adapter
  26. RUN g++ -O2 -Wall -Wextra -Werror -std=c++17 -shared -fPIC -pthread \
  27. -DDSV41_ROW_STORE_DRM adapter/row_store.cpp -o adapter/librow_store.so
  28. COPY runtime/flash_mla_sm120.canary.py /sgl-workspace/sglang/python/sglang/kernels/ops/attention/flash_mla_sm120.py
  29. COPY boot.py /opt/dsv41/boot.py
  30. COPY scripts /opt/dsv41/scripts
  31. COPY tests /opt/dsv41/tests
  32. COPY benchmarks /opt/dsv41/benchmarks
  33. RUN PYTHONPATH=/opt/dsv41/adapter python3 /opt/dsv41/tests/test_thinking_alias.py \
  34. && PYTHONPATH=/opt/dsv41/adapter python3 /opt/dsv41/tests/test_max_new_tokens.py \
  35. && PYTHONPATH=/opt/dsv41/adapter python3 /opt/dsv41/tests/test_loop_abort.py \
  36. && PYTHONPATH=/opt/dsv41/adapter python3 /opt/dsv41/tests/test_fast_load_pacing.py \
  37. && PYTHONPATH=/opt/dsv41/adapter python3 /opt/dsv41/tests/test_wo_a_w8.py \
  38. && PYTHONPATH=/opt/dsv41/adapter python3 /opt/dsv41/tests/test_draft_tau.py \
  39. && PYTHONPATH=/opt/dsv41/adapter python3 /opt/dsv41/tests/test_folded_fence.py \
  40. && PYTHONPATH=/opt/dsv41/adapter python3 /opt/dsv41/tests/test_draft_head_fp8.py \
  41. && PYTHONPATH=/opt/dsv41/adapter python3 /opt/dsv41/tests/test_draft_head_fp8_tp4.py \
  42. && BV_TEST_N=60000 PYTHONPATH=/opt/dsv41/adapter python3 /opt/dsv41/tests/test_block_verify.py \
  43. && PYTHONPATH=/opt/dsv41/adapter python3 /opt/dsv41/tests/test_autotune_keep.py \
  44. && CUDA_VISIBLE_DEVICES= PYTHONPATH=/opt/dsv41/adapter python3 /opt/dsv41/tests/test_replicated_split.py \
  45. && CUDA_VISIBLE_DEVICES= VC_TEST_N=60000 PYTHONPATH=/opt/dsv41/adapter python3 /opt/dsv41/tests/test_verify_cap.py \
  46. && cd /opt/dsv41/tests && CUDA_VISIBLE_DEVICES= PYTHONPATH=/opt/dsv41/adapter python3 test_indexer_chunked_v3.py /sgl-workspace/sglang/python/sglang/srt/layers/attention/deepseek_v4_backend.py
  47. ENV PYTHONPATH=/opt/dsv41/adapter \
  48. MODEL_PATH=/models/DeepSeek-V4.1-Flash \
  49. STATE_PATH=/state OFFLOAD_MODE=nvme DSV41_CACHE_GIB=16
  50. EXPOSE 8888
  51. HEALTHCHECK --interval=30s --timeout=30s --start-period=30m --retries=3 \
  52. CMD ["python3", "-S", "/opt/dsv41/boot.py", "health"]
  53. ENTRYPOINT ["python3", "-u", "/opt/dsv41/boot.py"]
  54. CMD ["run"]