diff --git a/.gitignore b/.gitignore index b7421d77e..6d906688f 100644 --- a/.gitignore +++ b/.gitignore @@ -20,6 +20,7 @@ debug/ build/ *dist/ +dist*/ wheelhouse/ __pycache__ nnfusion.tar.gz diff --git a/README.md b/README.md index 25817cd9e..d7cdabee5 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,7 @@ Tile Language (**tile-lang**) is a concise domain-specific language designed to ## Latest News +- 10/30/2025 📦: We have released v0.1.6.post2, which is the last version compatible with Python 3.8. - 10/07/2025 🍎: Added Apple Metal Device support, check out [Pull Request #799](https://github.com/tile-ai/tilelang/pull/799) for details. - 09/29/2025 🎉: Thrilled to announce that ​​AscendC​​ and ​Ascend​NPU IR​​ backends targeting Huawei Ascend chips are now supported! Check out the preview here: diff --git a/VERSION b/VERSION index 70f6c676e..5ed6219f4 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.1.6.post1 +0.1.6.post2 diff --git a/maint/scripts/docker_local_distribute.sh b/maint/scripts/docker_local_distribute.sh index d01427b7b..98dc448b1 100755 --- a/maint/scripts/docker_local_distribute.sh +++ b/maint/scripts/docker_local_distribute.sh @@ -1,9 +1,70 @@ -set -eux +#!/usr/bin/env bash +set -euxo pipefail -# Get the CUDA version from the command line IMAGE="tilelang-builder:manylinux" -docker build . -f "$(dirname "${BASH_SOURCE[0]}")/pypi.manylinux.Dockerfile" --tag ${IMAGE} -script="sh maint/scripts/local_distribution.sh" +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 -docker run --rm -v $(pwd):/tilelang ${IMAGE} /bin/bash -c "$script" +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 diff --git a/maint/scripts/docker_pypi_distribute.sh b/maint/scripts/docker_pypi_distribute.sh index 731966967..1f22b009b 100755 --- a/maint/scripts/docker_pypi_distribute.sh +++ b/maint/scripts/docker_pypi_distribute.sh @@ -1,9 +1,70 @@ -set -eux +#!/usr/bin/env bash +set -euxo pipefail -# Get the CUDA version from the command line IMAGE="tilelang-builder:manylinux" -docker build . -f "$(dirname "${BASH_SOURCE[0]}")/pypi.manylinux.Dockerfile" --tag ${IMAGE} -script="sh maint/scripts/pypi_distribution.sh" +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 -docker run --rm -v $(pwd):/tilelang -w /tilelang ${IMAGE} /bin/bash -c "$script" +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/pypi_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-pypi-${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/pypi_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-pypi-${TARGETARCH}" + fi +fi diff --git a/maint/scripts/pypi.manylinux.Dockerfile b/maint/scripts/pypi.manylinux.Dockerfile index 5be11ab7a..4eeb52516 100644 --- a/maint/scripts/pypi.manylinux.Dockerfile +++ b/maint/scripts/pypi.manylinux.Dockerfile @@ -1,3 +1,4 @@ +ARG TARGETARCH FROM pytorch/manylinux2_28-builder:cuda12.1 AS builder_amd64 ENV CUDA_VERSION=12.1 \ AUDITWHEEL_PLAT=manylinux_2_28_x86_64 @@ -6,12 +7,17 @@ RUN pip3 install uv FROM pytorch/manylinuxaarch64-builder:cuda12.8 AS builder_arm64 ENV CUDA_VERSION=12.8 \ AUDITWHEEL_PLAT=manylinux_2_28_aarch64 +RUN /opt/python/cp312-cp312/bin/pip install uv FROM builder_${TARGETARCH} ENV DEBIAN_FRONTEND=noninteractive \ TZ=Etc/UTC +ENV PATH="/usr/local/cuda/bin:${PATH}" + +ENV LD_LIBRARY_PATH="/usr/local/cuda/lib64:${LD_LIBRARY_PATH}" + RUN set -eux; \ uv venv -p 3.12 --seed /venv; \ git config --global --add safe.directory '/tilelang' diff --git a/maint/scripts/pypi_distribution.sh b/maint/scripts/pypi_distribution.sh index 2201fc59e..5a0865141 100755 --- a/maint/scripts/pypi_distribution.sh +++ b/maint/scripts/pypi_distribution.sh @@ -1,6 +1,6 @@ set -eux -rm -rf dist +rm -rf dist raw_dist python -mpip install -U pip python -mpip install -U build wheel auditwheel patchelf diff --git a/pyproject.toml b/pyproject.toml index af443d52b..044791e6b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -19,7 +19,7 @@ classifiers = [ "Programming Language :: Python :: 3.12", "Intended Audience :: Developers", "Intended Audience :: Science/Research", - "Scientific/Engineering :: Artificial Intelligence", + "Topic :: Scientific/Engineering :: Artificial Intelligence", ] dynamic = ["version"] dependencies = [ @@ -89,7 +89,17 @@ 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. -"tilelang/3rdparty" = "3rdparty" +# Restrict 3rdparty contents in wheel to the same allowlist as sdist +# TVM +"tilelang/3rdparty/tvm/src" = "3rdparty/tvm/src" +"tilelang/3rdparty/tvm/python" = "3rdparty/tvm/python" +"tilelang/3rdparty/tvm/version.py" = "3rdparty/tvm/version.py" +# CUTLASS +"tilelang/3rdparty/cutlass/include" = "3rdparty/cutlass/include" +"tilelang/3rdparty/cutlass/tools" = "3rdparty/cutlass/tools" +# Composable Kernel +"tilelang/3rdparty/composable_kernel/include" = "3rdparty/composable_kernel/include" +"tilelang/3rdparty/composable_kernel/library" = "3rdparty/composable_kernel/library" [tool.yapf] based_on_style = "yapf"