Program hangs at clBuildProgram

Hello, my kernel was compiling and working as expected but now it hangs at clBuildProgram. Kernel code or OpenCL code on my source didn’t change between two attempts. I also tried building an empty kernel but it still hangs at clBuildProgram.
Here is my C++ code:

    /*
    struct FileData {
      char* Buffer;
      unsigned int Length; }
    */
    #define CL_HPP_ENABLE_EXCEPTIONS
    #define CL_HPP_TARGET_OPENCL_VERSION 200
    #include <CL/opencl.hpp>
    ...
    std::vector< cl::Platform > Platforms;
    cl::Platform::get(&Platforms);
    cl::Platform Platform = Platforms[0];
    
    if (!Platform())
      throw std::runtime_error("No OpenCL platform found.");
    
    std::vector<cl::Device> Devices;
    Platform.getDevices(CL_DEVICE_TYPE_GPU, &Devices);
    cl::Device Device = Devices[0];
    
    if (!Device())
      throw std::runtime_error("No compatible devices found.");
    
    cl::Context Context({ Device });
    cl::Program::Sources Source;
    FileData KernelCode = OpenFile("Source/TestKernel.cl");
    Source.push_back({ KernelCode.Buffer, KernelCode.Length });
    cl::Program Program(Context, Source);
    try
    {
      Program.build({ Device }); // Doesn't return
    }
    catch (cl::Error error)
    {
      std::cerr << Program.getBuildInfo<CL_PROGRAM_BUILD_LOG>(Device) << std::endl;
      throw std::runtime_error("Failed to build the kernel.");
    }
    ...

And my kernel code (TestKernel.cl):

    `__kernel void TestKernel() { }`

Please excuse any bad practice since I’m a beginner and mosty copy pasted this code.
I haven’t provided the rest of the code since it never executes, OpenFile(…) successfully reads the kernel and no exceptions are thrown.

My enviroment:

Visual Studio 2019 Community 16.8.4
Lastest OpenCL C++ headers from here
AMD Radeon RX5700XT (“gfx1010” reported by OpenCL)
Windows 10 version 2004

Thanks.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.