| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- # TP4 production image (.env.tp4.example, docs/tp4.md). Same pinned base image as Dockerfile, but
- # the SGLang python tree replaced by the upstream dsv4.1 branch at f80c91a4b (2026-09-16 19:45 UTC;
- # carries #39370 mHC/metadata fusion, #39653 communication kernels, #39648 top-k, #39646 kernels)
- # with the kernel packages the branch pins (sglang-kernel 0.4.7, sgl-deep-gemm 0.2.0; aarch64
- # wheels from PyPI), rhys101's SG17 RoCEnante overlay adapted to TP4, the SG17 b12x (RoCEnante)
- # plus sparkring's roce_ring, b12x main as b12x_next (routed MoE at EP_SIZE=1), and all adapters.
- # The SM120 page-split override (runtime/flash_mla_sm120.py) is re-applied on top of the branch's
- # kernel file. Third-party trees are fetched at build, at the commits and sha256 in
- # runtime/sources.manifest (scripts/fetch_runtime.sh), and patched with the files in this repo.
- # Tag: dsv41-4x-spark:canary-roce
- FROM lmsysorg/sglang:dev-dsv41@sha256:3dbc313030a6ef2c5d7de8ecf48e9aece722694a82182cb618cc82b588816349 AS fetch
- COPY runtime/sources.manifest runtime/sglang-rocenante.patch runtime/flash_mla_sm120.canary.py /src/runtime/
- COPY scripts/fetch_runtime.sh scripts/b12x_next-compact-n64-m64.patch scripts/roce_ring-sparkring-f16b5f4.patch /src/scripts/
- RUN bash /src/scripts/fetch_runtime.sh /fetched sglang-canary b12x b12x-next
- FROM lmsysorg/sglang:dev-dsv41@sha256:3dbc313030a6ef2c5d7de8ecf48e9aece722694a82182cb618cc82b588816349
- # Same mirror knob as Dockerfile.canary (Saolence, #6): --build-arg PIP_INDEX=<mirror>/simple
- ARG PIP_INDEX=https://pypi.org/simple
- RUN pip install --no-deps --no-cache-dir -i "$PIP_INDEX" "sglang-kernel==0.4.7" "sgl-deep-gemm==0.2.0"
- RUN rm -rf /sgl-workspace/sglang/python
- COPY --from=fetch /fetched/sglang-canary/python /sgl-workspace/sglang/python
- 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')"
- # RoCEnante overlay (SG17, rhys101) applied to the branch tree with offsets, then adapted to TP4
- COPY runtime/sglang-rocenante.patch runtime/roce_tp4_adapt.py /tmp/
- 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
- COPY --from=fetch /fetched/b12x/b12x /opt/b12x/b12x
- COPY --from=fetch /fetched/b12x/LICENSE /opt/b12x/LICENSE
- RUN PYTHONPATH=/opt/b12x python3 -c "from b12x.comm import roce; print('roce', roce.API_VERSION)"
- # b12x main renamed to b12x_next (scripts/fetch_runtime.sh) for adapter/moe_b12x_next.py, beside
- # the SG17 b12x that RoCEnante needs; its JIT/tuning cache is B12X_NEXT_COMPILE_CACHE_DIR.
- COPY --from=fetch /fetched/b12x_next/b12x_next /opt/b12x_next/b12x_next
- COPY --from=fetch /fetched/b12x_next/LICENSE /opt/b12x_next/LICENSE
- 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())"
- WORKDIR /opt/dsv41
- COPY adapter /opt/dsv41/adapter
- RUN g++ -O2 -Wall -Wextra -Werror -std=c++17 -shared -fPIC -pthread \
- -DDSV41_ROW_STORE_DRM adapter/row_store.cpp -o adapter/librow_store.so
- COPY runtime/flash_mla_sm120.canary.py /sgl-workspace/sglang/python/sglang/kernels/ops/attention/flash_mla_sm120.py
- COPY boot.py /opt/dsv41/boot.py
- COPY scripts /opt/dsv41/scripts
- COPY tests /opt/dsv41/tests
- COPY benchmarks /opt/dsv41/benchmarks
- RUN PYTHONPATH=/opt/dsv41/adapter python3 /opt/dsv41/tests/test_thinking_alias.py \
- && PYTHONPATH=/opt/dsv41/adapter python3 /opt/dsv41/tests/test_max_new_tokens.py \
- && PYTHONPATH=/opt/dsv41/adapter python3 /opt/dsv41/tests/test_loop_abort.py \
- && PYTHONPATH=/opt/dsv41/adapter python3 /opt/dsv41/tests/test_fast_load_pacing.py \
- && CUDA_VISIBLE_DEVICES= PYTHONPATH=/opt/dsv41/adapter python3 /opt/dsv41/tests/test_fast_load_tp_slice.py \
- && CUDA_VISIBLE_DEVICES= PYTHONPATH=/opt/dsv41/adapter python3 /opt/dsv41/tests/test_prefill_sp.py \
- && CUDA_VISIBLE_DEVICES= PYTHONPATH=/opt/dsv41/adapter python3 /opt/dsv41/tests/test_fast_load_slab.py \
- && CUDA_VISIBLE_DEVICES= PYTHONPATH=/opt/dsv41/adapter python3 /opt/dsv41/tests/test_moe_b12x_next_cpu.py \
- && PYTHONPATH=/opt/dsv41/adapter python3 /opt/dsv41/tests/test_wo_a_w8.py \
- && PYTHONPATH=/opt/dsv41/adapter python3 /opt/dsv41/tests/test_draft_tau.py \
- && PYTHONPATH=/opt/dsv41/adapter python3 /opt/dsv41/tests/test_folded_fence.py \
- && PYTHONPATH=/opt/dsv41/adapter python3 /opt/dsv41/tests/test_draft_head_fp8.py \
- && PYTHONPATH=/opt/dsv41/adapter python3 /opt/dsv41/tests/test_draft_head_fp8_tp4.py \
- && BV_TEST_N=60000 PYTHONPATH=/opt/dsv41/adapter python3 /opt/dsv41/tests/test_block_verify.py \
- && PYTHONPATH=/opt/dsv41/adapter python3 /opt/dsv41/tests/test_autotune_keep.py \
- && CUDA_VISIBLE_DEVICES= PYTHONPATH=/opt/dsv41/adapter python3 /opt/dsv41/tests/test_replicated_split.py \
- && CUDA_VISIBLE_DEVICES= VC_TEST_N=60000 PYTHONPATH=/opt/dsv41/adapter python3 /opt/dsv41/tests/test_verify_cap.py \
- && CUDA_VISIBLE_DEVICES= python3 /opt/dsv41/tests/test_roce_ring.py \
- && 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
- ENV PYTHONPATH=/opt/dsv41/adapter:/opt/b12x:/opt/b12x_next \
- MODEL_PATH=/models/DeepSeek-V4.1-Flash \
- STATE_PATH=/state OFFLOAD_MODE=nvme DSV41_CACHE_GIB=16
- EXPOSE 8888
- HEALTHCHECK --interval=30s --timeout=30s --start-period=30m --retries=3 \
- CMD ["python3", "-S", "/opt/dsv41/boot.py", "health"]
- ENTRYPOINT ["python3", "-u", "/opt/dsv41/boot.py"]
- CMD ["run"]
|