-
Notifications
You must be signed in to change notification settings - Fork 46
Hint the location of dependencies #267
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
base: develop
Are you sure you want to change the base?
Conversation
97150e5
to
1d9cbcf
Compare
If a ROCm package knows its installed under PACKAGE_PREFIX_DIR, it should search under that project prefix for related dependencies. This prevents users from having to add that prefix to their CMake module, path, which is a known antipattern.
1d9cbcf
to
ff41a6f
Compare
First, thats only used for when you are using cmake < 3.0, which I dont even think works anymore. Are you using cmake 2.8? Secondly, I am confused why this is needed. If a rocm package is found at Thirdly, setting Also, users should only set |
Re "why is this needed" - consider that the user is itself a library of some sort that's passing in Consider for example this quoted bit from the MLIR build
This shouldn't be happening That should just be But it can't be that because the ROCm packages themselves don't I'll replace this PR to handle CMake > 3.0 |
Similarly,
Why in the name of all this is holy is that a thing - that's what HINTS is for |
In order to not force libraries to manipulate CMAKE_PREFIX_PATH, including cases like our own hip-lang.cmake, make ROCm packages look in the place they're installed in order to find their dependencies. This also fixes the dependency-finding macro that's a fallback for pre-3.0 cmake to just forward all agruments to find_package()
Ping |
I dont understand the issue with doing I also dont understand why MLIR is doing the whole |
In short, I think you're wrong about this |
Its still searched before
If a component is tightly coupled to the version of another component then it should use an explicit version in the
But then it will use Furthermore, not all components use rocm-cmake and some components(like third-party dependencies) would probably never support such extension, which means you will need to set the prefix path anyway. This also assumes that any dependency we use in rocm will be in the same directory which is not true either. Third-party dependencies sometimes are taken from the system. Cmake's |
The specific claim I'm making is that every single CMake file we put in /opt/rocm that has a dependency on some other file in /opt/rocm should be HINTS-ing towards that file, so that once someone's build process finds one of the ROCm libraries - maybe they put a That is to say,
should not only work by default but should be what we're telling people to do |
But thats not the way cmake works. You need to put it in the |
Documented by who? Where? And why have all this PATHS and HINTS stuff if you're not meant to use it? Also, consider - instead of the CMAKE_PREFIX_PATH thing, one could just set the path to HIP directly - and that should be enough for hip to find its transitive dependencies Like, if this were about non-ROCm components - libblas or libm or something - I'd agree that the user has to tell us where to find them. However, these are internal dependencies of ROCm components that are packages as a group - it'd be much less error-prone for find_package(hip) to pull in all the libraries that sit next to whereever hip is, for example. |
Its documented here: https://rocm.docs.amd.com/en/latest/conceptual/cmake-packages.html And its based on how cmake documents how to find dependencies here: https://cmake.org/cmake/help/latest/guide/using-dependencies/index.html#config-file-packages Which both document using
|
To pull in previous sources motivating this change, https://reviews.llvm.org/D134753 , https://reviews.llvm.org/D142391 , @arsenm and @joker-eph Also, 4, I've seen people's builds break from the lack of this because something like vLLM will find the top-level package - possibly through something like Overall, I don't see the problem here |
It is required because
But you can just write
They are not always installed in the same prefix especially for source-based package managers.
Components are not always installed relative to each other and they need to be "relocatable", so we cannot use absolute paths either. The only way for a component to find another component is for the user to provide its location through the various cmake variables including Since /opt/rocm is a common location but not a standard location we can do |
+1. This is certainly not the norm among cmake builds. If I try to build a single rocm project repository against a rocm installed in a default location, I should have to set 0 flags to get the paths correct. If I do, the build is just bad and user hostile |
This change makes the rather basic assumption that if you find component A at [ROOT_PATH]/lib/cmake/A/, you'll find its dependency somewhere under [ROOT_PATH], probably [ROOT_PATH]/lib/cmake/B/ for internal ROCm-to-ROCm dependencies It's very very weird that we're not checking "nearby" inside whatever prefix we got installed to before moving on to system paths like /usr/lib This seems like an extremely reasonable thing for our build to be doing and it saves users from having to set up flags once they've discovered ROCM_PATH by any means they have available to them |
The norm is to set
Components do add |
And that assumption is not true for dependencies like |
|
Also, adding /opt/rocm to the prefix path internally is like a If there's any ROCm CMake file that's manipulating the prefix path internally, I'm pretty sure that's a bug |
If a ROCm package knows its installed under PACKAGE_PREFIX_DIR, it should search under that project prefix for related dependencies.
This prevents users from having to add that prefix to their CMake module, path, which is a known antipattern.