-
Notifications
You must be signed in to change notification settings - Fork 156
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
Manually check version of clang if ROCm is used. #800
Manually check version of clang if ROCm is used. #800
Conversation
This assumes, that ROCm's Clang is built from a git branch called `roc-Major-Minor-Patch`. An alternative approach would be to first (somehow) detect whether we have a ROCm clang and then parsing the output `${CLANG_EXECUTABLE_PATH} "-v" "-x" "hip" "--rocm-path=${ROCM_PATH}" "/dev/null"` for the string `Found HIP installation: .+, version ([0-9]+).([0-9]+).([0-9]+)`. Maybe we can detect whether we have AMD clang more easily from CMake? If not, we could rely on it reporting `AMD clang version ..`, which has to have been set using `-DCLANG_VENDOR="AMD clang"` during the LLVM build, though, which might not be the case if ROCm's llvm is built manually? Add exemplary check for ROCm < 5 to enable `HAS_TYPED_PTR`.
Version detection works fine with 4.2.0, 4.3.0, and 4.5.2. Does not work with 3.9.0 and 4.1.0 (clang does not print anything to differentiate it from upstream), but those versions are ancient, so whatever. Would've been nice if hipSYCL were to auto-apply the |
f760932
to
7b77785
Compare
7b77785
to
59a0fb7
Compare
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.
Awesome!
FWIW, this does not seem to work on Arch Linux with the rocm-arch AUR packages (https://github.com/rocm-arch/rocm-arch/blob/master/rocm-llvm/PKGBUILD):
Not a priority since Arch Linux is not an official supported ROCm target, but worth pointing out. |
Ah, I've been using https://aur.archlinux.org/packages/rocm-llvm on Manjaro, which apparently poses as the "official" AMD clang.
I don't know much about when the CMake integration was added / how reliably it can be used. |
hu, I think this is the package from the ROCm-Arch project and the same one that I am using. Do you get a different output there? I think getting ROCm version from Another idea to check for ROCm-clang might be to check whether clang lives in a subdirectory of |
I do get
For a refined version using the 2-stage approach see #807 |
This adds simplistic ROCm version discovery by relying on Clang's version output and adds an exemplary check for ROCm < 5 to enable
HAS_TYPED_PTR
. This should fix #797 and enable handling more issues more gracefully.This assumes, that ROCm's Clang is built from a git branch called
roc-([0-9]+).([0-9]+).([0-9]+)
.An alternative approach would be to first (somehow) detect whether we have a ROCm clang and then parsing the output
${CLANG_EXECUTABLE_PATH} "-v" "-x" "hip" "--rocm-path=${ROCM_PATH}" "/dev/null"
for the stringFound HIP installation: .+, version ([0-9]+).([0-9]+).([0-9]+)
.Maybe we can detect whether we have AMD clang more easily from CMake? If not, we could rely on it reporting
AMD clang version ..
, which has to have been set using-DCLANG_VENDOR="AMD clang"
during the LLVM build, though, which might not be the case if ROCm's llvm is built manually?I was only able to verify any of those commands' stability with ROCm 5.2. Maybe someone can chip in with testing 4.5 and if it fails reporting the output of those two commands:
@al42and could you check with 4.5.2?