Skip to content

Commit f8a6f32

Browse files
committed
Merge branch 'main' of https://github.com/tile-ai/tilelang into frontend-v2
2 parents 4d0bc85 + 10911e2 commit f8a6f32

File tree

155 files changed

+2935
-2182
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

155 files changed

+2935
-2182
lines changed

.clang-tidy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
InheritParentConfig: true
3-
ExtraArgs: ['-v']
3+
ExtraArgs: []
44
FormatStyle: file
55
UseColor: true
66
WarningsAsErrors: '*'

.github/workflows/ci.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,12 @@ env:
2222
PYTHONDEVMODE: "1"
2323
PYTHONUNBUFFERED: "1"
2424
PYTHONPATH: "" # explicit cleanup
25+
PIP_USER: "" # explicit cleanup
26+
COLUMNS: "100"
2527
FORCE_COLOR: "1"
2628
CLICOLOR_FORCE: "1"
2729
UV_INDEX_STRATEGY: "unsafe-best-match"
30+
UV_HTTP_TIMEOUT: "600"
2831
XDG_CACHE_HOME: "${{ github.workspace }}/.cache" # to be updated
2932
PIP_CACHE_DIR: "${{ github.workspace }}/.cache/pip" # to be updated
3033
UV_CACHE_DIR: "${{ github.workspace }}/.cache/uv" # to be updated
@@ -43,15 +46,15 @@ jobs:
4346
submodules: recursive
4447

4548
- name: Setup Python 3.8
46-
id: setup-py38
49+
id: setup-pylowest
4750
uses: actions/setup-python@v6
4851
with:
4952
python-version: "3.8" # use lowest supported version for linting
5053
update-environment: false
5154

5255
- name: Check AST with Python 3.8
5356
run: |
54-
"${{ steps.setup-py38.outputs.python-path }}" -m compileall -q -f tilelang
57+
"${{ steps.setup-pylowest.outputs.python-path }}" -m compileall -q -f tilelang
5558
5659
- name: Setup Python 3.12
5760
uses: actions/setup-python@v6
@@ -297,8 +300,9 @@ jobs:
297300
echo "Using run-clang-tidy from $(command -v run-clang-tidy)"
298301
CLANG_TIDY=(run-clang-tidy)
299302
else
300-
echo "Downloading run-clang-tidy script"
301-
wget -O run-clang-tidy.py https://raw.githubusercontent.com/llvm/llvm-project/refs/heads/release/21.x/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py
303+
RCT_URL=https://raw.githubusercontent.com/llvm/llvm-project/refs/heads/release/21.x/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py
304+
echo "Downloading run-clang-tidy script from ${RCT_URL}"
305+
echo "import urllib.request; url = '${RCT_URL}'.rstrip('/'); urllib.request.urlretrieve(url, url.split('/')[-1])" | uv run --no-project --script -
302306
CLANG_TIDY=(uv run --no-project --script -- run-clang-tidy.py)
303307
fi
304308
if [[ -x "$(command -v clang-apply-replacements)" ]]; then

.github/workflows/dist.yml

Lines changed: 82 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,74 @@ concurrency:
2828
group: "${{ github.workflow }}-${{ github.ref }}"
2929
cancel-in-progress: true
3030

