Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions .github/workflows/Dockerfile.manylinux_2_28
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# SPDX-License-Identifier: Apache-2.0
# Copyright (c) 2025 FlyDSL Project Contributors
#
# Multi-stage Dockerfile for building manylinux_2_28 wheels with ROCm support.
# Strategy (same as pytorch/manylinux2_28-builder:rocm*):
# Stage 1: Copy Python interpreters from quay.io/pypa/manylinux_2_28_x86_64
# Stage 2: Use rocm/dev-almalinux-8 (AlmaLinux 8 = glibc 2.28) with full ROCm SDK
# Merge: Python toolchains + ROCm + build deps in one image
#
# Build:
# docker build \
# --build-arg ROCM_VERSION=7.2 \
# -t flydsl/manylinux_2_28:rocm7.2 \
# - < .github/workflows/Dockerfile.manylinux_2_28
#
# Supported ROCm versions: 7.0, 7.1, 7.2

ARG ROCM_VERSION=7.2

# ---------------------------------------------------------------------------
# Stage 1: Grab pre-built CPython interpreters from the official manylinux image
# ---------------------------------------------------------------------------
FROM quay.io/pypa/manylinux_2_28_x86_64 AS python-source

# ---------------------------------------------------------------------------
# Stage 2: ROCm + AlmaLinux 8 (glibc 2.28)
# ---------------------------------------------------------------------------
FROM rocm/dev-almalinux-8:${ROCM_VERSION}-complete

# /opt/python/cpXYZ-cpXYZ are symlinks to /opt/_internal/cpython-X.Y.Z
# and pip shebangs point to /opt/_internal/... paths, so copy both.
COPY --from=python-source /opt/_internal /opt/_internal
COPY --from=python-source /opt/python /opt/python
# Copy patchelf binary (statically linked, required by auditwheel)
COPY --from=python-source /usr/local/bin/patchelf /usr/local/bin/patchelf

# Install build dependencies
RUN dnf install -y \
ninja-build \
gcc \
gcc-c++ \
make \
git \
zlib-devel \
openssl-devel \
libffi-devel \
&& dnf clean all

# Install cmake and ninja via pip (dnf versions are too old for LLVM)
RUN /opt/python/cp312-cp312/bin/pip install cmake ninja

# Put python3.12 and cmake on PATH
ENV PATH="/opt/python/cp312-cp312/bin:${PATH}"

WORKDIR /workspace

LABEL maintainer="FlyDSL Contributors"
LABEL description="manylinux_2_28 + ROCm wheel builder for FlyDSL"
50 changes: 38 additions & 12 deletions .github/workflows/build-whl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ on:
description: 'Release type determines target S3 bucket (devreleases, nightlies, release)'
type: string
required: true
docker_image:
description: 'Docker base image for build'
type: string
required: true
upload_s3_staging:
description: 'Upload built wheels to the S3 staging bucket'
type: boolean
Expand All @@ -35,29 +31,54 @@ jobs:
with:
path: flydsl

- name: Build manylinux Docker image
run: |
ROCM_VERSION=7.2
IMAGE="flydsl/manylinux_2_28:rocm${ROCM_VERSION}"
if docker image inspect "${IMAGE}" >/dev/null 2>&1; then
echo "Reusing existing image: ${IMAGE}"
else
# The Dockerfile is self-contained, so avoid sending the full repo as build context.
docker build \
--build-arg ROCM_VERSION="${ROCM_VERSION}" \
-t "${IMAGE}" \
- < flydsl/.github/workflows/Dockerfile.manylinux_2_28
fi
echo "MANYLINUX_IMAGE=${IMAGE}" >> $GITHUB_ENV

- name: Start build container
run: |
docker run -dt --network=host --user root \
-v "${GITHUB_WORKSPACE}/flydsl:/flydsl" \
--ipc=host --shm-size 16g \
-w /flydsl \
--name flydsl_build \
${{ inputs.docker_image }}
"${MANYLINUX_IMAGE}"

- name: Install build dependencies
run: |
docker exec flydsl_build bash -c "apt-get update && apt-get install -y cmake build-essential patchelf software-properties-common"
docker exec flydsl_build bash -c "add-apt-repository -y ppa:deadsnakes/ppa && apt-get update && apt-get install -y python3.12 python3.12-dev python3.12-venv"
docker exec flydsl_build bash -c "python3 -m pip install -U pip setuptools wheel"
docker exec flydsl_build bash -c "python3 -m pip install ninja>=1.11.1"
# Create pythonX.Y symlinks so build_wheels.sh can find them.
# Skip free-threaded builds (cpXYZt) — they would overwrite the normal symlink.
docker exec flydsl_build bash -c '
for d in /opt/python/cp*; do
case "${d}" in *t) continue ;; esac
py="${d}/bin/python"
[ -x "${py}" ] || continue
ver=$("${py}" -c "import sys; print(f\"{sys.version_info.major}.{sys.version_info.minor}\")")
ln -sf "${py}" "/usr/local/bin/python${ver}"
echo " python${ver} -> ${py}"
done
ln -sf /usr/local/bin/python3.12 /usr/local/bin/python3
'
docker exec flydsl_build bash -c "python3 -m pip install -q nanobind"
docker exec flydsl_build bash -c "git config --global --add safe.directory '*'"

