Dockerfile.canary-roce 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. # TP4 production image (.env.tp4.example, docs/tp4.md). Same pinned base image as Dockerfile, but
  2. # the SGLang python tree replaced by the upstream dsv4.1 branch at f80c91a4b (2026-09-16 19:45 UTC;
  3. # carries #39370 mHC/metadata fusion, #39653 communication kernels, #39648 top-k, #39646 kernels)
  4. # with the kernel packages the branch pins (sglang-kernel 0.4.7, sgl-deep-gemm 0.2.0; aarch64
  5. # wheels from PyPI), rhys101's SG17 RoCEnante overlay adapted to TP4, the SG17 b12x (RoCEnante)
  6. # plus sparkring's roce_ring, b12x main as b12x_next (routed MoE at EP_SIZE=1), and all adapters.
  7. # The SM120 page-split override (runtime/flash_mla_sm120.py) is re-applied on top of the branch's
  8. # kernel file. Third-party trees are fetched at build, at the commits and sha256 in
  9. # runtime/sources.manifest (scripts/fetch_runtime.sh), and patched with the files in this repo.
  10. # Tag: dsv41-4x-spark:canary-roce
  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 b12x b12x-next
  15. FROM lmsysorg/sglang:dev-dsv41@sha256:3dbc313030a6ef2c5d7de8ecf48e9aece722694a82182cb618cc82b588816349
  16. # Same mirror knob as Dockerfile.canary (Saolence, #6): --build-arg PIP_INDEX=<mirror>/simple
  17. ARG PIP_INDEX=https://pypi.org/simple
  18. RUN pip install --no-deps --no-cache-dir -i "$PIP_INDEX" "sglang-kernel==0.4.7" "sgl-deep-gemm==0.2.0"
  19. RUN rm -rf /sgl-workspace/sglang/python
  20. COPY --from=fetch /fetched/sglang-canary/python /sgl-workspace/sglang/python
  21. 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')"
  22. # RoCEnante overlay (SG17, rhys101) applied to the branch tree with offsets, then adapted to TP4
  23. COPY runtime/sglang-rocenante.patch runtime/roce_tp4_adapt.py /tmp/
  24. RUN cd /sgl-workspace/sglang && patch -p1 -F3 < /tmp/sglang-rocenante.patch && python3 /tmp/roce_tp4_adapt.py && rm /tmp/sglang-rocenante.patch /tmp/roce_tp4_adapt.py
  25. COPY --from=fetch /fetched/b12x/b12x /opt/b12x/b12x
  26. COPY --from=fetch /fetched/b12x/LICENSE /opt/b12x/LICENSE
  27. RUN PYTHONPATH=/opt/b12x python3 -c "from b12x.comm import roce; print('roce', roce.API_VERSION)"
  28. # b12x main renamed to b12x_next (scripts/fetch_runtime.sh) for adapter/moe_b12x_next.py, beside
  29. # the SG17 b12x that RoCEnante needs; its JIT/tuning cache is B12X_NEXT_COMPILE_CACHE_DIR.
  30. COPY --from=fetch /fetched/b12x_next/b12x_next /opt/b12x_next/b12x_next
  31. COPY --from=fetch /fetched/b12x_next/LICENSE /opt/b12x_next/LICENSE
  32. RUN PYTHONPATH=/opt/b12x:/opt/b12x_next python3 -c "import b12x.comm.roce, b12x_next.moe.fused_moe; print('b12x_next', open('/opt/b12x_next/b12x_next/SOURCE_COMMIT').read().strip())"
  33. WORKDIR /opt/dsv41
  34. COPY adapter /opt/dsv41/adapter
  35. RUN g++ -O2 -Wall -Wextra -Werror -std=c++17 -shared -fPIC -pthread \
  36. -DDSV41_ROW_STORE_DRM adapter/row_store.cpp -o adapter/librow_store.so
  37. COPY runtime/flash_mla_sm120.canary.py /sgl-workspace/sglang/python/sglang/kernels/ops/attention/flash_mla_sm120.py
  38. COPY boot.py /opt/dsv41/boot.py
  39. COPY scripts /opt/dsv41/scripts
  40. COPY tests /opt/dsv41/tests
  41. COPY benchmarks /opt/dsv41/benchmarks
  42. RUN PYTHONPATH=/opt/dsv41/adapter python3 /opt/dsv41/tests/test_thinking_alias.py \
  43. && PYTHONPATH=/opt/dsv41/adapter python3 /opt/dsv41/tests/test_max_new_tokens.py \
  44. && PYTHONPATH=/opt/dsv41/adapter python3 /opt/dsv41/tests/test_loop_abort.py \
  45. && PYTHONPATH=/opt/dsv41/adapter python3 /opt/dsv41/tests/test_fast_load_pacing.py \
  46. && CUDA_VISIBLE_DEVICES= PYTHONPATH=/opt/dsv41/adapter python3 /opt/dsv41/tests/test_fast_load_tp_slice.py \
  47. && CUDA_VISIBLE_DEVICES= PYTHONPATH=/opt/dsv41/adapter python3 /opt/dsv41/tests/test_prefill_sp.py \
  48. && CUDA_VISIBLE_DEVICES= PYTHONPATH=/opt/dsv41/adapter python3 /opt/dsv41/tests/test_fast_load_slab.py \
  49. && CUDA_VISIBLE_DEVICES= PYTHONPATH=/opt/dsv41/adapter python3 /opt/dsv41/tests/test_moe_b12x_next_cpu.py \
  50. && PYTHONPATH=/opt/dsv41/adapter python3 /opt/dsv41/tests/test_wo_a_w8.py \
  51. && PYTHONPATH=/opt/dsv41/adapter python3 /opt/dsv41/tests/test_draft_tau.py \
  52. && PYTHONPATH=/opt/dsv41/adapter python3 /opt/dsv41/tests/test_folded_fence.py \
  53. && PYTHONPATH=/opt/dsv41/adapter python3 /opt/dsv41/tests/test_draft_head_fp8.py \
  54. && PYTHONPATH=/opt/dsv41/adapter python3 /opt/dsv41/tests/test_draft_head_fp8_tp4.py \
  55. && BV_TEST_N=60000 PYTHONPATH=/opt/dsv41/adapter python3 /opt/dsv41/tests/test_block_verify.py \
  56. && PYTHONPATH=/opt/dsv41/adapter python3 /opt/dsv41/tests/test_autotune_keep.py \
  57. && CUDA_VISIBLE_DEVICES= PYTHONPATH=/opt/dsv41/adapter python3 /opt/dsv41/tests/test_replicated_split.py \
  58. && CUDA_VISIBLE_DEVICES= VC_TEST_N=60000 PYTHONPATH=/opt/dsv41/adapter python3 /opt/dsv41/tests/test_verify_cap.py \
  59. && CUDA_VISIBLE_DEVICES= python3 /opt/dsv41/tests/test_roce_ring.py \
  60. && 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
  61. ENV PYTHONPATH=/opt/dsv41/adapter:/opt/b12x:/opt/b12x_next \
  62. MODEL_PATH=/models/DeepSeek-V4.1-Flash \
  63. STATE_PATH=/state OFFLOAD_MODE=nvme DSV41_CACHE_GIB=16
  64. EXPOSE 8888
  65. HEALTHCHECK --interval=30s --timeout=30s --start-period=30m --retries=3 \
  66. CMD ["python3", "-S", "/opt/dsv41/boot.py", "health"]
  67. ENTRYPOINT ["python3", "-u", "/opt/dsv41/boot.py"]
  68. CMD ["run"]