forked from apache/tvm
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpyproject.toml
More file actions
256 lines (229 loc) · 8.27 KB
/
Copy pathpyproject.toml
File metadata and controls
256 lines (229 loc) · 8.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
# 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.
[build-system]
requires = ["scikit-build-core>=0.11", "setuptools-scm>=8"]
build-backend = "scikit_build_core.build"
[project]
name = "apache-tvm"
# The version is derived from the most recent Git tag by setuptools_scm at build
# time (see [tool.setuptools_scm]); no manual version stamping is required.
dynamic = ["version"]
description = "Apache TVM: An End-to-End Deep Learning Compiler Stack"
readme = "README.md"
license = "Apache-2.0"
license-files = ["LICENSE"]
requires-python = ">=3.10"
authors = [{ name = "Apache TVM Community", email = "dev@tvm.apache.org" }]
keywords = ["machine learning", "compiler", "deep learning", "inference"]
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"Intended Audience :: Education",
"Intended Audience :: Science/Research",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Topic :: Scientific/Engineering :: Artificial Intelligence",
"Topic :: Software Development :: Libraries :: Python Modules",
]
dependencies = [
"apache-tvm-ffi>=0.1.12",
"ml_dtypes",
"numpy",
"typing_extensions",
]
[project.optional-dependencies]
torch = ["torch"]
cuda = ["cuda-python"]
meta-schedule = ["xgboost"]
popen-pool = ["psutil", "cloudpickle"]
rpc = ["tornado", "psutil", "cloudpickle"]
all = ["xgboost", "psutil", "cloudpickle", "tornado"]
[project.urls]
Homepage = "https://tvm.apache.org/"
Documentation = "https://tvm.apache.org/docs/"
Repository = "https://github.com/apache/tvm"
"Bug Tracker" = "https://github.com/apache/tvm/issues"
[dependency-groups]
torch = ["torch"]
popen-pool = ["psutil", "cloudpickle"]
test = [
"pytest",
"pytest-xdist",
"pytest-cov",
"pytest-mock",
"pytest-benchmark",
"pytest-timeout",
"pytest-rerunfailures",
"pytest-repeat",
{ include-group = "torch" },
{ include-group = "popen-pool" },
]
lint = ["ruff", "pre-commit"]
dev = [{ include-group = "test" }, { include-group = "lint" }]
[tool.scikit-build]
cmake.build-type = "Release"
wheel.py-api = "py3"
build-dir = "build/{wheel_tag}"
# Wheel configuration
wheel.packages = ["python/tvm"]
wheel.install-dir = "tvm"
# Derive the project version from the Git tag via setuptools_scm
# (configured under [tool.setuptools_scm]).
metadata.version.provider = "scikit_build_core.metadata.setuptools_scm"
# Source distribution configuration
sdist.include = [
# Build files
"/CMakeLists.txt",
"/pyproject.toml",
"/cmake/**/*",
# Source code
"/src/**/*.cc",
"/src/**/*.h",
"/include/**/*.h",
# Python source
"/python/tvm/**/*.py",
"/python/tvm/**/*.pyi",
# Documentation and metadata
"/docs/**/*",
"/LICENSE",
"/README.md",
"/NOTICE",
# Tests
"/tests/**/*",
]
sdist.exclude = [
"**/.git",
"**/.github",
"**/__pycache__",
"**/*.pyc",
"build",
"dist",
"**/3rdparty/*/docs",
"**/3rdparty/*/media",
"**/3rdparty/*/examples",
"**/3rdparty/*/test",
]
# Logging
logging.level = "INFO"
[tool.scikit-build.cmake.define]
TVM_BUILD_PYTHON_MODULE = "ON"
USE_CUDA = "OFF"
BUILD_TESTING = "OFF"
[tool.setuptools_scm]
# Version comes from the most recent Git tag (vMAJOR.MINOR.devN or vMAJOR.MINOR.PATCH).
# guess-next-dev reproduces the previous version.py behaviour for vMAJOR.MINOR.devN
# tags (e.g. v0.25.dev0 + N commits -> 0.25.devN). local_scheme = "no-local-version"
# drops the +g<hash> local segment: PyPI rejects local versions on upload, and
# this matches the public version the old version.py stamped.
version_file = "python/tvm/_version.py"
version_scheme = "guess-next-dev"
local_scheme = "no-local-version"
fallback_version = "0.25.dev0"
[tool.pytest.ini_options]
testpaths = ["tests"]
addopts = "-v --tb=short"
python_files = ["test_*.py", "*_test.py"]
python_classes = ["Test*"]
python_functions = ["test_*"]
markers = [
"adreno_clml: Mark a test as using adreno_clml",
"adreno_opencl_vulkan: Mark a test as using adreno_opencl_vulkan",
"adreno_vulkan: Mark a test as using adreno_vulkan",
"adreno_opencl: Mark a test as using adreno_opencl",
"adreno_opencl_real: Mark a test as using adreno_opencl_real",
]
[tool.ruff]
include = [
"python/**/*.py",
"tests/**/*.py",
"docs/**/*.py",
"apps/**/*.py",
"ci/scripts/**/*.py",
"conftest.py",
"jvm/**/*.py",
"web/tests/**/*.py",
]
line-length = 100
indent-width = 4
target-version = "py310"
exclude = ["3rdparty", "build", "dist", ".venv", ".ruff_cache", "node_modules"]
[tool.ruff.lint]
select = [
"E", # pycodestyle errors, https://docs.astral.sh/ruff/rules/#pycodestyle-e-w
"F", # pyflakes, https://docs.astral.sh/ruff/rules/#pyflakes-f
"I", # isort, https://docs.astral.sh/ruff/rules/#isort-i
"UP", # pyupgrade, https://docs.astral.sh/ruff/rules/#pyupgrade-up
"RUF", # ruff, https://docs.astral.sh/ruff/rules/#ruff-specific-rules-ruf
]
ignore = [
# pyupgrade (style preference or low-value)
"UP028", # yield-in-for-loop — sometimes clearer to keep
"UP030", # format-literals — minor
"UP031", # printf-string-formatting — style preference
# ruff (preview rules, not yet stable)
"RUF043", # pytest-raises-ambiguous-pattern
"RUF059", # unused-unpacked-variable
]
fixable = ["ALL"]
unfixable = []
[tool.ruff.lint.per-file-ignores]
"__init__.py" = ["E402", "F401", "F403", "F405"]
"python/tvm/relax/op/nn/nn.py" = ["E501"]
"docs/how_to/tutorials/mix_python_and_tvm_with_pymodule.py" = ["RUF003"]
"python/tvm/relax/frontend/tflite/tflite_frontend.py" = ["E501"]
"python/tvm/relax/transform/legalize_ops/nn.py" = ["E501"]
# Scope-id declarations like ``lane_id = Tx.lane_id([32])`` register a TIR
# scope_id for side effect; the Python handle is often unused. Silence F841
# for paths that heavily use this idiom.
"tests/python/tirx/**/*.py" = ["F841"]
[tool.ruff.lint.isort]
known-first-party = ["tvm"]
[tool.ruff.format]
quote-style = "double"
indent-style = "space"
skip-magic-trailing-comma = false
line-ending = "auto"
docstring-code-format = false
docstring-code-line-length = "dynamic"
[tool.cibuildwheel]
# Skip win32, i686 (32-bit), and musllinux wheels.
skip = "*-win32 *-manylinux_i686 *-musllinux*"
build-verbosity = 1
test-requires = ["pytest", "numpy"]
test-command = "pytest -vvs {project}/tests/python/all-platform-minimal-test"
[tool.cibuildwheel.linux]
repair-wheel-command = "auditwheel repair --exclude libtvm_ffi.so --exclude libtvm_runtime_cuda.so --exclude 'libcuda.so.*' --exclude 'libcudart.so.*' --exclude 'libnvrtc.so.*' --exclude 'libnvrtc-builtins.so.*' -w {dest_dir} {wheel}"
[tool.cibuildwheel.macos]
# delocate breaks libtvm_runtime.dylib's ad-hoc signature (it links the excluded
# libtvm_ffi.dylib) and arm64 dyld kills an unsigned Mach-O, so re-sign + repack.
repair-wheel-command = '''
set -euo pipefail
DELOCATE_TMP_DIR="$(mktemp -d)"
delocate-wheel --ignore-missing-dependencies --exclude libtvm_ffi.dylib --require-archs {delocate_archs} -w "$DELOCATE_TMP_DIR" -v {wheel}
python -m pip install -q wheel
TMP_DIR="$(mktemp -d)"
python -m wheel unpack "$DELOCATE_TMP_DIR"/*.whl -d "$TMP_DIR"
find "$TMP_DIR" -type f \( -name "*.dylib" -o -name "*.so" \) -exec codesign --force --sign - {} +
python -m wheel pack "$TMP_DIR"/*/ -d {dest_dir}
rm -rf "$DELOCATE_TMP_DIR" "$TMP_DIR"
'''
[tool.cibuildwheel.windows]
before-build = 'python -m pip install "delvewheel>=1.12.0"'
repair-wheel-command = 'delvewheel repair --analyze-existing --ignore-existing --exclude "*tvm_ffi*.dll" --exclude tvm_runtime_cuda.dll --exclude nvcuda.dll --exclude cudart64_13.dll --exclude nvrtc64_130_0.dll -w {dest_dir} {wheel}'