Unverified Commit 0f515b86 authored by Yichen Yan's avatar Yichen Yan Committed by GitHub
Browse files

[Build] Prefer libs from local build dir (#1027)

* Load libs from build dir, if present, to support faster rebuild.

* typo

* upd

* refine check

* md lint
parent d684094b
...@@ -75,6 +75,8 @@ if(USE_METAL) ...@@ -75,6 +75,8 @@ if(USE_METAL)
src/target/rt_mod_metal.cc src/target/rt_mod_metal.cc
) )
list(APPEND TILE_LANG_SRCS ${TILE_LANG_METAL_SRCS}) list(APPEND TILE_LANG_SRCS ${TILE_LANG_METAL_SRCS})
# FIXME: CIBW failed with backtrace, why???
set(TVM_FFI_USE_LIBBACKTRACE OFF)
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)
......
...@@ -208,9 +208,6 @@ pip install tilelang -f https://tile-ai.github.io/whl/nightly/cu121/ ...@@ -208,9 +208,6 @@ pip install tilelang -f https://tile-ai.github.io/whl/nightly/cu121/
## Install Configs ## Install Configs
tilelang use ffi/cython/dlpack to interact with pytorch tensor,
so `--no-build-isolation` and similar configs are not necessary.
### Build-time environment variables ### Build-time environment variables
`USE_CUDA`: If to enable CUDA support, default: `ON` on Linux, set to `OFF` to build a CPU version. By default, we'll use `/usr/local/cuda` for building tilelang. Set `CUDAToolkit_ROOT` to use different cuda toolkit. `USE_CUDA`: If to enable CUDA support, default: `ON` on Linux, set to `OFF` to build a CPU version. By default, we'll use `/usr/local/cuda` for building tilelang. Set `CUDAToolkit_ROOT` to use different cuda toolkit.
...@@ -251,3 +248,25 @@ VSCode with clangd and [clangd extension](https://marketplace.visualstudio.com/i ...@@ -251,3 +248,25 @@ VSCode with clangd and [clangd extension](https://marketplace.visualstudio.com/i
If you plan to use your wheel in other environment, If you plan to use your wheel in other environment,
it's recommend to use auditwheel (on Linux) or delocate (on Darwin) it's recommend to use auditwheel (on Linux) or delocate (on Darwin)
to repair them. to repair them.
## Faster rebuild for developers
`pip install` introduces extra [un]packaging and takes ~30 sec to complete,
even if no source change.
Developers who needs to recompile frequently could use:
```bash
pip install -r requirements-dev.txt
pip install -e . -v --no-build-isolation
cd build; ninja
```
When running in editable/developer mode,
you'll see logs like below:
```console
$ python -c 'import tilelang'
2025-10-14 11:11:29 [TileLang:tilelang.env:WARNING]: Loading tilelang libs from dev root: /Users/yyc/repo/tilelang/build
```
...@@ -38,6 +38,7 @@ dependencies = [ ...@@ -38,6 +38,7 @@ dependencies = [
"ml_dtypes", "ml_dtypes",
"psutil", "psutil",
"torch", "torch",
"torch>=2.7; platform_system == 'Darwin'"
] ]
[project.optional-dependencies] [project.optional-dependencies]
......
...@@ -5,9 +5,9 @@ build ...@@ -5,9 +5,9 @@ build
cmake>=3.26 cmake>=3.26
packaging packaging
setuptools>=61 setuptools>=61
scikit-build-core
torch torch
wheel wheel
tox
ninja ninja
auditwheel; platform_system == 'Linux' auditwheel; platform_system == 'Linux'
......
...@@ -31,7 +31,15 @@ DEV = False ...@@ -31,7 +31,15 @@ DEV = False
THIRD_PARTY_ROOT = os.path.join(TL_ROOT, '3rdparty') THIRD_PARTY_ROOT = os.path.join(TL_ROOT, '3rdparty')
if not os.path.exists(THIRD_PARTY_ROOT): if not os.path.exists(THIRD_PARTY_ROOT):
DEV = True DEV = True
THIRD_PARTY_ROOT = os.path.join(TL_ROOT, '..', '3rdparty') tl_dev_root = os.path.dirname(TL_ROOT)
dev_lib_root = os.path.join(tl_dev_root, 'build')
TL_LIBS = [dev_lib_root, os.path.join(dev_lib_root, 'tvm')]
THIRD_PARTY_ROOT = os.path.join(tl_dev_root, '3rdparty')
logger.warning(f'Loading tilelang libs from dev root: {dev_lib_root}')
assert TL_LIBS and all(
os.path.exists(i) for i in TL_LIBS), f'tilelang lib root do not exists: {TL_LIBS}'
def _find_cuda_home() -> str: def _find_cuda_home() -> str:
......
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