cpc / hipcl

OpenCL/SPIR-V implementation of HIP
Other
104 stars 12 forks source link

CMake integration #23

Open Kerilk opened 3 years ago

Kerilk commented 3 years ago

Hello,

Disclaimer: I am no expert in CMake...

We are currently trying to run hipcl on our test base: https://github.com/jz10/hip-test_suite Most simple examples are fine, and auto-tools build systems can also be configured without too much issues. Problems start arising when trying to build CMake based projects. The FindHIP.cmake of hipcl file seems to have diverged quite a bit from what HIP proposes nowadays: https://github.com/ROCm-Developer-Tools/HIP/blob/main/cmake/FindHIP.cmake In most cases this causes cmake to crash when a macro like hip_add_executable is missing, or reject hipcl:

  The following configuration files were considered but not accepted:

    /soft/compilers/hipcl/master-202010107/lib/hipcl/cmake/hip-config.cmake, version: unknown

As I already mentioned, I am no CMake expert so I don't feel confident adequately solving those issues. Nonetheless, it seems like a worthwhile investment, as hipcl is becoming increasingly stable, using it with bigger projects seems the likely next step.

Thanks

franz commented 3 years ago

CMake should be now more compatible with upstream HIP in master, although i have only tried it on a few samples. Please try it out and see if it works. You'll need to do a reinstall hipcl (there's no need to recompile clang+llvm).

Kerilk commented 3 years ago

Thanks, we'll try this out and let you know.

colleeneb commented 3 years ago

Thanks for this!

We tried it out on our system and it works to build more things than it used to! However, I was hoping that I could more or less use the exact same CMakeLists.txt from AMD hip to compile hipcl code.

I ran into one main issue: one of the codes I was trying to build with HIPCL uses the hip::device target from find_package(hip) to add compilation flags. hipcl doesn't define hip::device, but it defines just "hip::hipcl". Are there any plans to also define hip::device for hipcl so we can more easily use the same CMakeLists.txt as AMD hip?

I can respond with the CMakeLists.txt if that would help. Thanks!

colleeneb commented 3 years ago

Ping on this!

franz commented 3 years ago

Sorry, i'm not aware of what is "hip::device" and what should it provide. Haven't seen it in the HIP CMake code. We could add an empty target but i'm not sure if that would work.