Skip to content

Conversation

oraluben
Copy link
Contributor

@oraluben oraluben commented Mar 20, 2025

As title.

Currently pypi wheels do not provide libraries required by libtvm_runtime.so and stuffs. This causes troubles like #172 and a so missing error mentioned in wechat group.

This PR shell fix it.

@LeiWang1999
Copy link
Member

LeiWang1999 commented Mar 20, 2025

awesome contributions :) !

@xwhzz would you mind help checking if this works?

@oraluben oraluben marked this pull request as ready for review March 20, 2025 15:38
@oraluben
Copy link
Contributor Author

I didn't test maint/scripts/docker_pypi_distribute.sh because there seems to be some issue in my docker. But I do manually run tox -e audit_2_27 to verify it works.

@xwhzz
Copy link
Contributor

xwhzz commented Mar 20, 2025

Yeah, I'll check this PR ASAP.

@xwhzz
Copy link
Contributor

xwhzz commented Mar 21, 2025

Thanks for your contribution. I've tested your proposed method on ubuntu 18.04 after running maint/scripts/docker_pypi_distribute.sh to build the wheel, but ran into a issue during library loading.

When installing the built wheel and attempting to import tilelang, I encounter a runtime error about missing TVM libraries:

>>> import tilelang
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/root/miniconda3/envs/py310/lib/python3.10/site-packages/tilelang/__init__.py", line 86, in <module>
    import tvm
  File "/root/miniconda3/envs/py310/lib/python3.10/site-packages/tilelang/3rdparty/tvm/python/tvm/__init__.py", line 26, in <module>
    from ._ffi.base import TVMError, __version__, _RUNTIME_ONLY
  File "/root/miniconda3/envs/py310/lib/python3.10/site-packages/tilelang/3rdparty/tvm/python/tvm/_ffi/__init__.py", line 28, in <module>
    from .base import register_error
  File "/root/miniconda3/envs/py310/lib/python3.10/site-packages/tilelang/3rdparty/tvm/python/tvm/_ffi/base.py", line 78, in <module>
    _LIB, _LIB_NAME = _load_lib()
  File "/root/miniconda3/envs/py310/lib/python3.10/site-packages/tilelang/3rdparty/tvm/python/tvm/_ffi/base.py", line 58, in _load_lib
    lib_path = libinfo.find_lib_path()
  File "/root/miniconda3/envs/py310/lib/python3.10/site-packages/tilelang/3rdparty/tvm/python/tvm/_ffi/libinfo.py", line 166, in find_lib_path
    raise RuntimeError(message)
RuntimeError: Cannot find libraries: ['libtvm.so', 'libtvm_runtime.so', '3rdparty/cutlass_fpA_intB_gemm/cutlass_kernels/libfpA_intB_gemm.so', '3rdparty/libflash_attn/src/libflash_attn.so']

​Library Availability:

  • Your build produces libtvm.so/libtvm_runtime.so in tilelang/lib, but the TVM Python package fails to detect them
  • Our nightly build works without including libcudart.so/libnvrtc.so, but your method bundles these CUDA runtime libraries

Directory Comparison:

Your Build (new)               Nightly Build (existing)
────────────────────────────────────────────────────────
libcudart-...so.12.1.55        (not present)
libnvrtc-...so.12.1.55         (not present)
libtilelang_module.so          libtilelang_module.so
libtilelang.so                 libtilelang.so
libtvm.so                      libtvm.so
libtvm_runtime.so              libtvm_runtime.so

The wheel files generated using your proposed approach for reference can be accessed via the link. Would you mind reviewing the build process to help identify where things might be going wrong?

@LeiWang1999
Copy link
Member

Thanks @xwhzz , and I think we should double check this commit and then we can release tilelang 0.1.3 :)

@oraluben
Copy link
Contributor Author

Sure, thanks for your review! I'll try to fix it.

@oraluben
Copy link
Contributor Author

oraluben commented Mar 22, 2025

previously add-apt-repository -y ppa:deadsnakes/ppa does not work on my environment. I modify the script a little bit to make it work. It's for installing python versions, right? Since we already have conda it can be safely removed. I also add a new dockerfile to make build environment more reproducible.

The auditwheel-ed wheels are located in ./wheelhouse, not ./dist. I've verified they can be imported successfully. Would you mind to test again on your side? @xwhzz

@oraluben
Copy link
Contributor Author

Sorry for the format! I'll take a look later.

@LeiWang1999
Copy link
Member

@oraluben run format.sh would help

@xwhzz
Copy link
Contributor

xwhzz commented Mar 22, 2025

Thanks for your guidance @oraluben. I found that the issue was caused by my outdated TVM submodule. After updating it, this PR works for me.

@oraluben
Copy link
Contributor Author

  • Our nightly build works without including libcudart.so/libnvrtc.so, but your method bundles these CUDA runtime libraries

As for this, is this still an issue? CUDA libs are excluded via --exclude /usr/local/cuda*, which should be the default install location of cuda runtime. How's nightly package built?

@LeiWang1999 LeiWang1999 merged commit eac2699 into tile-ai:main Mar 22, 2025
3 checks passed
@oraluben oraluben deleted the audit branch March 23, 2025 15:53
LeiWang1999 added a commit to LeiWang1999/tilelang that referenced this pull request Jul 18, 2025
* use auditwheel to get correct manylinux wheels

* fix

* make py3.8 happy

* trivial updates

* Add typing.Tuple import and update annotations

* fmt

* Remove unused import and update type hints

* lint fix

---------

Co-authored-by: Lei Wang <34334180+LeiWang1999@users.noreply.github.com>
Co-authored-by: LeiWang1999 <leiwang1999@outlook.com>
LeiWang1999 added a commit to LeiWang1999/tilelang that referenced this pull request Jul 20, 2025
* use auditwheel to get correct manylinux wheels

* fix

* make py3.8 happy

* trivial updates

* Add typing.Tuple import and update annotations

* fmt

* Remove unused import and update type hints

* lint fix

---------

Co-authored-by: Lei Wang <34334180+LeiWang1999@users.noreply.github.com>
Co-authored-by: LeiWang1999 <leiwang1999@outlook.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants