Skip to content

[offload] Fix finding amdgpu/nvptx-arch to generate tests #135072

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

Merged
merged 1 commit into from
Apr 9, 2025

Conversation

jdenny-ornl
Copy link
Collaborator

PR #134713, which landed as 79cb6f0, causes this on my test systems:

-- Building AMDGPU plugin for dlopened libhsa
-- Not generating AMDGPU tests, no supported devices detected. Use 'LIBOMPTARGET_FORCE_AMDGPU_TESTS' to override.
-- Building CUDA plugin for dlopened libcuda
-- Not generating NVIDIA tests, no supported devices detected. Use 'LIBOMPTARGET_FORCE_NVIDIA_TESTS' to override.

The problem is it cannot locate amdgpu-arch and nvptx-arch. This patch enables it to.

I suspect there is more cleanup to do here. amdgpu-arch and nvptx-arch do not appear to exist as cmake targets anymore, but there is still cmake code here that looks for those targets.

PR llvm#134713, which landed as 79cb6f0, causes this on my test
systems:

```
-- Building AMDGPU plugin for dlopened libhsa
-- Not generating AMDGPU tests, no supported devices detected. Use 'LIBOMPTARGET_FORCE_AMDGPU_TESTS' to override.
-- Building CUDA plugin for dlopened libcuda
-- Not generating NVIDIA tests, no supported devices detected. Use 'LIBOMPTARGET_FORCE_NVIDIA_TESTS' to override.
```

The problem is it cannot locate amdgpu-arch and nvptx-arch.  This
patch enables it to.

I suspect there is more cleanup to do here.  amdgpu-arch and
nvptx-arch do not appear to exist as cmake targets anymore, but there
is still cmake code here that looks for those targets.
@llvmbot
Copy link
Member

llvmbot commented Apr 9, 2025

@llvm/pr-subscribers-offload

Author: Joel E. Denny (jdenny-ornl)

Changes

PR #134713, which landed as 79cb6f0, causes this on my test systems:

-- Building AMDGPU plugin for dlopened libhsa
-- Not generating AMDGPU tests, no supported devices detected. Use 'LIBOMPTARGET_FORCE_AMDGPU_TESTS' to override.
-- Building CUDA plugin for dlopened libcuda
-- Not generating NVIDIA tests, no supported devices detected. Use 'LIBOMPTARGET_FORCE_NVIDIA_TESTS' to override.

The problem is it cannot locate amdgpu-arch and nvptx-arch. This patch enables it to.

I suspect there is more cleanup to do here. amdgpu-arch and nvptx-arch do not appear to exist as cmake targets anymore, but there is still cmake code here that looks for those targets.


Full diff: https://github.com/llvm/llvm-project/pull/135072.diff

1 Files Affected:

  • (modified) offload/cmake/Modules/LibomptargetGetDependencies.cmake (+2-2)
diff --git a/offload/cmake/Modules/LibomptargetGetDependencies.cmake b/offload/cmake/Modules/LibomptargetGetDependencies.cmake
index c296f7ea3863e..2a8bdebf2c1dd 100644
--- a/offload/cmake/Modules/LibomptargetGetDependencies.cmake
+++ b/offload/cmake/Modules/LibomptargetGetDependencies.cmake
@@ -51,7 +51,7 @@ if(TARGET nvptx-arch)
   get_property(LIBOMPTARGET_NVPTX_ARCH TARGET nvptx-arch PROPERTY LOCATION)
 else()
   find_program(LIBOMPTARGET_NVPTX_ARCH NAMES nvptx-arch
-               PATHS ${LLVM_TOOLS_BINARY_DIR}/bin)
+               PATHS ${LLVM_TOOLS_BINARY_DIR})
 endif()
 
 if(LIBOMPTARGET_NVPTX_ARCH)
@@ -75,7 +75,7 @@ if(TARGET amdgpu-arch)
   get_property(LIBOMPTARGET_AMDGPU_ARCH TARGET amdgpu-arch PROPERTY LOCATION)
 else()
   find_program(LIBOMPTARGET_AMDGPU_ARCH NAMES amdgpu-arch
-               PATHS ${LLVM_TOOLS_BINARY_DIR}/bin)
+               PATHS ${LLVM_TOOLS_BINARY_DIR})
 endif()
 
 if(LIBOMPTARGET_AMDGPU_ARCH)

