A high-throughput and memory-efficient inference and serving engine for LLMs
Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git
Synced Nov 14, 05:30 UTC
[Hardware][IBM Z] Fix Outlines Core issue for s390x (#24034)
Signed-off-by: Rehan Khan <Rehan.Khan7@ibm.com>
R3hankhan committed
Sep 9, 2025 at 05:20 UTC
e10fef08838612b4560e9c72e5cb1414a5edfa13
2 files changed
+45
-4
docker/Dockerfile.s390x
+44
-2
@@ -16,7 +16,8 @@ ENV LANG=C.UTF-8 \
16
RUN microdnf install -y \
17
which procps findutils tar vim git gcc gcc-gfortran g++ make patch zlib-devel \
18
libjpeg-turbo-devel libtiff-devel libpng-devel libwebp-devel freetype-devel harfbuzz-devel \
19
- openssl-devel openblas openblas-devel autoconf automake libtool cmake numpy libsndfile && \
19
+ openssl-devel openblas openblas-devel autoconf automake libtool cmake numpy libsndfile \
20
+ clang llvm-devel llvm-static clang-devel && \
21
microdnf clean all
22
23
# Python Installation
@@ -191,7 +192,6 @@ RUN --mount=type=cache,target=/root/.cache/uv \
192
-DCOMPILER_RT_BUILD_ORC=OFF \
193
-DCOMPILER_RT_INCLUDE_TESTS=OFF \
194
${CMAKE_ARGS} -GNinja ../llvm \
194
-
195
&& ninja install . && \
196
# build llvmlite
197
cd ../../llvmlite && python setup.py bdist_wheel && \
@@ -200,6 +200,45 @@ RUN --mount=type=cache,target=/root/.cache/uv \
200
sed -i '/#include "internal\/pycore_atomic.h"/i\#include "dynamic_annotations.h"' numba/_dispatcher.cpp; \
201
fi && python setup.py bdist_wheel
202
203
+# Edit aws-lc-sys to support s390x
204
+FROM python-install AS aws-lc-sys-editor
205
+WORKDIR /tmp
206
+ENV CARGO_HOME=/root/.cargo
207
+ENV RUSTUP_HOME=/root/.rustup
208
+ENV PATH="$CARGO_HOME/bin:$RUSTUP_HOME/bin:$PATH"
209
+ARG AWS_LC_VERSION=v0.30.0
210
+RUN --mount=type=cache,target=/root/.cache/uv \
211
+ --mount=type=bind,from=rust,source=/root/.cargo,target=/root/.cargo,rw \
212
+ --mount=type=bind,from=rust,source=/root/.rustup,target=/root/.rustup,rw \
213
+ git clone --recursive https://github.com/aws/aws-lc-rs.git && \
214
+ cd aws-lc-rs && \
215
+ git checkout tags/aws-lc-sys/${AWS_LC_VERSION} && \
216
+ git submodule sync && \
217
+ git submodule update --init --recursive && \
218
+ cd aws-lc-sys && \
219
+ sed -i '682 s/strncmp(buf, "-----END ", 9)/memcmp(buf, "-----END ", 9)/' aws-lc/crypto/pem/pem_lib.c && \
220
+ sed -i '712 s/strncmp(buf, "-----END ", 9)/memcmp(buf, "-----END ", 9)/' aws-lc/crypto/pem/pem_lib.c && \
221
+ sed -i '747 s/strncmp(buf, "-----END ", 9)/memcmp(buf, "-----END ", 9)/' aws-lc/crypto/pem/pem_lib.c
222
+
223
+# Build Outlines Core
224
+FROM python-install AS outlines-core-builder
225
+WORKDIR /tmp
226
+ENV CARGO_HOME=/root/.cargo
227
+ENV RUSTUP_HOME=/root/.rustup
228
+ENV PATH="$CARGO_HOME/bin:$RUSTUP_HOME/bin:$PATH"
229
+ARG OUTLINES_CORE_VERSION=0.2.10
230
+RUN --mount=type=cache,target=/root/.cache/uv \
231
+ --mount=type=bind,from=rust,source=/root/.cargo,target=/root/.cargo,rw \
232
+ --mount=type=bind,from=rust,source=/root/.rustup,target=/root/.rustup,rw \
233
+ --mount=type=bind,from=aws-lc-sys-editor,source=/tmp/aws-lc-rs/aws-lc-sys,target=/tmp/aws-lc-sys,rw \
234
+ git clone https://github.com/dottxt-ai/outlines-core.git && \
235
+ cd outlines-core && \
236
+ git checkout tags/${OUTLINES_CORE_VERSION} && \
237
+ sed -i "s/version = \"0.0.0\"/version = \"${OUTLINES_CORE_VERSION}\"/" Cargo.toml && \
238
+ echo '[patch.crates-io]' >> Cargo.toml && \
239
+ echo 'aws-lc-sys = { path = "/tmp/aws-lc-sys" }' >> Cargo.toml && \
240
+ uv pip install maturin && \
241
+ python -m maturin build --release --out dist
242
243
# Final build stage
244
FROM python-install AS vllm-cpu
@@ -230,6 +269,7 @@ RUN --mount=type=cache,target=/root/.cache/uv \
269
--mount=type=bind,from=torch,source=/tmp/pytorch/dist,target=/tmp/torch-wheels/ \
270
--mount=type=bind,from=numba-builder,source=/tmp/llvmlite/dist,target=/tmp/llvmlite-wheels/ \
271
--mount=type=bind,from=numba-builder,source=/tmp/numba/dist,target=/tmp/numba-wheels/ \
272
+ --mount=type=bind,from=outlines-core-builder,source=/tmp/outlines-core/dist,target=/tmp/outlines-core/dist/ \
273
sed -i '/^torch/d' requirements/build.txt && \
274
ARROW_WHL_FILE=$(ls /tmp/arrow-wheels/pyarrow-*.whl) && \
275
VISION_WHL_FILE=$(ls /tmp/vision-wheels/*.whl) && \
@@ -237,6 +277,7 @@ RUN --mount=type=cache,target=/root/.cache/uv \
277
TORCH_WHL_FILE=$(ls /tmp/torch-wheels/*.whl) && \
278
LLVM_WHL_FILE=$(ls /tmp/llvmlite-wheels/*.whl) && \
279
NUMBA_WHL_FILE=$(ls /tmp/numba-wheels/*.whl) && \
280
+ OUTLINES_CORE_WHL_FILE=$(ls /tmp/outlines-core/dist/*.whl) && \
281
uv pip install -v \
282
$ARROW_WHL_FILE \
283
$VISION_WHL_FILE \
@@ -244,6 +285,7 @@ RUN --mount=type=cache,target=/root/.cache/uv \
285
$TORCH_WHL_FILE \
286
$LLVM_WHL_FILE \
287
$NUMBA_WHL_FILE \
288
+ $OUTLINES_CORE_WHL_FILE \
289
--index-strategy unsafe-best-match \
290
-r requirements/build.txt \
291
-r requirements/cpu.txt
requirements/common.txt
+1
-2
@@ -20,8 +20,7 @@ prometheus-fastapi-instrumentator >= 7.0.0
20
tiktoken >= 0.6.0 # Required for DBRX tokenizer
21
lm-format-enforcer == 0.11.3
22
llguidance >= 0.7.11, < 0.8.0; platform_machine == "x86_64" or platform_machine == "arm64" or platform_machine == "aarch64"
23
-outlines_core == 0.2.10 ; platform_machine != "s390x"
24
-outlines == 0.1.11 ; platform_machine == "s390x"
23
+outlines_core == 0.2.10
24
# required for outlines backend disk cache
25
diskcache == 5.6.3
26
lark == 1.2.2