-
Notifications
You must be signed in to change notification settings - Fork 6
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
[installation] fix llvm config #61
base: main
Are you sure you want to change the base?
Conversation
* [CMake] Fallback for finding static zstd library from the system LLVM17 now depends on `-lzstd` when the `--link-static` option is used. I.e: ``` $ llvm-config-16 --link-static --system-libs -lrt -ldl -lm -lz -ltinfo -lxml2 $ llvm-config-17 --link-static --system-libs -lrt -ldl -lm -lz -lzstd -ltinfo -lxml2 ``` The current cmake rules try to find a "Findzstd.cmake" file located within the project, although this doesn't seem to exist, resulting in a compilation error. This commit adds a fallback to search the system for libzstd.a incase a "Findzstd.cmake" is not found. The zstd library is already installed as part of: https://github.com/apache/tvm/pull/15799/files#diff-c2c0605a8fdd4f5600690a8c7b1ec769882426af1b0ed01e8aaa0814e3a8f5dbR48 Change-Id: I19ab168f92d23e98809851f948e2122345ed01f1 * Use llvm-config to locate Findzstd.cmake Use llvm-config to find the location of the "Find*.cmake" files and add this location to the cmake `CMAKE_MODULE_PATH` variable. This allows the build to discover "Findzstd.cmake". Change-Id: I3d25074fad3b2b8fa4c3d47e0e4c0b27d8739c65
llvm-config is now found by the following order: 1. the value of env var LLVM_CONFIG_CMD 2. the installed llvm-config-17 in the Ubuntu 22.04 images 3. download clang+llvm 13 and use the downloaded binary
@@ -111,6 +111,14 @@ macro(find_llvm use_llvm) | |||
message(FATAL_ERROR "Fatal error executing: ${LLVM_CONFIG} --libdir") | |||
endif() | |||
message(STATUS "LLVM libdir: ${__llvm_libdir}") | |||
execute_process(COMMAND ${LLVM_CONFIG} --cmakedir |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're planning to uplift tt-tvm to the latest version in the next period. Therefore, we're trying to avoid adding custom changes to their build and core engine just to make our life a bit easier during the next and future uplifts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To the latest apache-tvm? That would be awesome. It shouldn't be an issue because I'm cherry-picking one commit in that repo.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gfengTT can you share more details about the purpose of the change? Are we blocked on something due to that older version of LLVM linked to TVM?
@nvukobratTT the main purpose is to skip the downloading of llvm 13. The package is ~520M and after extraction takes 3.5G of disk space. As far as I can tell, all we need is the |
(copied from tenstorrent/tt-forge-fe#1185)
Problem description
llvm-config
binary;What's changed
Our forge docker image includes llvm-config-17. We only need to pick up a fix in apache-tvm, and to add the necessary packages in our docker image.
I've also added the option to specify a custom llvm-config in case we want to use another version, but so far I haven't run into any issue with llvm-config-17.