oneapi-src / level-zero

oneAPI Level Zero Specification Headers and Loader
https://spec.oneapi.com/versions/latest/elements/l0/source/index.html
MIT License
208 stars 90 forks source link

Provide CMake config file #115

Closed spoutn1k closed 1 year ago

spoutn1k commented 1 year ago

Hello all,

I have been working on a LLVM OpenMP plugin to extend the compiler's offloading compatibility to Intel GPUs, using Level Zero. In the process of building the project, I noticed it was pretty hard to direct LLVM's CMake to the installed Level Zero in my environment. Other vendors provide a *-config.cmake file to allow for a simple FindPackage call, but I could not locate such a file for this project. https://cmake.org/cmake/help/latest/command/find_package.html#id6

If Level Zero does not have such a file, is there anything against adding one ? I can write one up and pull request it.

bmyates commented 1 year ago

Hi @spoutn1k,

Here is how some other projects locate level zero

1) Intel's LLVM based SYCL implementation uses FetchContent to bring in LevelZero. See: https://github.com/intel/llvm/blob/2826eb8bc4c87300ed2f85175eac4f1c7c8854d2/sycl/plugins/level_zero/CMakeLists.txt#L16

2) Intel's compute runtime driver uses a FindLevelZero.cmake file to locate level zero: https://github.com/intel/compute-runtime/blob/685a579456697c3a58db3c76ea1774a0c812ac73/level_zero/cmake/FindLevelZero.cmake

If you'd still like to add a -config.cmake file please go ahead and open the PR and we will review.

spoutn1k commented 1 year ago

Thank you for your detailed answer ! I will review those and adapt the one that suits the project best. Depending the time I have will also write the -config.cmake to allow for a project-independent method.

Cheers !