SYCL: DPC++ w/ NVIDIA support in configuration script

Issue #507 new
Colin MacLean created an issue

Currently, DPC++ and UPC++ can work together but doing so requires two modifications to upcxx-meta upon completion.

  • The CUDA header directory needs to be removed from the includes. CUDA provides OpenCL 1.2 headers while SYCL requires OpenCL 2.0. This causes the wrong versions to be used. For CUDA to be used directly, the non-OpenCL headers must be copied to a different directory: https://github.com/intel/llvm/issues/1265.
  • The -std=c++11 flag needs to be removed from CXXFLAGS. SYCL requires C++17 and things fail to compile. This applies to all SYCL, not just DPC++.

If we want to support SYCL interoperability, we should have a configure option to apply these changes automatically.

Detecting the DPC++ compiler is a bit tricky. If the compiler is an official build by Intel, it defines __INTEL_LLVM_COMPILER and has a version string containing Intel(R) oneAPI DPC++ Compiler. However, when the compiler is built manually from source for building with CUDA support, the macro is not set and appears as normal Clang. Furthermore, even vanilla Clang will accept an -fsycl flag, so detecting a SYCL compiler this way is incomplete, as well. Testing if the compiler is able to compile a program with -fsycl and #include <CL/sycl.hpp> should be enough to determine if the compiler is SYCL-capable, but it is also possible for someone to use a SYCL-capable compiler and not use SYCL but instead use Clang CUDA, in which case we wouldn’t want the CUDA include directory stripped. Therefore, we probably need a --with-sycl configure option until the header issue is resolved.

Comments (7)

  1. Paul Hargrove

    Regarding the -std=c++11:

    I am 75% certain that --with-cxx='dpcpp -std=c++17' at configure time can resolve this because we take care not to add an -std=... option in upcxx-meta if one already appears in $(CXX).

    Even if that is not to be the final soln, @Colin MacLean can you verify that works as I think it should?

  2. Log in to comment