This is an archive of the discontinued LLVM Phabricator instance.

[libomptarget][amdgpu] enable tests whenever possible.
ClosedPublic

Authored by ye-luo on Aug 24 2022, 11:07 AM.

Details

Summary

if(TARGET amdgpu-arch) doesn't work when ENABLE_LLVM_PROJECTS=openmp because openmp subdirectory is processed before clang subdirectory. Adopt the same logic of enabling tests like the CUDA plugin.

Diff Detail

Event Timeline

ye-luo created this revision.Aug 24 2022, 11:07 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 24 2022, 11:07 AM
ye-luo requested review of this revision.Aug 24 2022, 11:07 AM
Herald added a project: Restricted Project. · View Herald Transcript
JonChesterfield added a comment.EditedAug 24 2022, 11:19 AM

This replaces "enable tests when there's a GPU" with "enable tests when HSA is on the system". That would make it match nvptx. Did you consider the other way round, only run nvptx tests when a GPU is present, as opposed to when CUDA is installed?

ye-luo added a comment.EditedAug 24 2022, 11:58 AM

This replaces "enable tests when there's a GPU" with "enable tests when HSA is on the system". That would make it match nvptx.

The logic is changed to enable tests when HSA is on the system. Enable tests is not equal to run tests.

Did you consider the other way round, only run nvptx tests when a GPU is present, as opposed to when CUDA is installed?

Enabling tests should not depend on whether there is a GPU or not. My use case is, I build llvm on a node with many CPU cores. Then grab an AMD GPU node to run amdgpu tests and a NVDIA PGU node to run nvptx tests. All the nodes share a file system.

The old cmake has another broken logic. It will build amdgpu-arch since it is a CMake target but it tries to run amdgpu-arch via execute_process at CMake stage before it gets built. I'm pretty sure something in the environment gets pulled in instead of the one to be built.

JonChesterfield accepted this revision.Aug 24 2022, 12:20 PM

Use case is compelling for me. Build on one node and run on others is standard HPC fare. People who have HSA installed and no GPU and build llvm from source can disable their plugin with the existing cmake flag.

This revision is now accepted and ready to land.Aug 24 2022, 12:20 PM
This revision was automatically updated to reflect the committed changes.