Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Packaging] Include BYOC dynamic libraries into wheel #16034

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ def get_lib_path():
libs.append(name)
break

# Add byoc shared libraries, if present
for name in lib_path:
if "3rdparty" in name:
libs.append(name)

# Add standalone_crt, if present
for name in lib_path:
candidate_path = os.path.join(os.path.dirname(name), "standalone_crt")
Expand Down
18 changes: 16 additions & 2 deletions python/tvm/_ffi/libinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,25 +112,39 @@ def find_lib_path(name=None, search_path=None, optional=False):
else:
lib_dll_path = [os.path.join(p, name) for p in dll_path]
runtime_dll_path = []
ext_lib_dll_path = []
else:
if sys.platform.startswith("win32"):
lib_dll_names = ["libtvm.dll", "tvm.dll"]
runtime_dll_names = ["libtvm_runtime.dll", "tvm_runtime.dll"]
ext_lib_dll_names = [
"3rdparty/cutlass_fpA_intB_gemm/cutlass_kernels/libfpA_intB_gemm.dll",
"3rdparty/libflash_attn/src/libflash_attn.dll",
]
elif sys.platform.startswith("darwin"):
lib_dll_names = ["libtvm.dylib"]
runtime_dll_names = ["libtvm_runtime.dylib"]
ext_lib_dll_names = [
"3rdparty/cutlass_fpA_intB_gemm/cutlass_kernels/libfpA_intB_gemm.dylib",
"3rdparty/libflash_attn/src/libflash_attn.dylib",
]
else:
lib_dll_names = ["libtvm.so"]
runtime_dll_names = ["libtvm_runtime.so"]
ext_lib_dll_names = [
"3rdparty/cutlass_fpA_intB_gemm/cutlass_kernels/libfpA_intB_gemm.so",
"3rdparty/libflash_attn/src/libflash_attn.so",
]

name = lib_dll_names + runtime_dll_names
name = lib_dll_names + runtime_dll_names + ext_lib_dll_names
lib_dll_path = [os.path.join(p, name) for name in lib_dll_names for p in dll_path]
runtime_dll_path = [os.path.join(p, name) for name in runtime_dll_names for p in dll_path]

ext_lib_dll_path = [os.path.join(p, name) for name in ext_lib_dll_names for p in dll_path]
if not use_runtime:
# try to find lib_dll_path
lib_found = [p for p in lib_dll_path if os.path.exists(p) and os.path.isfile(p)]
lib_found += [p for p in runtime_dll_path if os.path.exists(p) and os.path.isfile(p)]
lib_found += [p for p in ext_lib_dll_path if os.path.exists(p) and os.path.isfile(p)]
else:
# try to find runtime_dll_path
use_runtime = True
Expand Down