31+
env:
32+
PYTHONDEVMODE: "1"
33+
PYTHONUNBUFFERED: "1"
34+
COLUMNS: "100"
35+
FORCE_COLOR: "1"
36+
CLICOLOR_FORCE: "1"
37+
3138
jobs:
39+
build-sdist:
40+
name: Build SDist
41+
if: |
42+
github.repository_owner == 'tile-ai' &&
43+
(github.event_name != 'pull_request' || !github.event.pull_request.draft)
44+
runs-on: macos-latest
45+
timeout-minutes: 30
46+
env:
47+
NO_VERSION_LABEL: ${{ github.event_name == 'release' && 'OFF' || 'ON' }}
48+
# NO_GIT_VERSION disables embedding the git commit hash in version metadata.
49+
# Otherwise, the version of the SDist has a git hash suffix (e.g., 0.1.0+gitabcdef12),
50+
# but the package built from the SDist has no way to get the git hash (it is not a git repo),
51+
# leading to inconsistent versions between SDist and built packages (+gitabcdef12 vs. +gitunknown).
52+
NO_GIT_VERSION: "ON"
53+
54+
steps:
55+
- name: Checkout repository
56+
uses: actions/checkout@v5
57+
with:
58+
fetch-depth: 1
59+
submodules: recursive
60+
61+
- name: Setup Python and uv with caching
62+
id: setup-uv
63+
uses: astral-sh/setup-uv@v7
64+
with:
65+
python-version: "3.12"
66+
activate-environment: true
67+
68+
- name: Build SDist
69+
run: |
70+
uv run --no-project --with=build -m -- build --sdist --outdir=dist
71+
72+
- name: Setup ccache
73+
uses: hendrikmuhs/ccache-action@v1
74+
with:
75+
create-symlink: true
76+
key: ccache-${{ runner.os }}-${{ runner.arch }}
77+
evict-old-files: "7d"
78+
79+
- name: Test SDist buildable
80+
run: |
81+
TEMP_DIR="$(mktemp -d -t tilelang-sdist-test)"
82+
cp -r dist "${TEMP_DIR}/dist"
83+
uv venv --seed "${TEMP_DIR}/venv"
84+
source "${TEMP_DIR}/venv/bin/activate"
85+
cd "${TEMP_DIR}"
86+
python3 -m pip install --upgrade pip setuptools wheel
87+
python3 -m pip install -v dist/*.tar.gz
88+
python3 -c "import tilelang; print(tilelang.__version__)"
89+
90+
- name: Upload SDist
91+
# Not PR to save artifact storage, as SDist is only needed for releases.
92+
if: github.event_name != 'pull_request'
93+
uses: actions/upload-artifact@v4
94+
with:
95+
name: sdist
96+
path: dist/*.tar.gz
97+
if-no-files-found: error
98+
3299
build-wheels:
33100
name: Build wheels for Python ${{ matrix.python-version }} on ${{ matrix.target.runner }} with ${{ matrix.target.toolkit }}
34101
if: |
@@ -41,14 +108,11 @@ jobs:
41108
- { runner: ubuntu-24.04-arm, toolkit: "CUDA-12.8" }
42109
- { runner: macos-latest, toolkit: "Metal" }
43110
python-version:
44-
- "3.8"
45-
# TVM is built with Python 3.8 Limited API, it should work with all Python >= 3.8.
46-
# - "3.9"
47-
# - "3.10"
48-
# - "3.11"
49-
# - "3.12"
50-
# - "3.13"
51-
# - "3.14"
111+
# Wheels are built with Python 3.8 Limited API, they should work with all Python >= 3.8.
112+
# Only build wheels against Python 3.8 Limited API to save CI resources.
113+
# FIXME: Here we use Python 3.9 because our dependency `apache-tvm-ffi` claims to support
114+
# Python 3.8 but it depends on a version of `ml-dtypes` that requires Python >= 3.9.
115+
- "3.9"
52116
fail-fast: false
53117
timeout-minutes: 120
54118
runs-on: ${{ matrix.target.runner }}
@@ -102,12 +166,20 @@ jobs:
102166

103167
list-artifacts:
104168
name: List artifacts
105-
# Not PR to save artifact storage, as wheels are only needed for releases.
169+
# Not PR to save artifact storage, as artifacts are only needed for releases.
106170
if: github.event_name != 'pull_request'
107171
runs-on: ubuntu-latest
108-
needs: [build-wheels]
172+
needs: [build-sdist, build-wheels]
109173
timeout-minutes: 15
110174
steps:
175+
- name: Download built SDist
176+
uses: actions/download-artifact@v5
177+
with:
178+
# unpacks default artifact into dist/
179+
# if `name: artifact` is omitted, the action will create extra parent dir
180+
name: sdist
181+
path: dist
182+
111183
- name: Download built wheels
112184
uses: actions/download-artifact@v6
113185
with:

.github/workflows/pr-perfbench-bot.yml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,17 @@ concurrency:
1212
group: "${{ github.workflow }}-${{ github.ref }}"
1313
cancel-in-progress: true # always cancel in-progress
1414

15+
env:
16+
PYTHONDEVMODE: "1"
17+
PYTHONUNBUFFERED: "1"
18+
PYTHONPATH: "" # explicit cleanup
19+
PIP_USER: "" # explicit cleanup
20+
COLUMNS: "100"
21+
FORCE_COLOR: "1"
22+
CLICOLOR_FORCE: "1"
23+
XDG_CACHE_HOME: "${{ github.workspace }}/.cache" # to be updated
24+
PIP_CACHE_DIR: "${{ github.workspace }}/.cache/pip" # to be updated
25+
1526
jobs:
1627
perfbench:
1728
name: Benchmark between PR and main
@@ -31,7 +42,12 @@ jobs:
3142
- name: Setup Python
3243
uses: actions/setup-python@v6
3344
with:
34-
python-version: "3.9"
45+
python-version: "3.12"
46+
update-environment: true
47+
cache: pip
48+
cache-dependency-path: |
49+
pyproject.toml
50+
requirements*.txt
3551
3652
- name: Install merged version
3753
run: |

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
debug/
2121
build/
2222
*dist/
23+
dist*/
2324
wheelhouse/
2425
__pycache__
2526
nnfusion.tar.gz

