SYCL - no GPU platform detected in Windows Visual Studio

263 views Asked by At

I want to do workload on Nvidia GPU with SYCL in Windows 10 Pro 21H2 19044.3086. SYCL guide states that CUDA backend in supported on Windows:

Build DPC++ toolchain with support for NVIDIA CUDA
To enable support for CUDA devices, follow the instructions... for Windows DPC++ toolchain 
Note, the CUDA backend has Windows support

When testing hardware support using computecpp from here in Powershell I get:

PS D:\repos\ComputeCpp\bin> .\computecpp_info.exe
********************************************************************************
SYCL 1.2.1 revision 3
********************************************************************************
Device Info:
Discovered 3 devices matching:
  platform    : <any>
  device type : <any>
--------------------------------------------------------------------------------
Device 0:
  Device is supported                     : UNTESTED - Vendor not tested on this OS
  Bitcode targets                         : spirv64 ptx64
  CL_DEVICE_NAME                          : NVIDIA GeForce RTX 3060 Laptop GPU
  CL_DEVICE_VENDOR                        : NVIDIA Corporation
  CL_DRIVER_VERSION                       : 535.98
  CL_DEVICE_TYPE                          : CL_DEVICE_TYPE_GPU
--------------------------------------------------------------------------------
Device 1:
  Device is supported                     : UNTESTED - Device running untested driver
  CL_DEVICE_NAME                          : AMD Ryzen 5 5600H with Radeon Graphics
--------------------------------------------------------------------------------
Device 2:
  Device is supported                     : UNTESTED - Device not tested on this OS
  CL_DEVICE_NAME                          : Intel(R) FPGA Emulation Device

However, checking available platforms in Visual Studio 2022 using oneAPI DPC++ Compiler 2023 I'm not getting GPU, only CPU and FPGA emulator:

Found platform: Intel(R) FPGA Emulation Platform for OpenCL(TM)
 Device: Intel(R) FPGA Emulation Device

Found platform: Intel(R) OpenCL
 Device: AMD Ryzen 5 5600H with Radeon Graphics

Code used for this:

#include <sycl/sycl.hpp>
#include <iostream>
#if FPGA || FPGA_EMULATOR
#include <sycl/ext/intel/fpga_extensions.hpp>
#endif

using namespace sycl;
int main(int argc, char* argv[]) {
    // Loop through available platforms
    for (auto const& this_platform : platform::get_platforms()) {
        std::cout << "Found platform: "
            << this_platform.get_info<info::platform::name>() << "\n";
        // Loop through available devices in this platform
        for (auto const& this_device : this_platform.get_devices()) {
            std::cout << " Device: "
                << this_device.get_info<info::device::name>() << "\n";
        }
        std::cout << "\n";
    }
    return 0;
}

I also have CUDA 12.2 installed and can run CUDA projects in VS2022. Why in DPC++ project GPU is not found (both release and debug modes)? What should I do to fix it?

1

There are 1 answers

0
hjab On

If you're on Linux, you can use Intel's DPC++ releases with Codeplay's OneAPI for NVidia GPUs plugin. This isn't released on Windows yet.

To target NVidia GPUs on Windows, you'll need to build the open-source DPC++ from source with the appropriate flags. Documentation on how to do this available in the Intel/llvm repository.

Once you've built and installed this, you can test that your NVidia devices are correctly found using sycl-ls (or sycl-ls --verbose for more detail).

As to why you're seeing the CUDA device with computecpp_info.exe: ComputeCpp is independent of DPC++. You should use computecpp_info.exe only if you're using ComputeCpp as your SYCL compiler. However, Codeplay states that ComputeCpp's CUDA support has been superseeded by that of DPC++ in 2020, and that ComputeCpp is no longer supported since September 1st.