"test/ut/git@developer.sourcefind.cn:OpenDAS/nni.git" did not exist on "eaad98528c7aa714c9848800d607d6aa3bdd531d"
Unverified Commit bbbf4207 authored by guchaoyang's avatar guchaoyang Committed by GitHub
Browse files

Merge branch 'main' into dcu

parents 8f4628e0 5eb30a4f
--- ---
InheritParentConfig: true InheritParentConfig: true
ExtraArgs: ['-v'] ExtraArgs: []
FormatStyle: file FormatStyle: file
UseColor: true UseColor: true
WarningsAsErrors: '*' WarningsAsErrors: '*'
......
name: "Release Plan"
description: "Plan the next release"
title: "[Release Plan] vX.Y.Z"
labels:
- release-plan
- tracking
assignees: []
body:
- type: input
id: version
attributes:
label: "Version"
placeholder: "v0.2.0"
validations:
required: true
- type: input
id: milestone
attributes:
label: "Milestone"
description: "Link or name of the milestone for this release"
placeholder: "https://github.com/tile-ai/tilelang/milestone/XX"
- type: textarea
id: scope
attributes:
label: "Scope"
description: "Goals and non-goals (brief)"
placeholder: |
- Goals: ...
- Non-goals: ...
- type: textarea
id: tasks
attributes:
label: "Tasks"
description: "Task list; link issues/PRs"
value: |
- [ ] Features
- [ ] Fixes
- [ ] Docs
- [ ] API/Breaking changes
- [ ] Benchmarks
- [ ] Release notes
- type: checkboxes
id: readiness
attributes:
label: "Readiness"
options:
- label: "All planned issues closed or deferred"
- label: "Docs updated"
- label: "CI green; artifacts verified"
- label: "Release notes drafted"
- type: textarea
id: notes
attributes:
label: "Notes"
description: "Risks or communications (optional)"
placeholder: |
- Risk: ...
- Communication: ...
...@@ -22,10 +22,12 @@ env: ...@@ -22,10 +22,12 @@ env:
PYTHONDEVMODE: "1" PYTHONDEVMODE: "1"
PYTHONUNBUFFERED: "1" PYTHONUNBUFFERED: "1"
PYTHONPATH: "" # explicit cleanup PYTHONPATH: "" # explicit cleanup
PIP_USER: "" # explicit cleanup
COLUMNS: "100" COLUMNS: "100"
FORCE_COLOR: "1" FORCE_COLOR: "1"
CLICOLOR_FORCE: "1" CLICOLOR_FORCE: "1"
UV_INDEX_STRATEGY: "unsafe-best-match" UV_INDEX_STRATEGY: "unsafe-best-match"
UV_HTTP_TIMEOUT: "600"
XDG_CACHE_HOME: "${{ github.workspace }}/.cache" # to be updated XDG_CACHE_HOME: "${{ github.workspace }}/.cache" # to be updated
PIP_CACHE_DIR: "${{ github.workspace }}/.cache/pip" # to be updated PIP_CACHE_DIR: "${{ github.workspace }}/.cache/pip" # to be updated
UV_CACHE_DIR: "${{ github.workspace }}/.cache/uv" # to be updated UV_CACHE_DIR: "${{ github.workspace }}/.cache/uv" # to be updated
...@@ -44,7 +46,7 @@ jobs: ...@@ -44,7 +46,7 @@ jobs:
submodules: recursive submodules: recursive
- name: Setup Python 3.8 - name: Setup Python 3.8
id: setup-py38 id: setup-pylowest
uses: actions/setup-python@v6 uses: actions/setup-python@v6
with: with:
python-version: "3.8" # use lowest supported version for linting python-version: "3.8" # use lowest supported version for linting
...@@ -52,12 +54,12 @@ jobs: ...@@ -52,12 +54,12 @@ jobs:
- name: Check AST with Python 3.8 - name: Check AST with Python 3.8
run: | run: |
"${{ steps.setup-py38.outputs.python-path }}" -m compileall -q -f tilelang "${{ steps.setup-pylowest.outputs.python-path }}" -m compileall -q -f tilelang
- name: Setup Python 3.12 - name: Setup Python 3.9
uses: actions/setup-python@v6 uses: actions/setup-python@v6
with: with:
python-version: "3.12" python-version: "3.9"
update-environment: true update-environment: true
cache: pip cache: pip
cache-dependency-path: | cache-dependency-path: |
...@@ -127,13 +129,6 @@ jobs: ...@@ -127,13 +129,6 @@ jobs:
echo "UV_CACHE_DIR=${XDG_CACHE_HOME}/uv" | tee -a "${GITHUB_ENV}" echo "UV_CACHE_DIR=${XDG_CACHE_HOME}/uv" | tee -a "${GITHUB_ENV}"
echo "PRE_COMMIT_HOME=${XDG_CACHE_HOME}/pip/.pre-commit" | tee -a "${GITHUB_ENV}" echo "PRE_COMMIT_HOME=${XDG_CACHE_HOME}/pip/.pre-commit" | tee -a "${GITHUB_ENV}"
- name: Set environment (GitHub-hosted runners)
if: ${{ !startsWith(matrix.runner.name, 'self-hosted') }}
run: |
# Enable ccache on GitHub-hosted runners to speed up builds
echo "CMAKE_C_COMPILER_LAUNCHER=ccache" | tee -a "${GITHUB_ENV}"
echo "CMAKE_CXX_COMPILER_LAUNCHER=ccache" | tee -a "${GITHUB_ENV}"
# Do not use ccache on self-hosted runners, as it will download/upload caches which is slow. # Do not use ccache on self-hosted runners, as it will download/upload caches which is slow.
# Self-hosted runners usually have more CPU power to compile without ccache. # Self-hosted runners usually have more CPU power to compile without ccache.
- name: Setup ccache (GitHub-hosted runners) - name: Setup ccache (GitHub-hosted runners)
...@@ -142,8 +137,13 @@ jobs: ...@@ -142,8 +137,13 @@ jobs:
uses: hendrikmuhs/ccache-action@v1 uses: hendrikmuhs/ccache-action@v1
with: with:
create-symlink: true create-symlink: true
key: ccache-${{ runner.os }}-${{ runner.arch }}-${{ matrix.python-version }}-${{ matrix.runner.name }}-${{ matrix.runner.toolkit }}
evict-old-files: "7d" evict-old-files: "7d"
append-timestamp: false
key: ${{ runner.os }}-${{ runner.arch }}-${{ matrix.runner.toolkit }}-${{ hashFiles('**/*.cc') }}
restore-keys: |
${{ runner.os }}-${{ runner.arch }}-${{ matrix.runner.toolkit }}-${{ hashFiles('**/*.cc') }}
${{ runner.os }}-${{ runner.arch }}-${{ matrix.runner.toolkit }}
${{ runner.os }}-${{ runner.arch }}
- name: Set environment (CUDA) - name: Set environment (CUDA)
if: contains(matrix.runner.toolkit, 'CUDA') if: contains(matrix.runner.toolkit, 'CUDA')
...@@ -298,8 +298,9 @@ jobs: ...@@ -298,8 +298,9 @@ jobs:
echo "Using run-clang-tidy from $(command -v run-clang-tidy)" echo "Using run-clang-tidy from $(command -v run-clang-tidy)"
CLANG_TIDY=(run-clang-tidy) CLANG_TIDY=(run-clang-tidy)
else else
echo "Downloading run-clang-tidy script" RCT_URL=https://raw.githubusercontent.com/llvm/llvm-project/refs/heads/release/21.x/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py
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 echo "Downloading run-clang-tidy script from ${RCT_URL}"
echo "import urllib.request; url = '${RCT_URL}'.rstrip('/'); urllib.request.urlretrieve(url, url.split('/')[-1])" | uv run --no-project --script -
CLANG_TIDY=(uv run --no-project --script -- run-clang-tidy.py) CLANG_TIDY=(uv run --no-project --script -- run-clang-tidy.py)
fi fi
if [[ -x "$(command -v clang-apply-replacements)" ]]; then if [[ -x "$(command -v clang-apply-replacements)" ]]; then
...@@ -378,7 +379,7 @@ jobs: ...@@ -378,7 +379,7 @@ jobs:
pytest --verbose --color=yes --durations=0 --showlocals --cache-clear pytest --verbose --color=yes --durations=0 --showlocals --cache-clear
) )
"${PYTEST[@]}" --maxfail=3 --numprocesses=4 \ "${PYTEST[@]}" --maxfail=3 --numprocesses=4 \
./python/amd/test_tilelang_test_amd.py ./python/amd
# Apple Metal tests # Apple Metal tests
- name: Run Metal tests with Python ${{ matrix.python-version }} (${{ matrix.runner.toolkit }}) - name: Run Metal tests with Python ${{ matrix.python-version }} (${{ matrix.runner.toolkit }})
......
...@@ -44,12 +44,11 @@ jobs: ...@@ -44,12 +44,11 @@ jobs:
runs-on: macos-latest runs-on: macos-latest
timeout-minutes: 30 timeout-minutes: 30
env: env:
NO_VERSION_LABEL: ${{ github.event_name == 'release' && 'OFF' || 'ON' }} # `NO_VERSION_LABEL=ON` disables embedding the toolchain / git commit hash in version metadata.
# NO_GIT_VERSION disables embedding the git commit hash in version metadata.
# Otherwise, the version of the SDist has a git hash suffix (e.g., 0.1.0+gitabcdef12), # Otherwise, the version of the SDist has a git hash suffix (e.g., 0.1.0+gitabcdef12),
# but the package built from the SDist has no way to get the git hash (it is not a git repo), # but the package built from the SDist has no way to get the git hash (it is not a git repo),
# leading to inconsistent versions between SDist and built packages (+gitabcdef12 vs. +gitunknown). # leading to inconsistent versions between SDist and built packages (+gitabcdef12 vs. +gitunknown).
NO_GIT_VERSION: "ON" NO_VERSION_LABEL: 'ON'
steps: steps:
- name: Checkout repository - name: Checkout repository
...@@ -73,24 +72,26 @@ jobs: ...@@ -73,24 +72,26 @@ jobs:
uses: hendrikmuhs/ccache-action@v1 uses: hendrikmuhs/ccache-action@v1
with: with:
create-symlink: true create-symlink: true
key: ccache-${{ runner.os }}-${{ runner.arch }}
evict-old-files: "7d" evict-old-files: "7d"
append-timestamp: false
key: sdist-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('**/*.cc') }}
restore-keys: |
sdist-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('**/*.cc') }}
sdist-${{ runner.os }}-${{ runner.arch }}
${{ runner.os }}-${{ runner.arch }}
- name: Test SDist buildable - name: Test SDist buildable
run: | run: |
TEMP_DIR="$(mktemp -d -t tilelang-sdist-test)" TEMP_DIR="$(mktemp -d -t tilelang-sdist-test)"
cp -r dist "${TEMP_DIR}/dist" cp -r dist "${TEMP_DIR}/dist"
uv venv --seed "${TEMP_DIR}/venv"
source "${TEMP_DIR}/venv/bin/activate"
cd "${TEMP_DIR}" cd "${TEMP_DIR}"
python3 -m pip install --upgrade pip setuptools wheel uv pip install -v dist/*.tar.gz
python3 -m pip install -v dist/*.tar.gz
python3 -c "import tilelang; print(tilelang.__version__)" python3 -c "import tilelang; print(tilelang.__version__)"
- name: Upload SDist - name: Upload SDist
# Not PR to save artifact storage, as SDist is only needed for releases. # Not PR to save artifact storage, as SDist is only needed for releases.
if: github.event_name != 'pull_request' if: github.event_name != 'pull_request' || contains(github.event.pull_request.title, '[Release]')
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v5
with: with:
name: sdist name: sdist
path: dist/*.tar.gz path: dist/*.tar.gz
...@@ -108,14 +109,11 @@ jobs: ...@@ -108,14 +109,11 @@ jobs:
- { runner: ubuntu-24.04-arm, toolkit: "CUDA-12.8" } - { runner: ubuntu-24.04-arm, toolkit: "CUDA-12.8" }
- { runner: macos-latest, toolkit: "Metal" } - { runner: macos-latest, toolkit: "Metal" }
python-version: python-version:
- "3.8" # Wheels are built with Python 3.8 Limited API, they should work with all Python >= 3.8.
# TVM is built with Python 3.8 Limited API, it should work with all Python >= 3.8. # Only build wheels against Python 3.8 Limited API to save CI resources.
# - "3.9" # FIXME: Here we use Python 3.9 because our dependency `apache-tvm-ffi` claims to support
# - "3.10" # Python 3.8 but it depends on a version of `ml-dtypes` that requires Python >= 3.9.
# - "3.11" - "3.9"
# - "3.12"
# - "3.13"
# - "3.14"
fail-fast: false fail-fast: false
timeout-minutes: 120 timeout-minutes: 120
runs-on: ${{ matrix.target.runner }} runs-on: ${{ matrix.target.runner }}
...@@ -129,14 +127,19 @@ jobs: ...@@ -129,14 +127,19 @@ jobs:
fetch-depth: 1 fetch-depth: 1
submodules: recursive submodules: recursive
# NB: CIBW builds wheels in containers on Linux - name: Setup ccache
- name: Setup ccache (macOS only)
if: runner.os == 'macOS'
uses: hendrikmuhs/ccache-action@v1 uses: hendrikmuhs/ccache-action@v1
with: with:
create-symlink: true create-symlink: true
key: ccache-${{ runner.os }}-${{ runner.arch }}-${{ matrix.python-version }}-${{ matrix.target.toolkit }}
evict-old-files: "7d" evict-old-files: "7d"
append-timestamp: false
key: wheel-${{ runner.os }}-${{ runner.arch }}-${{ matrix.target.toolkit }}-${{ hashFiles('**/*.cc') }}
restore-keys: |
wheel-${{ runner.os }}-${{ runner.arch }}-${{ matrix.target.toolkit }}-${{ hashFiles('**/*.cc') }}
wheel-${{ runner.os }}-${{ runner.arch }}-${{ matrix.target.toolkit }}
wheel-${{ runner.os }}-${{ runner.arch }}
${{ runner.os }}-${{ runner.arch }}-${{ matrix.target.toolkit }}
${{ runner.os }}-${{ runner.arch }}
- name: Set CIBW_BUILD - name: Set CIBW_BUILD
run: | run: |
...@@ -151,6 +154,11 @@ jobs: ...@@ -151,6 +154,11 @@ jobs:
echo "CUDA_VERSION=${CUDA_VERSION}" | tee -a "${GITHUB_ENV}" echo "CUDA_VERSION=${CUDA_VERSION}" | tee -a "${GITHUB_ENV}"
fi fi
if [[ "${{ runner.os }}" == "Linux" ]]; then
HOST_CCACHE_DIR="$(ccache --get-config cache_dir)"
echo "CIBW_BEFORE_BUILD_LINUX=yum install -y ccache && ccache -o cache_dir=/host${HOST_CCACHE_DIR}" | tee -a "${GITHUB_ENV}"
fi
- name: Build wheels - name: Build wheels
uses: pypa/cibuildwheel@v3.2 uses: pypa/cibuildwheel@v3.2
with: with:
...@@ -160,7 +168,7 @@ jobs: ...@@ -160,7 +168,7 @@ jobs:
- name: Upload wheels - name: Upload wheels
# Not PR to save artifact storage, as wheels are only needed for releases. # Not PR to save artifact storage, as wheels are only needed for releases.
if: github.event_name != 'pull_request' if: github.event_name != 'pull_request' || contains(github.event.pull_request.title, '[Release]')
uses: actions/upload-artifact@v5 uses: actions/upload-artifact@v5
with: with:
name: wheels-${{ matrix.python-version }}-${{ runner.os }}-${{ runner.arch }}-${{ matrix.target.toolkit }} name: wheels-${{ matrix.python-version }}-${{ runner.os }}-${{ runner.arch }}-${{ matrix.target.toolkit }}
...@@ -170,13 +178,13 @@ jobs: ...@@ -170,13 +178,13 @@ jobs:
list-artifacts: list-artifacts:
name: List artifacts name: List artifacts
# Not PR to save artifact storage, as artifacts are only needed for releases. # Not PR to save artifact storage, as artifacts are only needed for releases.
if: github.event_name != 'pull_request' if: github.event_name != 'pull_request' || contains(github.event.pull_request.title, '[Release]')
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: [build-sdist, build-wheels] needs: [build-sdist, build-wheels]
timeout-minutes: 15 timeout-minutes: 15
steps: steps:
- name: Download built SDist - name: Download built SDist
uses: actions/download-artifact@v5 uses: actions/download-artifact@v6
with: with:
# unpacks default artifact into dist/ # unpacks default artifact into dist/
# if `name: artifact` is omitted, the action will create extra parent dir # if `name: artifact` is omitted, the action will create extra parent dir
......
...@@ -12,6 +12,17 @@ concurrency: ...@@ -12,6 +12,17 @@ concurrency:
group: "${{ github.workflow }}-${{ github.ref }}" group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: true # always cancel in-progress cancel-in-progress: true # always cancel in-progress
env:
PYTHONDEVMODE: "1"
PYTHONUNBUFFERED: "1"
PYTHONPATH: "" # explicit cleanup
PIP_USER: "" # explicit cleanup
COLUMNS: "100"
FORCE_COLOR: "1"
CLICOLOR_FORCE: "1"
XDG_CACHE_HOME: "${{ github.workspace }}/.cache" # to be updated
PIP_CACHE_DIR: "${{ github.workspace }}/.cache/pip" # to be updated
jobs: jobs:
perfbench: perfbench:
name: Benchmark between PR and main name: Benchmark between PR and main
...@@ -31,7 +42,12 @@ jobs: ...@@ -31,7 +42,12 @@ jobs:
- name: Setup Python - name: Setup Python
uses: actions/setup-python@v6 uses: actions/setup-python@v6
with: with:
python-version: "3.9" python-version: "3.12"
update-environment: true
cache: pip
cache-dependency-path: |
pyproject.toml
requirements*.txt
- name: Install merged version - name: Install merged version
run: | run: |
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
debug/ debug/
build/ build/
*dist/ *dist/
dist*/
wheelhouse/ wheelhouse/
__pycache__ __pycache__
nnfusion.tar.gz nnfusion.tar.gz
...@@ -101,3 +102,9 @@ tilelang/jit/adapter/cython/.cycache ...@@ -101,3 +102,9 @@ tilelang/jit/adapter/cython/.cycache
# CMake # CMake
cmake-build/ cmake-build/
cmake-build-*/ cmake-build-*/
# Git version for sdist
.git_commit.txt
# pre-commit cache
.pre-commit-cache/*
...@@ -41,7 +41,7 @@ repos: ...@@ -41,7 +41,7 @@ repos:
^.+\.json$ ^.+\.json$
) )
- repo: https://github.com/astral-sh/ruff-pre-commit - repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.14.1 # sync with requirements-lint.txt rev: v0.14.3 # sync with requirements-lint.txt
hooks: hooks:
- id: ruff-check - id: ruff-check
args: [--fix, --exit-non-zero-on-fix] args: [--fix, --exit-non-zero-on-fix]
......
Subproject commit 5bf17a34602931e7d7e01cbccf358a21fe972779 Subproject commit 093b2cdb2187140b197336496d65d61ace89e8ff
...@@ -8,6 +8,11 @@ set(CMAKE_CXX_STANDARD 17) ...@@ -8,6 +8,11 @@ set(CMAKE_CXX_STANDARD 17)
set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON) set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND "$ENV{CIBUILDWHEEL}")
# Warning came from tvm submodule
string(APPEND CMAKE_CXX_FLAGS " -Wno-dangling-reference")
endif()
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.gitmodules" AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git") if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.gitmodules" AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git")
...@@ -36,15 +41,74 @@ endif() ...@@ -36,15 +41,74 @@ endif()
find_program(CCACHE_PROGRAM ccache) find_program(CCACHE_PROGRAM ccache)
if(CCACHE_PROGRAM) if(CCACHE_PROGRAM)
message(STATUS "Using ccache: ${CCACHE_PROGRAM} with base_dir=${CMAKE_SOURCE_DIR}")
if(APPLE)
# Passing configs like `ccache base_dir=/xxx cc ...` is supported
# (likely) since ccache 4.x, which has been provided by homebrew.
# Our Linux builder image (manylinux2014 & manylinux_2_28) still
# provides ccache 3.x and do not support this form.
# `cibuildwheel` uses fixed folder on Linux (`/project`) as working directory,
# so cache would work without setting `base_dir`.
set(CCACHE_PROGRAM "${CCACHE_PROGRAM};base_dir=${CMAKE_SOURCE_DIR}")
endif()
set(CMAKE_C_COMPILER_LAUNCHER "${CCACHE_PROGRAM}" CACHE STRING "C compiler launcher") set(CMAKE_C_COMPILER_LAUNCHER "${CCACHE_PROGRAM}" CACHE STRING "C compiler launcher")
set(CMAKE_CXX_COMPILER_LAUNCHER "${CCACHE_PROGRAM}" CACHE STRING "CXX compiler launcher") set(CMAKE_CXX_COMPILER_LAUNCHER "${CCACHE_PROGRAM}" CACHE STRING "CXX compiler launcher")
set(CMAKE_CUDA_COMPILER_LAUNCHER "${CCACHE_PROGRAM}" CACHE STRING "CUDA compiler launcher") set(CMAKE_CUDA_COMPILER_LAUNCHER "${CCACHE_PROGRAM}" CACHE STRING "CUDA compiler launcher")
else()
find_program(SCCACHE_PROGRAM sccache)
if(SCCACHE_PROGRAM)
message(STATUS "Using sccache: ${SCCACHE_PROGRAM}")
set(CMAKE_C_COMPILER_LAUNCHER "${SCCACHE_PROGRAM}" CACHE STRING "C compiler launcher")
set(CMAKE_CXX_COMPILER_LAUNCHER "${SCCACHE_PROGRAM}" CACHE STRING "CXX compiler launcher")
set(CMAKE_CUDA_COMPILER_LAUNCHER "${SCCACHE_PROGRAM}" CACHE STRING "CUDA compiler launcher")
endif()
endif() endif()
# Configs # Configs
set(USE_CUDA OFF) set(TILELANG_BACKENDS CUDA ROCM METAL)
set(USE_ROCM OFF)
set(USE_METAL OFF) set(TILELANG_BACKEND_DOC_CUDA "Enable CUDA backend (ON/OFF/or CUDA SDK path)")
set(TILELANG_BACKEND_DOC_ROCM "Enable ROCm backend (ON/OFF/or ROCm SDK path)")
set(TILELANG_BACKEND_DOC_METAL "Enable Metal backend")
# TVM's config.cmake redefines USE_* options later, so we cache the user's choice
# (including explicit -DUSE_XXX arguments) before we include TVM and restore it
# afterwards.
macro(tilelang_define_backend_option BACKEND)
set(_backend_var "USE_${BACKEND}")
set(_doc "${TILELANG_BACKEND_DOC_${BACKEND}}")
set(_user_override_var "TILELANG_USER_OVERRIDE_${_backend_var}")
set(_user_override OFF)
if(DEFINED ${_user_override_var})
set(_user_override "${${_user_override_var}}")
endif()
if(DEFINED CACHE{${_backend_var}})
get_property(_cache_type CACHE ${_backend_var} PROPERTY TYPE)
if(_cache_type STREQUAL "UNINITIALIZED")
set(_user_override ON)
endif()
endif()
set(_default OFF)
if(DEFINED ${_backend_var})
set(_default "${${_backend_var}}")
endif()
option(${_backend_var} "${_doc}" "${_default}")
# Remember if the user explicitly set this option so that later logic
# won't auto-toggle backends they configured on the command line.
set(${_user_override_var} ${_user_override} CACHE INTERNAL
"User explicitly set ${_backend_var} during configuration" FORCE)
set(TILELANG_OPTION_${_backend_var} "${${_backend_var}}")
endmacro()
foreach(BACKEND IN LISTS TILELANG_BACKENDS)
tilelang_define_backend_option(${BACKEND})
endforeach()
set(PREBUILD_CYTHON ON) set(PREBUILD_CYTHON ON)
# Configs end # Configs end
...@@ -55,6 +119,14 @@ if(EXISTS ${TVM_SOURCE}/cmake/config.cmake) ...@@ -55,6 +119,14 @@ if(EXISTS ${TVM_SOURCE}/cmake/config.cmake)
else() else()
message(FATAL_ERROR "Nor tvm provided or submodule checkout-ed.") message(FATAL_ERROR "Nor tvm provided or submodule checkout-ed.")
endif() endif()
# Re-apply TileLang's preferred backend settings after TVM's config may have
# overridden the USE_* cache entries.
foreach(BACKEND IN LISTS TILELANG_BACKENDS)
set(_backend_var "USE_${BACKEND}")
set(_doc "${TILELANG_BACKEND_DOC_${BACKEND}}")
set(${_backend_var} ${TILELANG_OPTION_${_backend_var}} CACHE STRING "${_doc}" FORCE)
set(${_backend_var} ${TILELANG_OPTION_${_backend_var}})
endforeach()
# Include directories for TileLang # Include directories for TileLang
set(TILE_LANG_INCLUDES ${TVM_INCLUDES}) set(TILE_LANG_INCLUDES ${TVM_INCLUDES})
...@@ -68,21 +140,30 @@ file(GLOB TILE_LANG_SRCS ...@@ -68,21 +140,30 @@ file(GLOB TILE_LANG_SRCS
src/target/utils.cc src/target/utils.cc
src/target/codegen_cpp.cc src/target/codegen_cpp.cc
src/target/rt_mod_cpp.cc src/target/rt_mod_cpp.cc
# webgpu doesn't have system dependency
src/target/codegen_webgpu.cc
# intrin_rule doesn't have system dependency # intrin_rule doesn't have system dependency
src/target/intrin_rule*.cc src/target/intrin_rule*.cc
) )
# Backend-specific checks and configs # Track if the user explicitly selected a backend via cache options.
if($ENV{USE_METAL}) set(TILELANG_BACKEND_USER_SELECTED OFF)
foreach(BACKEND IN LISTS TILELANG_BACKENDS)
set(_backend_var "USE_${BACKEND}")
set(_override_var "TILELANG_USER_OVERRIDE_${_backend_var}")
if(${_backend_var} OR ${_override_var})
set(TILELANG_BACKEND_USER_SELECTED ON)
endif()
endforeach()
# Only auto-select a backend when the user didn't specify one explicitly.
if(NOT TILELANG_BACKEND_USER_SELECTED)
if($ENV{USE_METAL})
set(USE_METAL ON) set(USE_METAL ON)
elseif(APPLE) elseif(APPLE)
message(STATUS "Enable Metal support by default.") message(STATUS "Enable Metal support by default.")
set(USE_METAL ON) set(USE_METAL ON)
elseif($ENV{USE_ROCM}) elseif($ENV{USE_ROCM})
set(USE_ROCM ON) set(USE_ROCM ON)
else() else()
if($ENV{USE_CUDA}) if($ENV{USE_CUDA})
set(USE_CUDA ON) set(USE_CUDA ON)
elseif(DEFINED ENV{USE_CUDA} AND NOT $ENV{USE_CUDA}) elseif(DEFINED ENV{USE_CUDA} AND NOT $ENV{USE_CUDA})
...@@ -92,6 +173,7 @@ else() ...@@ -92,6 +173,7 @@ else()
message(STATUS "Enable CUDA support by default.") message(STATUS "Enable CUDA support by default.")
set(USE_CUDA ON) set(USE_CUDA ON)
endif() endif()
endif()
endif() endif()
if(USE_METAL) if(USE_METAL)
...@@ -104,7 +186,7 @@ if(USE_METAL) ...@@ -104,7 +186,7 @@ if(USE_METAL)
elseif(USE_ROCM) elseif(USE_ROCM)
set(CMAKE_HIP_STANDARD 17) set(CMAKE_HIP_STANDARD 17)
include(${TVM_SOURCE}/cmake/utils/FindROCM.cmake) include(${TVM_SOURCE}/cmake/utils/FindROCM.cmake)
find_rocm($ENV{USE_ROCM}) find_rocm(${USE_ROCM})
add_compile_definitions(__HIP_PLATFORM_AMD__ __HIP_PLATFORM_HCC__=1) add_compile_definitions(__HIP_PLATFORM_AMD__ __HIP_PLATFORM_HCC__=1)
file(GLOB TILE_LANG_HIP_SRCS file(GLOB TILE_LANG_HIP_SRCS
...@@ -148,12 +230,8 @@ target_include_directories(tilelang_objs PRIVATE ${TILE_LANG_INCLUDES}) ...@@ -148,12 +230,8 @@ target_include_directories(tilelang_objs PRIVATE ${TILE_LANG_INCLUDES})
add_library(tilelang SHARED $<TARGET_OBJECTS:tilelang_objs>) add_library(tilelang SHARED $<TARGET_OBJECTS:tilelang_objs>)
add_library(tilelang_module SHARED $<TARGET_OBJECTS:tilelang_objs>) add_library(tilelang_module SHARED $<TARGET_OBJECTS:tilelang_objs>)
target_link_libraries(tilelang PUBLIC tvm_runtime) target_link_libraries(tilelang PUBLIC tvm_runtime tvm)
target_link_libraries(tilelang_module PUBLIC tvm) target_link_libraries(tilelang_module PUBLIC tvm)
if(APPLE)
# FIXME: libtilelang should only link against tvm runtime
target_link_libraries(tilelang PUBLIC tvm)
endif()
# Build cython extension # Build cython extension
find_package(Python REQUIRED COMPONENTS Interpreter Development.Module ${SKBUILD_SABI_COMPONENT}) find_package(Python REQUIRED COMPONENTS Interpreter Development.Module ${SKBUILD_SABI_COMPONENT})
...@@ -181,18 +259,18 @@ install(TARGETS tilelang_cython_wrapper ...@@ -181,18 +259,18 @@ install(TARGETS tilelang_cython_wrapper
# let libtilelang to search tvm/tvm_runtime in same dir # let libtilelang to search tvm/tvm_runtime in same dir
if(APPLE) if(APPLE)
set_target_properties(tilelang PROPERTIES INSTALL_RPATH "@loader_path") set_target_properties(tilelang PROPERTIES INSTALL_RPATH "@loader_path;@loader_path/../../tvm_ffi/lib")
set_target_properties(tilelang_module PROPERTIES INSTALL_RPATH "@loader_path") set_target_properties(tilelang_module PROPERTIES INSTALL_RPATH "@loader_path;@loader_path/../../tvm_ffi/lib")
else() set_target_properties(tvm PROPERTIES INSTALL_RPATH "@loader_path;@loader_path/../../tvm_ffi/lib")
set_target_properties(tilelang PROPERTIES INSTALL_RPATH "\$ORIGIN") set_target_properties(tvm_runtime PROPERTIES INSTALL_RPATH "@loader_path;@loader_path/../../tvm_ffi/lib")
set_target_properties(tilelang_module PROPERTIES INSTALL_RPATH "\$ORIGIN") elseif(UNIX)
set_target_properties(tilelang PROPERTIES INSTALL_RPATH "\$ORIGIN:\$ORIGIN/../../tvm_ffi/lib")
set_target_properties(tilelang_module PROPERTIES INSTALL_RPATH "\$ORIGIN:\$ORIGIN/../../tvm_ffi/lib")
set_target_properties(tvm PROPERTIES INSTALL_RPATH "\$ORIGIN:\$ORIGIN/../../tvm_ffi/lib")
set_target_properties(tvm_runtime PROPERTIES INSTALL_RPATH "\$ORIGIN:\$ORIGIN/../../tvm_ffi/lib")
endif() endif()
install(TARGETS tvm tvm_runtime tilelang_module tilelang LIBRARY DESTINATION tilelang/lib) install(
TARGETS tvm tvm_runtime tilelang_module tilelang
# Copy tvm cython ext for wheels LIBRARY DESTINATION tilelang/lib
# TODO: not necessary for editable builds )
if(TVM_BUILD_FROM_SOURCE)
add_dependencies(tilelang tvm_cython)
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/tvm/python/tvm/ffi/core.abi3.so" DESTINATION tilelang/3rdparty/tvm/python/tvm/ffi/)
endif()
# Reference: https://setuptools.pypa.io/en/latest/userguide/miscellaneous.html
# Include licenses
include VERSION
include LICENSE
include THIRDPARTYNOTICES.txt
# Version and dependency files
include version_provider.py
include requirements*.txt
include tilelang/jit/adapter/cython/cython_wrapper.pyx
# Include source files in SDist
include CMakeLists.txt
graft src
graft cmake
graft 3rdparty
# Include test suites in SDist
graft testing
graft examples
global-exclude .coverage .coverage.* coverage.xml coverage-*.xml coverage.*.xml
global-exclude .junit .junit.* junit.xml junit-*.xml junit.*.xml
# Exclude unneeded files and directories
prune .git
prune .github
prune */.git
prune */.github
prune 3rdparty/clang*
prune 3rdparty/llvm*
# Prune compiled files
prune */__pycache__
global-exclude *~ *.py[cod] *.so *.a *.dylib *.pxd *.dll *.lib *.o *.obj
...@@ -13,6 +13,7 @@ Tile Language (**tile-lang**) is a concise domain-specific language designed to ...@@ -13,6 +13,7 @@ Tile Language (**tile-lang**) is a concise domain-specific language designed to
<img src=./images/MatmulExample.png /> <img src=./images/MatmulExample.png />
## Latest News ## 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. - 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! - 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: Check out the preview here:
......
0.1.6.post1 0.1.6.post2
...@@ -11,8 +11,17 @@ endif() ...@@ -11,8 +11,17 @@ endif()
set(TVM_INCLUDES set(TVM_INCLUDES
${TVM_SOURCE}/include ${TVM_SOURCE}/include
${TVM_SOURCE}/ffi/include
${TVM_SOURCE}/src ${TVM_SOURCE}/src
${TVM_SOURCE}/3rdparty/dlpack/include ${TVM_SOURCE}/3rdparty/dlpack/include
${TVM_SOURCE}/3rdparty/dmlc-core/include ${TVM_SOURCE}/3rdparty/dmlc-core/include
) )
if(EXISTS ${TVM_SOURCE}/ffi/include)
list(APPEND TVM_INCLUDES ${TVM_SOURCE}/ffi/include)
elseif(EXISTS ${TVM_SOURCE}/3rdparty/tvm-ffi/include)
list(APPEND TVM_INCLUDES ${TVM_SOURCE}/3rdparty/tvm-ffi/include)
endif()
if(EXISTS ${TVM_SOURCE}/3rdparty/tvm-ffi/3rdparty/dlpack/include)
list(APPEND TVM_INCLUDES ${TVM_SOURCE}/3rdparty/tvm-ffi/3rdparty/dlpack/include)
endif()
...@@ -23,6 +23,6 @@ RUN conda install pip cmake && conda install -c conda-forge libstdcxx-ng=12 && c ...@@ -23,6 +23,6 @@ RUN conda install pip cmake && conda install -c conda-forge libstdcxx-ng=12 && c
RUN apt-get install -y python3 python3-dev python3-setuptools gcc libtinfo-dev zlib1g-dev build-essential cmake libedit-dev libxml2-dev RUN apt-get install -y python3 python3-dev python3-setuptools gcc libtinfo-dev zlib1g-dev build-essential cmake libedit-dev libxml2-dev
RUN git clone https://github.com/tile-ai/tilelang.git --recursive -b main TileLang \ RUN git clone https://github.com/tile-ai/tilelang.git --recursive -b main TileLang \
&& cd TileLang && ./install_cuda.sh && cd TileLang && USE_CUDA=1 pip install -e . -v
CMD bash CMD bash
...@@ -23,6 +23,6 @@ RUN conda install pip cmake && conda install -c conda-forge libstdcxx-ng=12 && c ...@@ -23,6 +23,6 @@ RUN conda install pip cmake && conda install -c conda-forge libstdcxx-ng=12 && c
RUN apt-get install -y python3 python3-dev python3-setuptools gcc libtinfo-dev zlib1g-dev build-essential cmake libedit-dev libxml2-dev RUN apt-get install -y python3 python3-dev python3-setuptools gcc libtinfo-dev zlib1g-dev build-essential cmake libedit-dev libxml2-dev
RUN git clone https://github.com/tile-ai/tilelang.git --recursive -b main TileLang \ RUN git clone https://github.com/tile-ai/tilelang.git --recursive -b main TileLang \
&& cd TileLang && ./install_cuda.sh && cd TileLang && USE_CUDA=1 pip install -e . -v
CMD bash CMD bash
...@@ -23,6 +23,6 @@ RUN conda install pip cmake && conda install -c conda-forge libstdcxx-ng=12 && c ...@@ -23,6 +23,6 @@ RUN conda install pip cmake && conda install -c conda-forge libstdcxx-ng=12 && c
RUN apt-get install -y python3 python3-dev python3-setuptools gcc libtinfo-dev zlib1g-dev build-essential cmake libedit-dev libxml2-dev RUN apt-get install -y python3 python3-dev python3-setuptools gcc libtinfo-dev zlib1g-dev build-essential cmake libedit-dev libxml2-dev
RUN git clone https://github.com/tile-ai/tilelang.git --recursive -b main TileLang \ RUN git clone https://github.com/tile-ai/tilelang.git --recursive -b main TileLang \
&& cd TileLang && ./install_cuda.sh && cd TileLang && USE_CUDA=1 pip install -e . -v
CMD bash CMD bash
...@@ -23,6 +23,6 @@ RUN conda install pip cmake && conda install -c conda-forge libstdcxx-ng=12 && c ...@@ -23,6 +23,6 @@ RUN conda install pip cmake && conda install -c conda-forge libstdcxx-ng=12 && c
RUN apt-get install -y python3 python3-dev python3-setuptools gcc libtinfo-dev zlib1g-dev build-essential cmake libedit-dev libxml2-dev RUN apt-get install -y python3 python3-dev python3-setuptools gcc libtinfo-dev zlib1g-dev build-essential cmake libedit-dev libxml2-dev
RUN git clone https://github.com/tile-ai/tilelang.git --recursive -b main TileLang \ RUN git clone https://github.com/tile-ai/tilelang.git --recursive -b main TileLang \
&& cd TileLang && ./install_cuda.sh && cd TileLang && USE_CUDA=1 pip install -e . -v
CMD bash CMD bash
...@@ -23,6 +23,6 @@ RUN conda install pip cmake && conda install -c conda-forge libstdcxx-ng=12 && c ...@@ -23,6 +23,6 @@ RUN conda install pip cmake && conda install -c conda-forge libstdcxx-ng=12 && c
RUN apt-get install -y python3 python3-dev python3-setuptools gcc libtinfo-dev zlib1g-dev build-essential cmake libedit-dev libxml2-dev RUN apt-get install -y python3 python3-dev python3-setuptools gcc libtinfo-dev zlib1g-dev build-essential cmake libedit-dev libxml2-dev
RUN git clone https://github.com/tile-ai/tilelang.git --recursive -b main TileLang \ RUN git clone https://github.com/tile-ai/tilelang.git --recursive -b main TileLang \
&& cd TileLang && ./install_cuda.sh && cd TileLang && USE_CUDA=1 pip install -e . -v
CMD bash CMD bash
...@@ -23,6 +23,6 @@ RUN conda install pip cmake && conda install -c conda-forge libstdcxx-ng=12 && c ...@@ -23,6 +23,6 @@ RUN conda install pip cmake && conda install -c conda-forge libstdcxx-ng=12 && c
RUN apt-get install -y python3 python3-dev python3-setuptools gcc libtinfo-dev zlib1g-dev build-essential cmake libedit-dev libxml2-dev RUN apt-get install -y python3 python3-dev python3-setuptools gcc libtinfo-dev zlib1g-dev build-essential cmake libedit-dev libxml2-dev
RUN git clone https://github.com/tile-ai/tilelang.git --recursive -b main TileLang \ RUN git clone https://github.com/tile-ai/tilelang.git --recursive -b main TileLang \
&& cd TileLang && ./install_cuda.sh && cd TileLang && USE_CUDA=1 pip install -e . -v
CMD bash CMD bash
...@@ -23,6 +23,6 @@ RUN conda install pip cmake && conda install -c conda-forge libstdcxx-ng=12 && c ...@@ -23,6 +23,6 @@ RUN conda install pip cmake && conda install -c conda-forge libstdcxx-ng=12 && c
RUN apt-get install -y python3 python3-dev python3-setuptools gcc libtinfo-dev zlib1g-dev build-essential cmake libedit-dev libxml2-dev RUN apt-get install -y python3 python3-dev python3-setuptools gcc libtinfo-dev zlib1g-dev build-essential cmake libedit-dev libxml2-dev
RUN git clone https://github.com/tile-ai/tilelang.git --recursive -b main TileLang \ RUN git clone https://github.com/tile-ai/tilelang.git --recursive -b main TileLang \
&& cd TileLang && ./install_cuda.sh && cd TileLang && USE_CUDA=1 pip install -e . -v
CMD bash CMD bash
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment