This is an automated email from the ASF dual-hosted git repository.
tqchen pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tvm.git
The following commit(s) were added to refs/heads/main by this push:
new e56d4b2678 [Build] Complete TVM wheel building migration (#18252)
e56d4b2678 is described below
commit e56d4b2678e06b200d8b529c999ecd6ebd471dc5
Author: Shushi Hong <[email protected]>
AuthorDate: Tue Sep 2 06:58:10 2025 -0400
[Build] Complete TVM wheel building migration (#18252)
* finish1
* finish2
* finish3
* update
* update2
* update3
* update4
* update4
* update6
* Rename build step and update installation commandFix
* fix
* fix2
* fix3
---
.github/workflows/main.yml | 34 ++++--
conda/build-environment.yaml | 30 +++---
conda/recipe/install_tvm_python.bat | 4 +-
conda/recipe/install_tvm_python.sh | 4 +-
docker/Dockerfile.demo_android | 82 --------------
docker/Dockerfile.demo_cpu | 35 ------
docker/Dockerfile.demo_gpu | 36 -------
docker/Dockerfile.demo_mrvl | 47 --------
docker/Dockerfile.demo_opencl | 74 -------------
docker/Dockerfile.demo_rocm | 45 --------
python/setup.py | 210 ------------------------------------
11 files changed, 45 insertions(+), 556 deletions(-)
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index d615eb9231..d1934eade4 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -44,11 +44,20 @@ jobs:
submodules: 'recursive'
- name: Set up environment
uses: ./.github/actions/setup
- - name: Conda Build
+ - name: Install LLVM dependencies
shell: bash -l {0}
- run: >-
- conda build --output-folder=conda/pkg conda/recipe &&
- conda install tvm -c ./conda/pkg
+ run: |
+ conda install -c conda-forge llvmdev cmake ninja zlib
+ - name: Build TVM wheel
+ shell: bash -l {0}
+ run: |
+ pip install scikit-build-core
+ export CMAKE_ARGS="-DUSE_LLVM=ON -DBUILD_TESTING=OFF"
+ pip wheel --no-deps -w dist . -v
+ - name: Install TVM from wheel
+ shell: bash -l {0}
+ run: |
+ pip install dist/*.whl
# - name: Build iOS RPC
# run: |
# IOS_VERSION="14.0"
@@ -98,11 +107,20 @@ jobs:
submodules: 'recursive'
- name: Set up environment
uses: ./.github/actions/setup
- - name: Conda Build
+ - name: Install LLVM dependencies
shell: cmd /C call {0}
- run: >-
- conda build --output-folder=conda/pkg conda/recipe &&
- conda install tvm -c ./conda/pkg
+ run: |
+ conda install -c conda-forge llvmdev cmake ninja zlib
+ - name: Install TVM
+ shell: cmd /C call {0}
+ run: |
+ pip install scikit-build-core
+ set CMAKE_ARGS=-DUSE_LLVM=ON -DBUILD_TESTING=OFF
+ pip install --no-deps . -v
+ - name: Install test dependencies
+ shell: cmd /C call {0}
+ run: |
+ pip install psutil cloudpickle ml_dtypes numpy packaging scipy
tornado typing_extensions
- name: Test
shell: cmd /C call {0}
run: >-
diff --git a/conda/build-environment.yaml b/conda/build-environment.yaml
index 5b38599c56..f421404b34 100644
--- a/conda/build-environment.yaml
+++ b/conda/build-environment.yaml
@@ -11,12 +11,12 @@
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
+# KIND, either express or implied. See the License for the specific
+# language governing permissions and limitations under the License.
-# Build environment that can be used to build tvm.
-name: tvm-build
+# Build environment for TVM wheel building.
+# This environment provides the necessary dependencies for building TVM wheels.
+name: tvm-wheel-build
# The conda channels to lookup the dependencies
channels:
@@ -24,16 +24,16 @@ channels:
# The packages to install to the environment
dependencies:
- - conda < 24.9.0
- - conda-build < 24.9.0
- - git
+ # Core build tools
+ - cmake >=3.24
+ - ninja
+ - make
- llvmdev >=11
- - numpy
- - pytest
- - cython
- - cmake
+ - python >=3.9
+ - pip
+ - git
- bzip2
- - make
+ - pytest
+ - numpy
- scipy
- - pillow
- - pip
+ - cython
diff --git a/conda/recipe/install_tvm_python.bat
b/conda/recipe/install_tvm_python.bat
index 07c0465b84..635897266c 100644
--- a/conda/recipe/install_tvm_python.bat
+++ b/conda/recipe/install_tvm_python.bat
@@ -16,5 +16,5 @@
:: under the License.
echo on
-cd %SRC_DIR%\python || exit /b
-%PYTHON% setup.py install --single-version-externally-managed
--record=%SRC_DIR%\record.txt || exit /b
+cd %SRC_DIR% || exit /b
+%PYTHON% -m pip install . --no-deps --no-build-isolation
--record=%SRC_DIR%\record.txt || exit /b
diff --git a/conda/recipe/install_tvm_python.sh
b/conda/recipe/install_tvm_python.sh
index 2c721c64a1..ca9f776717 100755
--- a/conda/recipe/install_tvm_python.sh
+++ b/conda/recipe/install_tvm_python.sh
@@ -19,5 +19,5 @@
set -e
set -u
-cd ${SRC_DIR}/python
-${PYTHON} setup.py install --single-version-externally-managed
--record=/tmp/record.txt
+cd ${SRC_DIR}
+${PYTHON} -m pip install . --no-deps --no-build-isolation
--record=/tmp/record.txt
diff --git a/docker/Dockerfile.demo_android b/docker/Dockerfile.demo_android
deleted file mode 100644
index bbe8f7d82b..0000000000
--- a/docker/Dockerfile.demo_android
+++ /dev/null
@@ -1,82 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Minimum docker image for demo purposes
-FROM ubuntu:22.04
-
-COPY utils/apt-install-and-clear.sh /usr/local/bin/apt-install-and-clear
-
-RUN apt-get update --fix-missing
-
-COPY install/ubuntu_setup_tz.sh /install/ubuntu_setup_tz.sh
-RUN bash /install/ubuntu_setup_tz.sh
-
-COPY install/ubuntu_install_core.sh /install/ubuntu_install_core.sh
-RUN bash /install/ubuntu_install_core.sh
-
-ENV TVM_VENV /venv/apache-tvm-py3.9
-COPY python/bootstrap/lockfiles /install/python/bootstrap/lockfiles
-COPY install/ubuntu_install_python.sh /install/ubuntu1804_install_python.sh
-RUN bash /install/ubuntu1804_install_python.sh 3.9
-ENV PATH ${TVM_VENV}/bin:$PATH
-ENV PYTHONNOUSERSITE 1 # Disable .local directory from affecting CI.
-
-COPY install/ubuntu_install_python_package.sh
/install/ubuntu_install_python_package.sh
-RUN bash /install/ubuntu_install_python_package.sh
-
-COPY install/ubuntu_install_tensorflow.sh /install/ubuntu_install_tensorflow.sh
-RUN bash /install/ubuntu_install_tensorflow.sh
-
-COPY install/ubuntu_install_java.sh /install/ubuntu_install_java.sh
-RUN bash /install/ubuntu_install_java.sh
-
-COPY install/ubuntu2204_install_llvm.sh /install/ubuntu2204_install_llvm.sh
-RUN bash /install/ubuntu2204_install_llvm.sh
-
-COPY install/ubuntu_install_gradle.sh /install/ubuntu_install_gradle.sh
-RUN bash /install/ubuntu_install_gradle.sh
-
-COPY install/ubuntu_install_androidsdk.sh /install/ubuntu_install_androidsdk.sh
-RUN bash /install/ubuntu_install_androidsdk.sh
-
-COPY install/ubuntu_install_vulkan.sh /install/ubuntu_install_vulkan.sh
-RUN bash /install/ubuntu_install_vulkan.sh
-
-ENV VULKAN_SDK=/usr
-
-COPY install/ubuntu_install_cmake_source.sh
/install/ubuntu_install_cmake_source.sh
-RUN bash /install/ubuntu_install_cmake_source.sh
-
-RUN git clone https://github.com/KhronosGroup/OpenCL-Headers
/usr/local/OpenCL-Headers/
-
-# Build TVM
-RUN cd /usr && \
- git clone --depth=1 https://github.com/apache/tvm tvm --recursive && \
- cd /usr/tvm && \
- mkdir -p build && \
- cd build && \
- cmake \
- -DUSE_LLVM=llvm-config-15 \
- -DUSE_RPC=ON \
- -DUSE_SORT=ON \
- -DUSE_VULKAN=ON \
- .. && \
- make -j10
-
-# Environment variables
-ENV PYTHONPATH=/usr/tvm/python:/usr/tvm/vta/python:${PYTHONPATH}
-ENV ANDROID_HOME=/opt/android-sdk-linux/
diff --git a/docker/Dockerfile.demo_cpu b/docker/Dockerfile.demo_cpu
deleted file mode 100644
index 778d21ea78..0000000000
--- a/docker/Dockerfile.demo_cpu
+++ /dev/null
@@ -1,35 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Minimum docker image for demo purposes
-# prebuilt-image: tvmai/demo-cpu
-FROM tlcpack/ci-cpu:v0.55
-
-COPY utils/apt-install-and-clear.sh /usr/local/bin/apt-install-and-clear
-
-# Jupyter notebook.
-RUN pip3 install matplotlib Image Pillow jupyter[notebook]
-
-# Deep learning frameworks
-RUN pip3 install tensorflow keras gluoncv dgl
-
-# Build TVM
-COPY install/install_tvm_cpu.sh /install/install_tvm_cpu.sh
-RUN bash /install/install_tvm_cpu.sh
-
-# Environment variables
-ENV PYTHONPATH=/usr/tvm/python:/usr/tvm/vta/python:${PYTHONPATH}
diff --git a/docker/Dockerfile.demo_gpu b/docker/Dockerfile.demo_gpu
deleted file mode 100644
index 4ef6b0c29c..0000000000
--- a/docker/Dockerfile.demo_gpu
+++ /dev/null
@@ -1,36 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Minimum docker image for demo purposes
-# CI docker GPU env
-# tag: v0.54
-FROM tlcpack/ci-gpu:v0.55
-
-COPY utils/apt-install-and-clear.sh /usr/local/bin/apt-install-and-clear
-
-# Jupyter notebook.
-RUN pip3 install matplotlib Image "Pillow<7" jupyter[notebook]
-
-# Build TVM
-COPY install/install_tvm_gpu.sh /install/install_tvm_gpu.sh
-RUN bash /install/install_tvm_gpu.sh
-
-# Environment variables
-ENV PYTHONPATH=/usr/tvm/python:/usr/tvm/vta/python:${PYTHONPATH}
-ENV PATH=/usr/local/nvidia/bin:${PATH}
-ENV PATH=/usr/local/cuda/bin:${PATH}
-ENV
LD_LIBRARY_PATH=/usr/local/cuda/lib64:/usr/local/nvidia/lib64:${LD_LIBRARY_PATH}
diff --git a/docker/Dockerfile.demo_mrvl b/docker/Dockerfile.demo_mrvl
deleted file mode 100644
index b50944d2c2..0000000000
--- a/docker/Dockerfile.demo_mrvl
+++ /dev/null
@@ -1,47 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# prebuild ci-cpu image
-FROM tlcpack/ci-cpu:20230604-060130-0af9ff90e
-
-# Cloning TVM's main repo
-RUN echo "Cloning TVM source & submodules"
-ENV TVM_PAR_DIR="/usr"
-RUN mkdir -p TVM_PAR_DIR && \
- cd ${TVM_PAR_DIR} && \
- git clone --depth=1 https://github.com/apache/tvm tvm --recursive
-
-# Building TVM
-RUN echo "Building TVM"
-ENV TVM_HOME="/usr/tvm"
-ENV TVM_BUILD_DIR="${TVM_HOME}/build"
-RUN mkdir -p ${TVM_BUILD_DIR} && \
- cd ${TVM_HOME} && \
- ./tests/scripts/task_config_build_mrvl.sh build && \
- cd ${TVM_BUILD_DIR} && \
- cmake .. && \
- make -j$(nproc)
-
-RUN echo "Building Python package"
-ENV PYTHONPATH=${TVM_HOME}/python:${PYTHONPATH}
-RUN cd ${TVM_HOME}/python && python3 setup.py install --user
-
-# Fetching Marvell binaries
-RUN cd /opt && \
- git clone
https://github.com/MarvellEmbeddedProcessors/MarvellMLTools.git
-
-ENV PATH="/opt/MarvellMLTools/bin:$PATH"
diff --git a/docker/Dockerfile.demo_opencl b/docker/Dockerfile.demo_opencl
deleted file mode 100644
index 9112ccc0d8..0000000000
--- a/docker/Dockerfile.demo_opencl
+++ /dev/null
@@ -1,74 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# USAGE: sudo docker build libs/tvm -f libs/tvm/docker/Dockerfile.ocl -t
l4b/tvm:ocl
-
-# REFERENCE: https://docs.docker.com/engine/reference/builder
-
-FROM ubuntu:22.04
-
-COPY utils/apt-install-and-clear.sh /usr/local/bin/apt-install-and-clear
-
-RUN echo "Labelling this image"
-LABEL Description="Docker image for TVM built with OpenCL support"
-
-RUN echo "Preparing to install dependencies"
-RUN apt-get update
-# ENV DEBIAN_FRONTEND noninteractive
-RUN echo 'debconf debconf/frontend select Noninteractive' |
debconf-set-selections
-
-RUN echo "Installing utility libraries"
-RUN apt-install-and-clear -y apt-utils sudo cmake g++ llvm git libopenblas-dev
-
-# RUN echo "Installing gtest"
-# RUN apt-install-and-clear -y libgtest-dev
-# RUN cd /usr/src/gtest && cmake CMakeLists.txt && make && cp *.a /usr/lib
-
-RUN echo "Installing Python"
-RUN apt-install-and-clear -y python3-dev python3-pip
-RUN pip3 install setuptools numpy pytest cython scipy tornado psutil xgboost
-
-RUN echo "Installing Jupyter notebook"
-RUN pip3 install matplotlib Image "Pillow<7" jupyter[notebook]
-
-RUN echo "Installing OpenCL libraries"
-RUN apt-install-and-clear -y libviennacl-dev mesa-opencl-icd
ocl-icd-opencl-dev clinfo
-RUN apt-install-and-clear -y libclblas-dev libclfft-dev libclsparse-dev
-
-RUN echo "Upgrading dependencies"
-RUN apt-get upgrade -y
-
-RUN echo "Cloning TVM source & submodules"
-ENV TVM_PAR_DIR="/usr"
-RUN mkdir -p TVM_PAR_DIR && \
- cd ${TVM_PAR_DIR} && \
- git clone --depth=1 https://github.com/apache/tvm tvm --recursive
-#RUN git submodule update --init --recursive
-
-
-RUN echo "Building TVM"
-#USE_BLAS: "openblas" | "mkl" | "atlas" | "apple" | "none"
-ENV TVM_HOME="/usr/tvm"
-ENV TVM_BUILD_DIR="${TVM_HOME}/build"
-RUN mkdir -p ${TVM_BUILD_DIR} && \
- cd ${TVM_BUILD_DIR} && \
- cmake .. -DUSE_BLAS=openblas -DUSE_LLVM=ON -DUSE_OPENCL=ON && \
- make -j6
-
-RUN echo "Building Python package"
-ENV PYTHONPATH=${TVM_HOME}/python:${PYTHONPATH}
-RUN cd ${TVM_HOME}/python && python3 setup.py install --user
diff --git a/docker/Dockerfile.demo_rocm b/docker/Dockerfile.demo_rocm
deleted file mode 100644
index 4c6095ec48..0000000000
--- a/docker/Dockerfile.demo_rocm
+++ /dev/null
@@ -1,45 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Demo docker for ROCm
-FROM ubuntu:22.04
-
-COPY utils/apt-install-and-clear.sh /usr/local/bin/apt-install-and-clear
-
-COPY install/ubuntu_setup_tz.sh /install/ubuntu_setup_tz.sh
-RUN bash /install/ubuntu_setup_tz.sh
-
-COPY install/ubuntu_install_core.sh /install/ubuntu_install_core.sh
-RUN bash /install/ubuntu_install_core.sh
-
-ENV TVM_VENV /venv/apache-tvm-py3.9
-COPY python/bootstrap/lockfiles /install/python/bootstrap/lockfiles
-COPY install/ubuntu_install_python.sh /install/ubuntu_install_python.sh
-RUN bash /install/ubuntu_install_python.sh 3.9
-ENV PATH ${TVM_VENV}/bin:$PATH
-ENV PYTHONNOUSERSITE 1 # Disable .local directory from affecting CI.
-
-COPY install/ubuntu_install_python_package.sh
/install/ubuntu_install_python_package.sh
-RUN bash /install/ubuntu_install_python_package.sh
-
-COPY install/ubuntu2204_install_llvm.sh /install/ubuntu2204_install_llvm.sh
-RUN bash /install/ubuntu2204_install_llvm.sh
-
-COPY install/ubuntu_install_rocm.sh /install/ubuntu_install_rocm.sh
-RUN bash /install/ubuntu_install_rocm.sh
-
-ENV PATH "${PATH}:/opt/rocm/bin"
diff --git a/python/setup.py b/python/setup.py
deleted file mode 100644
index a83ad81856..0000000000
--- a/python/setup.py
+++ /dev/null
@@ -1,210 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-# pylint: disable=invalid-name, exec-used
-"""Setup TVM package."""
-import os
-import pathlib
-import shutil
-import sys
-
-from setuptools import find_packages
-from setuptools.dist import Distribution
-from setuptools import setup
-from setuptools.extension import Extension
-
-CURRENT_DIR = os.path.dirname(__file__)
-FFI_MODE = os.environ.get("TVM_FFI", "auto")
-CONDA_BUILD = os.getenv("CONDA_BUILD") is not None
-INPLACE_BUILD = "--inplace" in sys.argv
-
-
-def get_lib_path():
- """Get library path, name and version"""
- # We can not import `libinfo.py` in setup.py directly since __init__.py
- # Will be invoked which introduces dependencies
- libinfo_py = os.path.join(CURRENT_DIR, "./tvm/libinfo.py")
- libinfo = {"__file__": libinfo_py}
- exec(compile(open(libinfo_py, "rb").read(), libinfo_py, "exec"), libinfo,
libinfo)
- version = libinfo["__version__"]
- if not CONDA_BUILD and not INPLACE_BUILD:
- lib_path = libinfo["find_lib_path"]()
- libs = [lib_path[0]]
- if "runtime" not in libs[0]:
- for name in lib_path[1:]:
- if "runtime" in name:
- libs.append(name)
- break
-
- # Add byoc shared libraries, if present
- for name in lib_path:
- if "3rdparty" in name:
- libs.append(name)
-
- # Add tvmc configuration json files
- for name in lib_path:
- candidate_path =
os.path.abspath(os.path.join(os.path.dirname(name), "..", "configs"))
- if os.path.isdir(candidate_path):
- libs.append(candidate_path)
- break
-
- for dir in [
- "3rdparty",
- "jvm",
- "web",
- "rust",
- "golang",
- "include",
- "src",
- "cmake",
- "CMakeLists.txt",
- ]:
- for name in lib_path:
- candidate_path =
os.path.abspath(os.path.join(os.path.dirname(name), "..", dir))
- if os.path.exists(candidate_path):
- libs.append(candidate_path)
- if dir == "3rdparty":
- # remove large files
- _remove_path(os.path.join(candidate_path, "cutlass",
"docs"))
- _remove_path(os.path.join(candidate_path, "cutlass",
"media"))
- _remove_path(
- os.path.join(candidate_path,
"cutlass_fpA_intB_gemm", "cutlass", "docs")
- )
- _remove_path(
- os.path.join(
- candidate_path, "cutlass_fpA_intB_gemm",
"cutlass", "media"
- )
- )
- _remove_path(
- os.path.join(candidate_path, "libflash_attn",
"cutlass", "docs")
- )
- _remove_path(
- os.path.join(candidate_path, "libflash_attn",
"cutlass", "media")
- )
- break
- else:
- libs = None
-
- return libs, version
-
-
-def git_describe_version(original_version):
- """Get git describe version."""
- ver_py = os.path.join(CURRENT_DIR, "..", "version.py")
- libver = {"__file__": ver_py}
- exec(compile(open(ver_py, "rb").read(), ver_py, "exec"), libver, libver)
- _, gd_version = libver["git_describe_version"]()
- if gd_version != original_version and "--inplace" not in sys.argv:
- print("Use git describe based version %s" % gd_version)
- return gd_version
-
-
-def _remove_path(path):
- if os.path.exists(path):
- if os.path.isfile(path):
- os.remove(path)
- elif os.path.isdir(path):
- shutil.rmtree(path)
-
-
-LIB_LIST, __version__ = get_lib_path()
-__version__ = git_describe_version(__version__)
-
-if not CONDA_BUILD and not INPLACE_BUILD:
- # Wheel cleanup
- for path in LIB_LIST:
- libname = os.path.basename(path)
- _remove_path(f"tvm/{libname}")
-
-
-class BinaryDistribution(Distribution):
- def has_ext_modules(self):
- return True
-
- def is_pure(self):
- return False
-
-
-setup_kwargs = {}
-if not CONDA_BUILD and not INPLACE_BUILD:
- with open("MANIFEST.in", "w") as fo:
- for path in LIB_LIST:
- if os.path.isfile(path):
- shutil.copy(path, os.path.join(CURRENT_DIR, "tvm"))
- _, libname = os.path.split(path)
- fo.write(f"include tvm/{libname}\n")
-
- if os.path.isdir(path):
- _, libname = os.path.split(path)
- shutil.copytree(path, os.path.join(CURRENT_DIR, "tvm",
libname))
- fo.write(f"recursive-include tvm/{libname} *\n")
-
- setup_kwargs = {"include_package_data": True}
-
-
-def long_description_contents():
- with open(pathlib.Path(CURRENT_DIR).resolve().parent / "README.md",
encoding="utf-8") as readme:
- description = readme.read()
-
- return description
-
-
-# Temporarily add this directory to the path so we can import the requirements
generator
-# tool.
-sys.path.insert(0, os.path.dirname(__file__))
-import gen_requirements
-
-sys.path.pop(0)
-
-requirements = gen_requirements.join_requirements()
-extras_require = {
- piece: deps for piece, (_, deps) in requirements.items() if piece not in
("all", "core")
-}
-
-setup(
- name="tvm",
- version=__version__,
- description="TVM: An End to End Tensor IR/DSL Stack for Deep Learning
Systems",
- long_description=long_description_contents(),
- long_description_content_type="text/markdown",
- url="https://tvm.apache.org/",
- download_url="https://github.com/apache/tvm/tags",
- author="Apache TVM",
- license="Apache",
- # See https://pypi.org/classifiers/
- classifiers=[
- "Development Status :: 4 - Beta",
- "Intended Audience :: Developers",
- "Intended Audience :: Education",
- "Intended Audience :: Science/Research",
- ],
- keywords="machine learning",
- zip_safe=False,
- install_requires=requirements["core"][1],
- extras_require=extras_require,
- packages=find_packages(),
- package_dir={"tvm": "tvm"},
- distclass=BinaryDistribution,
- **setup_kwargs,
-)
-
-
-if not CONDA_BUILD and not INPLACE_BUILD:
- # Wheel cleanup
- os.remove("MANIFEST.in")
- for path in LIB_LIST:
- libname = os.path.basename(path)
- _remove_path(f"tvm/{libname}")