- name: Restore cached MLIR install tarball
id: mlir-cache
uses: actions/cache@v4
with:
path: mlir_install.tgz
key: mlir-install-${{ hashFiles('flydsl/thirdparty/llvm-hash.txt', 'flydsl/scripts/build_llvm.sh', 'flydsl/CMakeLists.txt', 'flydsl/.github/workflows/build-whl.yaml') }}
key: mlir-install-manylinux228-${{ hashFiles('flydsl/thirdparty/llvm-hash.txt', 'flydsl/scripts/build_llvm.sh', 'flydsl/CMakeLists.txt') }}

- name: Use cached MLIR install tarball
if: steps.mlir-cache.outputs.cache-hit == 'true'
Expand All @@ -74,7 +95,12 @@ jobs:

- name: Build wheels
run: |
docker exec flydsl_build bash -c "export MLIR_PATH=/llvm-project/mlir_install && export EXPECTED_GLIBC=2.35 && export FLYDSL_RELEASE_TYPE=${{ inputs.release_type }} && cd /flydsl && bash scripts/build_wheels.sh"
docker exec \
-e MLIR_PATH=/llvm-project/mlir_install \
-e EXPECTED_GLIBC=2.28 \
-e FLYDSL_RELEASE_TYPE=${{ inputs.release_type }} \
-e "FLYDSL_PACKAGE_VERSION_OVERRIDE=${PACKAGE_VERSION_OVERRIDE}" \
flydsl_build bash -c "cd /flydsl && bash scripts/build_wheels.sh"
docker cp flydsl_build:/flydsl/dist ./dist
docker cp flydsl_build:/flydsl/build-fly/build_py312/bin/fly-opt ./dist/fly-opt

Expand All @@ -97,7 +123,7 @@ jobs:
- name: Build summary
if: always()
env:
SUMMARY_DOCKER_IMAGE: ${{ inputs.docker_image }}
SUMMARY_DOCKER_IMAGE: ${{ env.MANYLINUX_IMAGE }}
SUMMARY_LLVM_COMMIT: $(cat flydsl/thirdparty/llvm-hash.txt | tr -d '[:space:]')
SUMMARY_MLIR_CACHE: ${{ steps.mlir-cache.outputs.cache-hit == 'true' && 'Hit' || 'Miss (rebuilt)' }}
SUMMARY_RELEASE_TYPE: ${{ inputs.release_type }}
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ on:
type: boolean
default: false
docker_image:
description: 'Docker base image for build and test'
description: 'Docker base image for test'
type: string
default: "rocm/pytorch:rocm7.2_ubuntu22.04_py3.10_pytorch_release_2.8.0"
concurrency:
Expand All @@ -26,7 +26,6 @@ jobs:
uses: ./.github/workflows/build-whl.yaml
with:
release_type: ${{ github.event_name == 'schedule' && 'nightlies' || 'devreleases' }}
docker_image: ${{ inputs.docker_image || 'rocm/pytorch:rocm7.2_ubuntu22.04_py3.10_pytorch_release_2.8.0' }}
permissions:
id-token: write
contents: read
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/publish-pypi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ jobs:
uses: ./.github/workflows/build-whl.yaml
with:
release_type: release
docker_image: rocm/pytorch:rocm7.2_ubuntu22.04_py3.10_pytorch_release_2.8.0
upload_s3_staging: false
permissions:
id-token: write
Expand Down
2 changes: 1 addition & 1 deletion python/flydsl/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# SPDX-License-Identifier: Apache-2.0
# Copyright (c) 2025 FlyDSL Project Contributors

__version__ = "0.1.4"
__version__ = "0.1.4.post1"

# FFM simulator compatibility shim (no-op outside simulator sessions).
from ._compat import _maybe_preload_system_comgr # noqa: E402
Expand Down
1 change: 0 additions & 1 deletion scripts/build_llvm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ cmake -G "$GENERATOR" \
-DLLVM_ENABLE_ASSERTIONS=ON \
-DLLVM_INSTALL_UTILS=ON \
-DMLIR_ENABLE_BINDINGS_PYTHON=ON \
-DMLIR_ENABLE_ROCM_RUNNER=ON \
-DMLIR_BINDINGS_PYTHON_NB_DOMAIN=mlir \
-DPython3_EXECUTABLE=$(which python3) \
-Dnanobind_DIR="$NANOBIND_DIR" \
Expand Down
Loading