@jhuber6
Copy link
Contributor

jhuber6 commented Apr 9, 2025

I'm unsure why the change would cause it to no longer emit to bin/. We still emit those programs but as symlinks. The existing test for the target already wouldn't work in a non-projects build so it's probably just silently acting like it did before.

@jdenny-ornl
Copy link
Collaborator Author

For me, before PR #134713, it took the if(TARGET amdgpu-arch) instead of the else.

Now in the else, "bin" is included in ${LLVM_TOOLS_BINARY_DIR}, so it was looking in bin/bin. I didn't check whether bin was included before PR #134713. I assume it was but it didn't take the else so it didn't matter.

Copy link
Contributor

@jhuber6 jhuber6 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Weird, usually the binary dir thing refers to the CMake output directory, not literal bin/. This should be the path that's taken on a runtimes build, so I'm unsure how it's hitting that. Could be some LLVM magic, I'm not sure.

@jdenny-ornl
Copy link
Collaborator Author

When I grep LLVM source for LLVM_TOOLS_BINARY_DIR, I see stuff like:

clang/CMakeLists.txt:  set(LLVM_TOOLS_BINARY_DIR "${LLVM_TOOLS_BINARY_DIR}" CACHE PATH "Path to llvm/bin")
clang/CMakeLists.txt:    if(EXISTS ${LLVM_TOOLS_BINARY_DIR}/FileCheck${CMAKE_EXECUTABLE_SUFFIX}
runtimes/CMakeLists.txt:  set(LLVM_TOOLS_BINARY_DIR ${LLVM_BINARY_DIR}/bin)

So it appears to be normal for it to include bin. Am I missing your point?

Copy link
Contributor

@jhuber6 jhuber6 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, but I'm wondering why this 'works' currently? (Or worked).

@jdenny-ornl jdenny-ornl merged commit 5709506 into llvm:main Apr 9, 2025
11 checks passed
@jdenny-ornl
Copy link
Collaborator Author

Thanks for the quick reviews.

Not sure what you mean by "works". For me, the offload tests just weren't generated, so everything quietly succeeded.

AllinLeeYL pushed a commit to AllinLeeYL/llvm-project that referenced this pull request Apr 10, 2025
PR llvm#134713, which landed as 79cb6f0, causes this on my test
systems:

```
-- Building AMDGPU plugin for dlopened libhsa
-- Not generating AMDGPU tests, no supported devices detected. Use 'LIBOMPTARGET_FORCE_AMDGPU_TESTS' to override.
-- Building CUDA plugin for dlopened libcuda
-- Not generating NVIDIA tests, no supported devices detected. Use 'LIBOMPTARGET_FORCE_NVIDIA_TESTS' to override.
```

The problem is it cannot locate amdgpu-arch and nvptx-arch. This patch
enables it to.

I suspect there is more cleanup to do here. amdgpu-arch and nvptx-arch
do not appear to exist as cmake targets anymore, but there is still
cmake code here that looks for those targets.
var-const pushed a commit to ldionne/llvm-project that referenced this pull request Apr 17, 2025
PR llvm#134713, which landed as 79cb6f0, causes this on my test
systems:

```
-- Building AMDGPU plugin for dlopened libhsa
-- Not generating AMDGPU tests, no supported devices detected. Use 'LIBOMPTARGET_FORCE_AMDGPU_TESTS' to override.
-- Building CUDA plugin for dlopened libcuda
-- Not generating NVIDIA tests, no supported devices detected. Use 'LIBOMPTARGET_FORCE_NVIDIA_TESTS' to override.
```

The problem is it cannot locate amdgpu-arch and nvptx-arch. This patch
enables it to.

I suspect there is more cleanup to do here. amdgpu-arch and nvptx-arch
do not appear to exist as cmake targets anymore, but there is still
cmake code here that looks for those targets.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants