[CPU] Build CPU wheels on Ubuntu 22.04 with AMX-FP8 support (#58515)

Signed-off-by: zhejiangxiaomai <zhenhui.zhao@intel.com> Signed-off-by: jiang1.li <jiang1.li@intel.com> Co-authored-by: jiang1.li <jiang1.li@intel.com>

zhao, zhenhui committed Sep 28, 2026 at 11:46 UTC 5eaa50f151c1dbbe14aca45fff4a4b9279362a9c
1 file changed +31 -3
docker/Dockerfile.cpu
+31 -3
@@ -27,7 +27,7 @@
27 # cache mounts (ccache, cargo registry) aren't exported by `--cache-to
28 # type=registry`, so they don't survive a build landing on a different/fresh
29 # builder. sccache's cache lives in S3 instead, so it does.
30 -FROM ubuntu:25.04 AS base
30 +FROM ubuntu:22.04 AS base
31
32 RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
33 --mount=type=cache,target=/var/lib/apt,sharing=locked \
@@ -52,11 +52,38 @@ RUN if [ "$USE_SCCACHE" = "1" ]; then \
52 && rm -rf sccache.tar.gz sccache-v0.8.1-${SCCACHE_ARCH}-unknown-linux-musl; \
53 fi
54
55 +######################### BINUTILS BUILD IMAGE #########################
56 +# Build a newer GNU assembler for the AMX-FP8 instruction set.
57 +FROM base AS binutils-build
58 +
59 +ARG BINUTILS_VERSION=2.47
60 +
61 +RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
62 + --mount=type=cache,target=/var/lib/apt,sharing=locked \
63 + apt-get update -y \
64 + && apt-get install -y --no-install-recommends \
65 + bison \
66 + build-essential \
67 + flex \
68 + texinfo \
69 + xz-utils \
70 + && curl -fsSLO "https://sourceware.org/pub/binutils/releases/binutils-${BINUTILS_VERSION}.tar.xz" \
71 + && tar -xf "binutils-${BINUTILS_VERSION}.tar.xz" \
72 + && mkdir binutils-build \
73 + && cd binutils-build \
74 + && "../binutils-${BINUTILS_VERSION}/configure" --prefix=/opt/binutils --disable-nls --disable-werror \
75 + && make -j"$(nproc)" \
76 + && make install \
77 + && cd .. \
78 + && rm -rf binutils-build "/binutils-${BINUTILS_VERSION}" "binutils-${BINUTILS_VERSION}.tar.xz"
79 +
80 ######################### COMMON BASE IMAGE #########################
81 FROM base AS base-common
82
83 WORKDIR /workspace
84
85 +COPY --from=binutils-build /opt/binutils /opt/binutils
86 +
87 ARG PYTHON_VERSION=3.12
88
89 ARG max_jobs=32
@@ -93,7 +120,8 @@ ENV CC=/usr/bin/gcc-15 CXX=/usr/bin/g++-15
120 ENV CCACHE_DIR=/root/.cache/ccache
121 ENV CMAKE_CXX_COMPILER_LAUNCHER=ccache
122
96 -ENV PATH="/root/.local/bin:$PATH"
123 +ENV PATH="/opt/binutils/bin:/root/.local/bin:$PATH"
124 +ENV COMPILER_PATH="/opt/binutils/bin"
125 ENV VIRTUAL_ENV="/opt/venv"
126 ENV UV_PYTHON_INSTALL_DIR=/opt/uv/python
127 RUN uv venv --python ${PYTHON_VERSION} --seed ${VIRTUAL_ENV}
@@ -168,7 +196,7 @@ RUN apt-get update -y \
196 WORKDIR /workspace
197
198 COPY requirements/build/rust.txt requirements/build/rust.txt
171 -RUN python3 -m pip install --break-system-packages --no-cache-dir -r requirements/build/rust.txt
199 +RUN python3 -m pip install --no-cache-dir -r requirements/build/rust.txt
200
201 ARG USE_SCCACHE
202 ARG SCCACHE_ENDPOINT