Skip to content

Cannot build MKLCPU backend with AdaptiveCpp #691

Open
@nilsfriess

Description

@nilsfriess

Summary

Building the MKLCPU backend with AdaptiveCpp doesn't work.

Version

> git rev-parse HEAD
ca1ecc28e86ac82280f3be586bc0d56ef83a0ab3

Environment

  • HW you use: Some AMD CPU
  • oneMKL 2025.1 (have same issue with 2024.2)
  • Ubuntu 24.04
  • AdaptiveCpp built from my own fork (it's built from a very recent AdaptiveCpp commit, it additionally defines sycl::span which seems to be required somewhere in oneMKL or oneMATH, don't remember exactly where): nilsfriess/OpenSYCL@79379c5. Additionally, the fork also has a small modification in AdaptiveCpp's compiler driver to ignore the -fsycl flag (of course this is a hack and should just be fixed in oneMath).

Steps to reproduce

Clone oneMath and apply the following diff:

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2826d1c..3930905 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -296,7 +296,7 @@ else()
       message(STATUS "Looking for hipSYCL")
       find_package(hipSYCL CONFIG REQUIRED)
       set(USE_ADD_SYCL_TO_TARGET_INTEGRATION true)
-      set (CMAKE_CXX_STANDARD 17)
+      set (CMAKE_CXX_STANDARD 20)
       add_library(ONEMATH::SYCL::SYCL INTERFACE IMPORTED)
     elseif(ONEMATH_SYCL_IMPLEMENTATION STREQUAL "dpc++")
       message(STATUS "Looking for dpc++")

This is just to make sure that the sycl::span implementation mentioned above (which essentially just does using sycl::span = std::span) works. Then build with

cmake .. -DCMAKE_CXX_COMPILER=acpp \ 
         -DONEMATH_SYCL_IMPLEMENTATION=hipsycl \ 
         -DENABLE_MKLCPU_BACKEND=True \ 
         -DBUILD_FUNCTIONAL_TESTS=False \ 
         -DBUILD_EXAMPLES=True \
         -DCMAKE_INSTALL_PREFIX=./install \
         -DTARGET_DOMAINS=blas \ 
         -DHIPSYCL_TARGETS=generic \
         -DENABLE_MKLGPU_BACKEND=False

Observed behavior

Configuring works, building fails: CMake output:

-- CMAKE_BUILD_TYPE: Release
-- TARGET_DOMAINS: blas
-- MKL_VERSION: 2024.2.0
-- MKL_ROOT: /opt/intel/oneapi/mkl/2024.2
-- MKL_SYCL_ARCH: intel64
-- MKL_ARCH: intel64
-- MKL_SYCL_LINK: dynamic
-- MKL_LINK: dynamic
-- MKL_SYCL_INTERFACE_FULL: intel_ilp64
-- MKL_INTERFACE_FULL: intel_ilp64
-- MKL_SYCL_THREADING: tbb_thread
-- MKL_THREADING: tbb_thread
-- MKL_MPI: intelmpi
-- Found /opt/intel/oneapi/mkl/2024.2/lib/libmkl_scalapack_ilp64.so
-- Found /opt/intel/oneapi/mkl/2024.2/lib/libmkl_cdft_core.so
-- Found /opt/intel/oneapi/mkl/2024.2/lib/libmkl_intel_ilp64.so
-- Found /opt/intel/oneapi/mkl/2024.2/lib/libmkl_tbb_thread.so
-- Found /opt/intel/oneapi/mkl/2024.2/lib/libmkl_core.so
-- Found /opt/intel/oneapi/mkl/2024.2/lib/libmkl_blacs_intelmpi_ilp64.so
-- Found /opt/intel/oneapi/mkl/2024.2/lib/libmkl_sycl_blas.so
-- Found /opt/intel/oneapi/mkl/2024.2/lib/libmkl_sycl_lapack.so
-- Found /opt/intel/oneapi/mkl/2024.2/lib/libmkl_sycl_dft.so
-- Found /opt/intel/oneapi/mkl/2024.2/lib/libmkl_sycl_sparse.so
-- Found /opt/intel/oneapi/mkl/2024.2/lib/libmkl_sycl_data_fitting.so
-- Found /opt/intel/oneapi/mkl/2024.2/lib/libmkl_sycl_rng.so
-- Found /opt/intel/oneapi/mkl/2024.2/lib/libmkl_sycl_stats.so
-- Found /opt/intel/oneapi/mkl/2024.2/lib/libmkl_sycl_vm.so
-- Looking for hipSYCL
CMake Deprecation Warning at /home/friessn/Projects/AdaptiveCpp/build/install/lib/cmake/hipSYCL/hipsycl-config.cmake:27 (message):
  find_package(hipSYCL) is deprecated.  Use find_package(AdaptiveCpp)
  instead.  For this, you may have to set
  -DAdaptiveCpp_DIR=/install/prefix/lib/cmake/AdaptiveCpp.  Additionally,
  replace -DHIPSYCL_* cmake arguments with -DACPP_*
Call Stack (most recent call first):
  CMakeLists.txt:297 (find_package)


-- ONEAPI_DEVICE_SELECTOR will be set to the following value(s): [opencl:cpu] for run-time dispatching examples
-- Configuring done (0.0s)
-- Generating done (0.0s)
-- Build files have been written to: /home/friessn/Projects/oneMath/build

Output after running make:

make.log

It seems (?) that the issue is somehow related to conversions from bfloat16 but honestly I'm not too sure what's going on.

Expected behavior

It should build.

Metadata

Metadata

Assignees

No one assigned

    Labels

    buildA request to change/fix/improve the build systemhelp wantedTasks, issues or features that could be implemented and contributed to the project

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions