Skip to content

[Bug][Compatibility] tile-kernels fails to import with TileLang 0.1.12 #24

Description

@GenTang

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:

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions