Summary
tile-kernels==1.0.0 fails to import when installed with TileLang 0.1.12.
TileKernels currently declares the following dependency:
Therefore, a fresh installation may resolve to TileLang 0.1.12. However, TileKernels still imports determine_target from the old module path:
from tilelang.utils.target import determine_target
In TileLang 0.1.12, determine_target was moved to:
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
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.
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
Summary
tile-kernels==1.0.0fails to import when installed with TileLang 0.1.12.TileKernels currently declares the following dependency:
Therefore, a fresh installation may resolve to TileLang 0.1.12. However, TileKernels still imports determine_target from the old module path:
In TileLang 0.1.12, determine_target was moved to:
As a result, importing
tile_kernelsraises aModuleNotFoundError.Minimal reproduction
Run the following command will get
ModuleNotFoundErrorpython -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 PYProposed 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.