-
Notifications
You must be signed in to change notification settings - Fork 203
[cmake] Refuse too new or development LLVM versions by default #1805
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
[cmake] Refuse too new or development LLVM versions by default #1805
Conversation
I think it would be less confusing to just call it 25.06 at this point :)
Thanks for the heads up. Indeed, this breaks with ROCm 6.2+ (or so) which migrated to Clang 18. But what's the reason to disallow intermediate versions? I understand preventing future versions (even there, a warning would perhaps be more appropriate, IMO; LLVM is not breaking things every release, do they?) People already struggle to install ACpp, why make configuring more complex on known working configurations? I think more useful would be a check that prevents incompatible combinations of ROCm and mainline LLVM compilers, since that is pretty non-trivial to check (if one does not use ROCm LLVM, how does one know it's version to check against the LLVM used?) |
For what I remember minor version being 0 on ROCM LLVM is quite frequent (if not all of them). So I don't know about that check if(${LLVM_VERSION_MINOR} EQUAL 0)
message(SEND_ERROR "This LLVM seems to be a development version; only LLVM releases are tested and supported. Use -DACPP_EXPERIMENTAL_LLVM=ON if you still wish to try your luck.") Could it be feasible to have a specific code path if it is rocm/llvm since most concerns in this PR are in that case ? |
That would mean delaying the release by another month... I guess it depends on what the number means :) Maybe it just denotes the start of the release development cycle, rather than the release point? :)
I would say more often than not, things break in some way with a newer LLVM release. Things got worse post-14 with larger changes that the LLVM community is doing such as opaque pointers and the upcoming untyped The rationale behind preventing intermediate versions is that LLVM is a moving target, and in between intermediate versions, we have no way of determining which APIs are available and which are not. It's only working for you with ROCm LLVM (which typically sits in between releases) because you disable most of the compiler-based functionality.
IMO this PR makes it easier, because it aligns cmake behavior with what we have in our documentation and what is actually tested.
Accidentally building against development versions regularly occurs with users. For example, I strongly believe that this PR could have prevented the AdaptiveCpp issues that @masterleinad encountered and presented in his IWOCL talk. It happens again and again that people just use some clone of
We could special case the situation when ROCm LLVM is targeted and a minimum compiler configuration is requested?
The check is working exactly as intended :) Starting from LLVM version 18, the minor version being 0 indicates that this is a pre-release, development version of LLVM. From experience, it has become clear that it's virtually impossible for an out-of-tree LLVM-based project to robustly support arbitrary development version of LLVM. This only works when you have a fork of LLVM that is always synchronized with LLVM trunk (and even then you're not supporting arbitrary LLVM versions, but only tip-of-tree like e.g. llvm-spirv translator does). So, this PR refusing ROCm LLVM is a consequence of ROCm LLVM typically being in between LLVM releases, and thus potentially breaking many of the LLVM compiler functionality. As I said it might be possible to special case ROCm LLVM so that such a configuration is accepted for builds with minimum compiler compoments enabled (no SSCP, no stdpar, ...) since the less LLVM functionality is used, the less risk of breakage. And if you know what you're doing and you really, really want to build against intermediate version LLVM you can always override the check using Note that even if we special case ROCm LLVM with minimum compiler profile, this does not change the fact that such configurations are still untested! |
Thanks, that sounds reasonable.
Here, I was referring to a different issue, e.g., when one is using mainine LLVM 17 and ROCm 6.4 (based on LLVM 19), which, IIRC, is also not supported.
I'd like to point out that I totally blame AMD for not identifying their version properly in LLVM's CMake integration. But sadly in the end it's usability of ACpp that suffers. At least among our users, there's more people who don't know how what a "compiler" is than people who have random LLVM builds lying around :)
FWIW, we do test them manually for pre-releases. And, unlike any random LLVM commit, checking that ROCm LLVM works is at least feasible to do. |
I've added code that should skip the test if we're in a minimal compiler configuration against ROCm LLVM. The cmake detection of ROCm LLVM is new (we've had some previous code to check ROCm version, but I found it unreliable. E.g. it doesn't work on Arch ROCm packages), so it would be great if you could test whether it works for all your use cases!
Ah right, there are some additional constraints here. For SMCP, unfortunately there is no simple rule that we could "just implement" :( AMD has routinely changed things that can break compatibility with ROCm LLVM and vanilla LLVM (directory layouts, bitcode libraries, code object model, ...). Usually AdaptiveCpp LLVM == ROCm LLVM works, but it really depends on when exactly the required patches from ROCm have landed in upstream LLVM. We'd need to test every single ROCm version against different LLVM versions on an individual basis to figure out what actually works :(
Fair :) From my point of view, this PR is the last one I'd like to get in before release. Once you @al42and give green light, we can release from my side :) EDIT: Looks like CI has already successfully detected that we're trying to build an incompatible compiler (SSCP with LLVM 17 vs ROCm with LLVM 15) :D Although it's fine there because we can only do ROCm compiler testing (not JITting) in Github-hosted CI. Good to see that the detection seems to be doing its job. |
… enforce that for SSCP AdaptiveCpp LLVM <= ROCm LLVM
cb0413d
to
ec1fd0b
Compare
…ompatibility check and use in CI
We do not officially support development LLVM versions (only official releases) and currently do not test with LLVM > 20.
However, experience has shown that users regularly miss this restriction in our documentation and then are surprised when something breaks.
To avoid this, this PR adds additional cmake logic to check:
If these checks return that the LLVM version is unsupported, we now emit a cmake error.
Expert users or AdaptiveCpp developers wishing to to work on new LLVM releases can override this check using
-DACPP_EXPERIMENTAL_LLVM=ON
.@al42and I haven't tried with ROCm LLVM, but with this change it's quite likely that ROCm LLVM will be refused by default, so you may have to update your build instructions to include
-DACPP_EXPERIMENTAL_LLVM=ON
.