deepseek-ai / deepseek-ai/TileKernels
[Bug][Compatibility] tile-kernels fails to import with TileLang 0.1.12
- Dominant language
- Python
- Stars
- 1.8k
- Forks
- 162
- PR merge metrics
- No merged PRs in 30d
Description
## Summary
`tile-kernels==1.0.0` fails to import when installed with TileLang 0.1.12.
TileKernels currently declares the following dependency:
```
tilelang>=0.1.9
```
Therefore, a fresh installation may resolve to TileLang 0.1.12. However, TileKernels still imports determine_target from the old module path:
```python
from tilelang.utils.target import determine_target
```
In TileLang 0.1.12, determine_target was moved to:
```python
from tilelang.backend.target import determine_target
```
As a result, importing `tile_kernels` raises a `ModuleNotFoundError`.
## Minimal reproduction
Run the following command will get `ModuleNotFoundError`
```bash
python -m pip install --no-cache-dir \
"tile-kernels==1.0.0" \
"tilelang==0.1.12"
python - <<'PY'
import importlib.metadata
print("tile-kernels:", importlib.metadata.version("tile-kernels"))
print("tilelang:", importlib.metadata.version("tilelang"))
from tile_kernels.modeling.mhc.functional import mhc_pre
PY
```
## Proposed fix
The root cause is in the file `tile_kernels/quant/common.py`. The following change will fix this bug and this is a common way to fix python dependency bug.
```python
try:
# TileLang >= 0.1.12
from tilelang.backend.target import determine_target
except ImportError:
# TileLang <= 0.1.11
from tilelang.utils.target import determine_target
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.