diff --git a/CMakeLists.txt b/CMakeLists.txt index 7af7f854f..e050c89a0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -300,10 +300,15 @@ install(TARGETS tilelang_cython_wrapper RUNTIME DESTINATION tilelang/lib ARCHIVE DESTINATION tilelang/lib) -# add python z3 lib path to rpath for running tests and dev in current folder +# Copy libz3.so to build folder to workaround isolated build env issue if(USE_Z3 AND USE_PYPI_Z3) - set_property(TARGET tvm APPEND PROPERTY BUILD_RPATH ${Python3_SITELIB}/z3/lib) - set_property(TARGET tvm APPEND PROPERTY BUILD_RPATH ${Python3_SITELIB}/z3/bin) + get_target_property(Z3_LIBRARY_PATH z3::libz3 IMPORTED_LOCATION) + install(FILES "${Z3_LIBRARY_PATH}" DESTINATION "${CMAKE_BINARY_DIR}/tvm") + if(APPLE) + set_target_properties(tvm PROPERTIES BUILD_RPATH "@loader_path") + else() + set_target_properties(tvm PROPERTIES BUILD_RPATH "\$ORIGIN") + endif() endif() if(APPLE) @@ -320,11 +325,9 @@ elseif(UNIX) endif() endif() -# let libtilelang to search tvm/tvm_runtime in same dir -set_target_properties(tilelang PROPERTIES INSTALL_RPATH "${TILELANG_INSTALL_RPATH}") -set_target_properties(tilelang_module PROPERTIES INSTALL_RPATH "${TILELANG_INSTALL_RPATH}") -set_target_properties(tvm PROPERTIES INSTALL_RPATH "${TILELANG_INSTALL_RPATH}") -set_target_properties(tvm_runtime PROPERTIES INSTALL_RPATH "${TILELANG_INSTALL_RPATH}") +set_target_properties( + tilelang tilelang_module tvm tvm_runtime + PROPERTIES INSTALL_RPATH "${TILELANG_INSTALL_RPATH}") install( TARGETS tvm tvm_runtime tilelang_module tilelang diff --git a/pyproject.toml b/pyproject.toml index 54e93add4..32c0c6db1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -27,11 +27,8 @@ classifiers = [ ] dynamic = ["version"] dependencies = [ - "apache-tvm-ffi~=0.1.0", - # Extra constraint to tvm-ffi for abi issue, - # should be removed after our tvm's update. - # See discussion in tilelang#1373 and apache/tvm-ffi#307 - "apache-tvm-ffi>=0.1.6", + # Memory issue: tilelang#1502 + "apache-tvm-ffi~=0.1.0,>=0.1.6", # torch-c-dlpack-ext provides prebuilt torch extensions. # Without it, TVM FFI may require JIT compilation on first import. "torch-c-dlpack-ext", diff --git a/requirements-dev.txt b/requirements-dev.txt index 614a7e08b..3e53af250 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,6 +1,6 @@ # Requirements to run local build with `--no-build-isolation` or other developments -apache-tvm-ffi>=0.1.6 +apache-tvm-ffi~=0.1.0,>=0.1.6 build cmake>=3.26 cython>=3.0.0 diff --git a/requirements.txt b/requirements.txt index ff60dd491..5efd7c7f9 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,6 @@ # Runtime requirements -apache-tvm-ffi>=0.1.6 + +apache-tvm-ffi~=0.1.0,>=0.1.6 torch-c-dlpack-ext cloudpickle ml-dtypes