@@ -187,39 +187,19 @@ RUN if [ ! -e /usr/bin/python3 ]; then \
187187 fi; \
188188 fi
189189
190- # Copy UCX and NIXL libraries for dev stage compilation.
191- # The upstream SGLang runtime image doesn't include NIXL, but cargo build needs to link against
192- # -lnixl, -lnixl_build, and -lnixl_common. Runtime stage doesn't need this since it uses pre-built
193- # wheels, but dev stage needs it for maturin develop and cargo build from source.
194- # - SGLang: Copy NIXL/UCX/libfabric/gdrcopy binaries from wheel_builder (not in upstream lmsysorg/sglang runtime).
195- # - vllm/trtllm/none: NIXL/UCX are already present in runtime (no-op).
196- ARG TARGETARCH
197- RUN --mount=from=wheel_builder,target=/wheel_builder \
198- if [ "${FRAMEWORK}" = "sglang" ]; then \
199- if [ -d /wheel_builder/usr/local/ucx ] && [ -d /wheel_builder/opt/nvidia/nvda_nixl ]; then \
200- mkdir -p /opt/nvidia /usr/include /usr/lib64 /etc/ld.so.conf.d; \
201- cp -r /wheel_builder/opt/nvidia/nvda_nixl /opt/nvidia/; \
202- cp -r /wheel_builder/usr/local/ucx /usr/local/; \
203- cp -r /wheel_builder/usr/local/libfabric /usr/local/; \
204- cp /wheel_builder/usr/include/gdrapi.h /usr/include/; \
205- cp /wheel_builder/usr/lib64/libgdrapi.so* /usr/lib64/; \
206- echo "/usr/lib64" >> /etc/ld.so.conf.d/gdrcopy.conf; \
207- fi; \
208- fi
209-
210190{% if device == "xpu" %}
211191ENV NIXL_LIB_DIR=/opt/intel/intel_nixl/lib/x86_64-linux-gnu \
212192 NIXL_PLUGIN_DIR=/opt/intel/intel_nixl/lib/x86_64-linux-gnu/plugins \
213193 NIXL_PREFIX=/opt/intel/intel_nixl
214- {% else %}
215- # NIXL is installed under lib64 (manylinux/AlmaLinux convention used by the wheel_builder).
216- # All frameworks reference NIXL_LIB_DIR=/opt/nvidia/nvda_nixl/lib64.
217- # For vllm/trtllm/none: This resets the same values already set in runtime (no harm).
218- # For sglang: This sets them for the first time (required).
194+ {% elif framework != "sglang" %}
195+ # Non-SGLang runtimes use the Dynamo-built NIXL install from wheel_builder.
196+ # Reset the same values already set in runtime (no harm).
219197ENV NIXL_PREFIX=/opt/nvidia/nvda_nixl \
220198 NIXL_LIB_DIR=/opt/nvidia/nvda_nixl/lib64 \
221199 NIXL_PLUGIN_DIR=/opt/nvidia/nvda_nixl/lib64/plugins
200+ {% endif %}
222201
202+ {% if device != "xpu" %}
223203# Set universal CUDA development environment variables (all frameworks)
224204# vLLM: Dockerfile.vllm line 533, 597
225205# TRT-LLM: Dockerfile.trtllm lines 600-606
@@ -235,15 +215,18 @@ ENV CUDA_HOME=/usr/local/cuda \
235215 NVIDIA_DRIVER_CAPABILITIES=video,compute,utility
236216{% endif %}
237217
218+ {% if framework != "sglang" %}
238219# Base LD_LIBRARY_PATH with universal paths (all frameworks have these)
239220# Framework-specific paths are conditionally added in /etc/profile.d/50-framework-paths.sh
240- ARG PYTHON_VERSION
241221ENV LD_LIBRARY_PATH=\
242222${NIXL_LIB_DIR}:\
243223${NIXL_PLUGIN_DIR}:\
244224/usr/local/ucx/lib:\
245225/usr/local/ucx/lib/ucx:\
246226${LD_LIBRARY_PATH}
227+ {% else %}
228+ # SGLang dev/local-dev inherit the upstream SGLang/NIXL runtime stack.
229+ {% endif %}
247230
248231# Copy shell profile script for framework-specific environment variables
249232# This script conditionally adds PATH/LD_LIBRARY_PATH entries based on what exists
0 commit comments