3rdparty/tvm

Submodule tvm updated from 9cda9b6 to fa576ec

CMakeLists.txt

Lines changed: 27 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ set(CMAKE_CXX_STANDARD 17)
88
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
99
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
1010

11+
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND "$ENV{CIBUILDWHEEL}")
12+
# Warning came from tvm submodule
13+
string(APPEND CMAKE_CXX_FLAGS " -Wno-dangling-reference")
14+
endif()
15+
1116
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
1217

1318
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.gitmodules" AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git")
@@ -36,9 +41,18 @@ endif()
3641

3742
find_program(CCACHE_PROGRAM ccache)
3843
if(CCACHE_PROGRAM)
44+
message(STATUS "Using ccache: ${CCACHE_PROGRAM}")
3945
set(CMAKE_C_COMPILER_LAUNCHER "${CCACHE_PROGRAM}" CACHE STRING "C compiler launcher")
4046
set(CMAKE_CXX_COMPILER_LAUNCHER "${CCACHE_PROGRAM}" CACHE STRING "CXX compiler launcher")
4147
set(CMAKE_CUDA_COMPILER_LAUNCHER "${CCACHE_PROGRAM}" CACHE STRING "CUDA compiler launcher")
48+
else()
49+
find_program(SCCACHE_PROGRAM sccache)
50+
if(SCCACHE_PROGRAM)
51+
message(STATUS "Using sccache: ${SCCACHE_PROGRAM}")
52+
set(CMAKE_C_COMPILER_LAUNCHER "${SCCACHE_PROGRAM}" CACHE STRING "C compiler launcher")
53+
set(CMAKE_CXX_COMPILER_LAUNCHER "${SCCACHE_PROGRAM}" CACHE STRING "CXX compiler launcher")
54+
set(CMAKE_CUDA_COMPILER_LAUNCHER "${SCCACHE_PROGRAM}" CACHE STRING "CUDA compiler launcher")
55+
endif()
4256
endif()
4357

