From 0a3db2b5115cbc562bfb8d0a07c3c5c5f76623cb Mon Sep 17 00:00:00 2001 From: fzyzcjy Date: Mon, 20 Oct 2025 15:53:40 +0800 Subject: [PATCH 1/8] more --- docker/Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/docker/Dockerfile b/docker/Dockerfile index ea127963938..6be506f5bc9 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -9,6 +9,7 @@ ARG MEGATRON_COMMIT=ca9797e95e88d93623b0f69831529a1b521297ac ARG ENABLE_BLACKWELL_BUILD=0 ARG ENABLE_CUDA_13=0 +# Can be 0,1,2, larger value means resource is more limited ARG ENABLE_TIGHT_BUILD_RES=0 RUN apt update From b407a34ae6a8e9242b727b1e328d72d2f4f5537d Mon Sep 17 00:00:00 2001 From: fzyzcjy Date: Mon, 20 Oct 2025 15:55:24 +0800 Subject: [PATCH 2/8] more --- docker/Dockerfile | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docker/Dockerfile b/docker/Dockerfile index 6be506f5bc9..06669e2f852 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -87,3 +87,13 @@ RUN cd /sgl-workspace/sglang && \ rm sglang.patch RUN rm /root/.tmux.conf + +# TODO: this fix will be upstreamed later +RUN (cd /tmp && git clone -b feat/v350_plus_8045 https://github.com/fzyzcjy/triton.git && cd triton && pip install -r python/requirements.txt && pip install -e .) + +# TODO: this fix will be upstreamed later +RUN sed -i '0,/if torch.cuda.is_available() and has_triton_kernels:/s//if 0:/' /sgl-workspace/sglang/python/sglang/srt/layers/quantization/unquant.py && \ + cat /sgl-workspace/sglang/python/sglang/srt/layers/quantization/unquant.py \ + +# TODO: this fix will be upstreamed later +RUN curl -L https://github.com/NVIDIA/TransformerEngine/pull/2286.patch -o /tmp/te2286.patch && (cd /usr/local/lib/python3.12/dist-packages/transformer_engine && (patch -p2 < /tmp/te2286.patch)) From 23e86950c661606ab042c4e809546f89af650586 Mon Sep 17 00:00:00 2001 From: fzyzcjy Date: Mon, 20 Oct 2025 15:56:00 +0800 Subject: [PATCH 3/8] more --- docker/Dockerfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 06669e2f852..4496f98cabf 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -41,7 +41,9 @@ RUN pip install pybind11 # flash attn # the newest version megatron supports is v2.7.4 -RUN if [ "$ENABLE_TIGHT_BUILD_RES" = "1" ]; then \ +RUN if [ "$ENABLE_TIGHT_BUILD_RES" = "2" ]; then \ + export MAX_JOBS=8; \ + elif [ "$ENABLE_TIGHT_BUILD_RES" = "1" ]; then \ export MAX_JOBS=32; \ else \ export MAX_JOBS=64; \ From 148c84350881c761eda192619479282cfba7910a Mon Sep 17 00:00:00 2001 From: fzyzcjy Date: Mon, 20 Oct 2025 15:57:16 +0800 Subject: [PATCH 4/8] more --- docker/Dockerfile | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 4496f98cabf..cd3046f9ec8 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -32,10 +32,17 @@ RUN if [ "${ENABLE_BLACKWELL_BUILD}" = "1" ]; then \ TORCH_CUDA_ARCH_LIST="$TLIST" pip install git+https://github.com/fanshiqing/grouped_gemm@v1.1.4 # apex -RUN NVCC_APPEND_FLAGS="--threads 4" \ +RUN if [ "$ENABLE_TIGHT_BUILD_RES" = "2" ]; then \ + export NVCC_APPEND_FLAGS="--threads 1"; \ + PARALLEL=4; \ + else \ + export NVCC_APPEND_FLAGS="--threads 4"; \ + PARALLEL=8; \ + fi && \ pip -v install --disable-pip-version-check --no-cache-dir \ --no-build-isolation \ - --config-settings "--build-option=--cpp_ext --cuda_ext --parallel 8" git+https://github.com/NVIDIA/apex.git + --config-settings "--build-option=--cpp_ext --cuda_ext --parallel ${PARALLEL}" git+https://github.com/NVIDIA/apex.git + # transformer engine, we install with --no-deps to avoid installing torch and torch-extensions RUN pip install pybind11 From e0ec3baa40b41669a7b0933758e673057531f0a9 Mon Sep 17 00:00:00 2001 From: fzyzcjy Date: Mon, 20 Oct 2025 16:13:46 +0800 Subject: [PATCH 5/8] more --- docker/Dockerfile | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index cd3046f9ec8..f0ea48b9266 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -10,6 +10,9 @@ ARG MEGATRON_COMMIT=ca9797e95e88d93623b0f69831529a1b521297ac ARG ENABLE_BLACKWELL_BUILD=0 ARG ENABLE_CUDA_13=0 # Can be 0,1,2, larger value means resource is more limited +# 0: Large machine +# 1: Tested on 64 vPU, 432GB RAM +# 2: Tested on 32 CPU, 64GB RAM ARG ENABLE_TIGHT_BUILD_RES=0 RUN apt update @@ -34,14 +37,12 @@ RUN if [ "${ENABLE_BLACKWELL_BUILD}" = "1" ]; then \ # apex RUN if [ "$ENABLE_TIGHT_BUILD_RES" = "2" ]; then \ export NVCC_APPEND_FLAGS="--threads 1"; \ - PARALLEL=4; \ else \ export NVCC_APPEND_FLAGS="--threads 4"; \ - PARALLEL=8; \ fi && \ pip -v install --disable-pip-version-check --no-cache-dir \ --no-build-isolation \ - --config-settings "--build-option=--cpp_ext --cuda_ext --parallel ${PARALLEL}" git+https://github.com/NVIDIA/apex.git + --config-settings "--build-option=--cpp_ext --cuda_ext --parallel 8" git+https://github.com/NVIDIA/apex.git # transformer engine, we install with --no-deps to avoid installing torch and torch-extensions RUN pip install pybind11 From 4ca418abbbc48062b3bfe445b71afb45c9ad97fe Mon Sep 17 00:00:00 2001 From: fzyzcjy Date: Mon, 20 Oct 2025 16:14:03 +0800 Subject: [PATCH 6/8] more --- docker/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index f0ea48b9266..28850dcaf43 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -11,7 +11,7 @@ ARG ENABLE_BLACKWELL_BUILD=0 ARG ENABLE_CUDA_13=0 # Can be 0,1,2, larger value means resource is more limited # 0: Large machine -# 1: Tested on 64 vPU, 432GB RAM +# 1: Tested on 64 CPU, 432GB RAM # 2: Tested on 32 CPU, 64GB RAM ARG ENABLE_TIGHT_BUILD_RES=0 From 16aff2dc95678d9456fd10a5d7582d67a1a221ba Mon Sep 17 00:00:00 2001 From: fzyzcjy Date: Mon, 20 Oct 2025 17:10:13 +0800 Subject: [PATCH 7/8] more --- docker/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 28850dcaf43..331c3238e65 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -103,7 +103,7 @@ RUN (cd /tmp && git clone -b feat/v350_plus_8045 https://github.com/fzyzcjy/trit # TODO: this fix will be upstreamed later RUN sed -i '0,/if torch.cuda.is_available() and has_triton_kernels:/s//if 0:/' /sgl-workspace/sglang/python/sglang/srt/layers/quantization/unquant.py && \ - cat /sgl-workspace/sglang/python/sglang/srt/layers/quantization/unquant.py \ + cat /sgl-workspace/sglang/python/sglang/srt/layers/quantization/unquant.py # TODO: this fix will be upstreamed later RUN curl -L https://github.com/NVIDIA/TransformerEngine/pull/2286.patch -o /tmp/te2286.patch && (cd /usr/local/lib/python3.12/dist-packages/transformer_engine && (patch -p2 < /tmp/te2286.patch)) From 3a3df82c40896d2912369ca32713aac9f86bfd52 Mon Sep 17 00:00:00 2001 From: fzyzcjy Date: Mon, 20 Oct 2025 17:11:52 +0800 Subject: [PATCH 8/8] more --- docker/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 331c3238e65..8658de13340 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -50,7 +50,7 @@ RUN pip install pybind11 # flash attn # the newest version megatron supports is v2.7.4 RUN if [ "$ENABLE_TIGHT_BUILD_RES" = "2" ]; then \ - export MAX_JOBS=8; \ + export MAX_JOBS=4; \ elif [ "$ENABLE_TIGHT_BUILD_RES" = "1" ]; then \ export MAX_JOBS=32; \ else \