-
Notifications
You must be signed in to change notification settings - Fork 333
[Release] Unify local build scripts to use cibuildwheel and reduce size of sdist
#1171
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 9 commits
360cfa9
ac1c8c3
668299b
fc71a20
271f965
a81e30e
ff58bf2
52d07d3
25a9814
703e63c
54ff485
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,70 +1,5 @@ | ||
| #!/usr/bin/env bash | ||
| set -euxo pipefail | ||
|
|
||
| IMAGE="tilelang-builder:manylinux" | ||
|
|
||
| HOST_UNAME=$(uname -m) | ||
| case "$HOST_UNAME" in | ||
| x86_64) TARGETARCH=amd64 ;; | ||
| aarch64|arm64) TARGETARCH=arm64 ;; | ||
| *) echo "Unsupported architecture: $HOST_UNAME" >&2; exit 1 ;; | ||
| esac | ||
|
|
||
| if docker buildx version >/dev/null 2>&1; then | ||
| if docker info >/dev/null 2>&1; then | ||
| docker run --rm --privileged tonistiigi/binfmt --install amd64,arm64 >/dev/null 2>&1 || true | ||
| fi | ||
|
|
||
| if ! docker buildx inspect multi >/dev/null 2>&1; then | ||
| docker buildx create --name multi --driver docker-container --use >/dev/null 2>&1 || true | ||
| else | ||
| docker buildx use multi >/dev/null 2>&1 || true | ||
| fi | ||
| docker buildx inspect --bootstrap >/dev/null 2>&1 || true | ||
|
|
||
| for ARCH in amd64 arm64; do | ||
| TAG_PLATFORM="linux/${ARCH}" | ||
| TAG_IMAGE="${IMAGE}-${ARCH}" | ||
|
|
||
| docker buildx build \ | ||
| --platform "${TAG_PLATFORM}" \ | ||
| --build-arg TARGETARCH="${ARCH}" \ | ||
| -f "$(dirname "${BASH_SOURCE[0]}")/pypi.manylinux.Dockerfile" \ | ||
| -t "${TAG_IMAGE}" \ | ||
| --load \ | ||
| . | ||
|
|
||
| script="sh maint/scripts/local_distribution.sh" | ||
| docker run --rm \ | ||
| --platform "${TAG_PLATFORM}" \ | ||
| -v "$(pwd):/tilelang" \ | ||
| "${TAG_IMAGE}" \ | ||
| /bin/bash -lc "$script" | ||
|
|
||
| if [ -d dist ]; then | ||
| mv -f dist "dist-local-${ARCH}" | ||
| fi | ||
| done | ||
|
|
||
| else | ||
| echo "docker buildx not found; building only host arch: ${TARGETARCH}" >&2 | ||
| TAG_IMAGE="${IMAGE}-${TARGETARCH}" | ||
| TAG_PLATFORM="linux/${TARGETARCH}" | ||
|
|
||
| docker build \ | ||
| --build-arg TARGETARCH="$TARGETARCH" \ | ||
| -f "$(dirname "${BASH_SOURCE[0]}")/pypi.manylinux.Dockerfile" \ | ||
| -t "${TAG_IMAGE}" \ | ||
| . | ||
|
|
||
| script="sh maint/scripts/local_distribution.sh" | ||
| docker run --rm \ | ||
| --platform "${TAG_PLATFORM}" \ | ||
| -v "$(pwd):/tilelang" \ | ||
| "${TAG_IMAGE}" \ | ||
| /bin/bash -lc "$script" | ||
|
|
||
| if [ -d dist ]; then | ||
| mv -f dist "dist-local-${TARGETARCH}" | ||
| fi | ||
| fi | ||
| # Build for local architecture | ||
| CIBW_BUILD='cp38-*' cibuildwheel . |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -60,19 +60,30 @@ metadata.version.provider = "version_provider" | |
| metadata.version.provider-path = "." | ||
| experimental = true | ||
|
|
||
| # build.verbose = true | ||
| # logging.level = "DEBUG" | ||
|
|
||
| [tool.scikit-build.sdist] | ||
| # See MANIFEST.in for details | ||
| include = [ | ||
| "VERSION", | ||
| "LICENSE", | ||
| "./VERSION", | ||
| ".git_commit.txt", | ||
| "./LICENSE", | ||
| "THIRDPARTYNOTICES.txt", | ||
| "version_provider.py", | ||
| "requirements*.txt", | ||
| "tilelang/jit/adapter/cython/cython_wrapper.pyx", | ||
| "CMakeLists.txt", | ||
| "src/**", | ||
| "cmake/**", | ||
| "3rdparty/**", | ||
| # The vendored 3rdparty contents in sdist should be same as wheel. | ||
| # Need full TVM to build from source. | ||
| "3rdparty/tvm", | ||
| # CUTLASS | ||
| "3rdparty/cutlass/include", | ||
| "3rdparty/cutlass/tools", | ||
| # Composable Kernel | ||
| "3rdparty/composable_kernel/include", | ||
| "3rdparty/composable_kernel/library", | ||
| "testing/**", | ||
| "examples/**", | ||
| ] | ||
|
|
@@ -81,8 +92,7 @@ exclude = [ | |
| ".github", | ||
| "**/.git", | ||
| "**/.github", | ||
| "3rdparty/clang**", | ||
| "3rdparty/llvm**", | ||
| "3rdparty/**", | ||
| "build", | ||
| ] | ||
|
|
||
|
|
@@ -91,7 +101,7 @@ tilelang = "tilelang" | |
| "tilelang/src" = "src" | ||
| # NOTE: The mapping below places the contents of '3rdparty' inside 'tilelang/3rdparty' in the wheel. | ||
| # This is necessary to find TVM shared libraries at runtime. | ||
| # Restrict 3rdparty contents in wheel to the same allowlist as sdist | ||
| # The vendored 3rdparty contents in wheel should be same as sdist. | ||
| # TVM | ||
| "tilelang/3rdparty/tvm/src" = "3rdparty/tvm/src" | ||
| "tilelang/3rdparty/tvm/python" = "3rdparty/tvm/python" | ||
|
|
@@ -203,6 +213,7 @@ environment.PYTHONUNBUFFERED = "1" | |
| environment.PATH = "/usr/local/cuda/bin:$PATH" | ||
| environment.LD_LIBRARY_PATH = "/usr/local/cuda/lib64:/usr/local/cuda/lib64/stubs:$LD_LIBRARY_PATH" | ||
| # Pin to glibc 2.17 for x86 and 2.28 for aarch64 for now | ||
| # TODO: upgrade to manylinux_2_28 at some time | ||
| manylinux-x86_64-image = "manylinux2014" # CentOS 7 | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Out of curiosity, is there any reason not to use
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The only reason is that torch migrated from manylinux 2.17 to manylinux 2.28 since 2.6. I guess torch 2.4/2.5 is not that old to be dropped.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The shared libraries in our wheel are not linked against
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's correct. We only align with torch's glibc version here.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I think there will not be any runtime effects as they are not linked against each other. And there will be only one libc library used in the process, which is very likely 2.28+. If you persist, could you add a TODO comment in
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm fine with that, since that change is quite independent and small, maybe we can open an issue to see if that's ok for other users cc @LeiWang1999
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. both of them lgtm. |
||
| manylinux-aarch64-image = "manylinux_2_28" # AlmaLinux 8 | ||
| # Install CUDA runtime and stub driver library | ||
|
|
@@ -215,17 +226,19 @@ uname -a | |
|
|
||
| case "$(uname -m)" in | ||
| "x86_64") | ||
| DEFAULT_CUDA_VERSION="12.1" | ||
| yum-config-manager --add-repo https://developer.download.nvidia.cn/compute/cuda/repos/rhel7/x86_64/cuda-rhel7.repo | ||
| ;; | ||
| "aarch64") | ||
| DEFAULT_CUDA_VERSION="12.8" | ||
| dnf config-manager --add-repo https://developer.download.nvidia.com/compute/cuda/repos/rhel8/sbsa/cuda-rhel8.repo | ||
| ;; | ||
| *) | ||
| exit 1 | ||
| ;; | ||
| esac | ||
|
|
||
| cudaver="$(echo "${CUDA_VERSION:-"12.4"}" | cut -d '.' -f-2)" | ||
| cudaver="$(echo "${CUDA_VERSION:-$DEFAULT_CUDA_VERSION}" | cut -d '.' -f-2)" | ||
| v="${cudaver//./-}" | ||
| yum install -y "cuda-minimal-build-${v}" "cuda-driver-devel-${v}" "cuda-nvrtc-devel-${v}" nvidia-driver-cuda-libs | ||
| """ | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.