4458
# Configs
@@ -68,8 +82,6 @@ file(GLOB TILE_LANG_SRCS
6882
src/target/utils.cc
6983
src/target/codegen_cpp.cc
7084
src/target/rt_mod_cpp.cc
71-
# webgpu doesn't have system dependency
72-
src/target/codegen_webgpu.cc
7385
# intrin_rule doesn't have system dependency
7486
src/target/intrin_rule*.cc
7587
)
@@ -181,18 +193,18 @@ install(TARGETS tilelang_cython_wrapper
181193

182194
# let libtilelang to search tvm/tvm_runtime in same dir
183195
if(APPLE)
184-
set_target_properties(tilelang PROPERTIES INSTALL_RPATH "@loader_path")
185-
set_target_properties(tilelang_module PROPERTIES INSTALL_RPATH "@loader_path")
186-
else()
187-
set_target_properties(tilelang PROPERTIES INSTALL_RPATH "\$ORIGIN")
188-
set_target_properties(tilelang_module PROPERTIES INSTALL_RPATH "\$ORIGIN")
196+
set_target_properties(tilelang PROPERTIES INSTALL_RPATH "@loader_path;@loader_path/../../tvm_ffi/lib")
197+
set_target_properties(tilelang_module PROPERTIES INSTALL_RPATH "@loader_path;@loader_path/../../tvm_ffi/lib")
198+
set_target_properties(tvm PROPERTIES INSTALL_RPATH "@loader_path;@loader_path/../../tvm_ffi/lib")
199+
set_target_properties(tvm_runtime PROPERTIES INSTALL_RPATH "@loader_path;@loader_path/../../tvm_ffi/lib")
200+
elseif(UNIX)
201+
set_target_properties(tilelang PROPERTIES INSTALL_RPATH "\$ORIGIN:\$ORIGIN/../../tvm_ffi/lib")
202+
set_target_properties(tilelang_module PROPERTIES INSTALL_RPATH "\$ORIGIN:\$ORIGIN/../../tvm_ffi/lib")
203+
set_target_properties(tvm PROPERTIES INSTALL_RPATH "\$ORIGIN:\$ORIGIN/../../tvm_ffi/lib")
204+
set_target_properties(tvm_runtime PROPERTIES INSTALL_RPATH "\$ORIGIN:\$ORIGIN/../../tvm_ffi/lib")
189205
endif()
190206

191-
install(TARGETS tvm tvm_runtime tilelang_module tilelang LIBRARY DESTINATION tilelang/lib)
192-
193-
# Copy tvm cython ext for wheels
194-
# TODO: not necessary for editable builds
195-
if(TVM_BUILD_FROM_SOURCE)
196-
add_dependencies(tilelang tvm_cython)
197-
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/tvm/python/tvm/ffi/core.abi3.so" DESTINATION tilelang/3rdparty/tvm/python/tvm/ffi/)
198-
endif()
207+
install(
208+
TARGETS tvm tvm_runtime tilelang_module tilelang
209+
LIBRARY DESTINATION tilelang/lib
210+
)

MANIFEST.in

Lines changed: 33 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,35 @@
1+
# Reference: https://setuptools.pypa.io/en/latest/userguide/miscellaneous.html
2+
3+
# Include licenses
14
include VERSION
2-
include CMakeLists.txt
3-
include requirements.txt
4-
include requirements-test.txt
5-
include requirements-dev.txt
5+
include LICENSE
6+
include THIRDPARTYNOTICES.txt
7+
8+
# Version and dependency files
9+
include version_provider.py
10+
include requirements*.txt
611
include tilelang/jit/adapter/cython/cython_wrapper.pyx
7-
recursive-include src *
8-
recursive-include 3rdparty *
9-
recursive-exclude 3rdparty/clang* *
10-
recursive-exclude 3rdparty/llvm* *
12+
13+
# Include source files in SDist
14+
include CMakeLists.txt
15+
graft src
16+
graft cmake
17+
graft 3rdparty
18+
19+
# Include test suites in SDist
20+
graft testing
21+
graft examples
22+
global-exclude .coverage .coverage.* coverage.xml coverage-*.xml coverage.*.xml
23+
global-exclude .junit .junit.* junit.xml junit-*.xml junit.*.xml
24+
25+
# Exclude unneeded files and directories
26+
prune .git
27+
prune .github
28+
prune */.git
29+
prune */.github
30+
prune 3rdparty/clang*
31+
prune 3rdparty/llvm*
32+
33+
# Prune compiled files
34+
prune */__pycache__
35+
global-exclude *~ *.py[cod] *.so *.a *.dylib *.pxd *.dll *.lib *.o *.obj

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Tile Language (**tile-lang**) is a concise domain-specific language designed to
1313
<img src=./images/MatmulExample.png />
1414

1515
## Latest News
16+
- 10/30/2025 📦: We have released v0.1.6.post2, which is the last version compatible with Python 3.8.
1617
- 10/07/2025 🍎: Added Apple Metal Device support, check out [Pull Request #799](https://github.com/tile-ai/tilelang/pull/799) for details.
1718
- 09/29/2025 🎉: Thrilled to announce that ​​AscendC​​ and ​Ascend​NPU IR​​ backends targeting Huawei Ascend chips are now supported!
1819
Check out the preview here:

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.1.6.post1
1+
0.1.6.post2

0 commit comments

Comments
 (0)