clBuildProgram() fails with CL_OUT_OF_RESOURCES on Linux

Hi everybody,

I got a bug report from a Linux user that my program crashes. Using the log I was able to identify the problem: some OpenCL code fails to compile. But I can’t see any problems with the code. It also runs on many other platform/OS and device combinations without problems.

clBuildProgram() fails with CL_OUT_OF_RESOURCES and clGetProgramBuildInfo() returns nothing (empty string).

Could you, please, help me? Have you ever come across something similar?

Thanks,
Martin

This is the code that fails to compile:

// Multiplies two complex numbers.
inline float2 complexMultiply(float2 a, float2 b)
{
  return (float2)(a.x*b.x - a.y*b.y, a.x*b.y + a.y*b.x);
}

// Multiplies the complex numbers in a by corresponding elements in b.
// This effectively performs circular convolution in the frequency domain.
__kernel void filter(__global float2* a, __global float2* b)
{
  int id0 = get_global_id(0);
  int id1 = get_global_id(1);
  int size0 = get_global_size(0);

  int id = id1*size0 + id0;

  a[id] = complexMultiply(a[id], b[id0]);
}

// Assigns zero to all elements.
__kernel void zero(__global float* a)
{
  int id0 = get_global_id(0);
  a[id0] = 0;
}

The user’s system:

OpenCL info:
Selected platform: NVIDIA CUDA
Version: OpenCL 1.2 CUDA 9.1.84

OpenGL info:
Version: 4.6.0 NVIDIA 390.25
Renderer: GeForce GTX 465/PCIe/SSE2

I have the same problem.

I added the “-cl-nv-verbose” build flag in the hope this would give me a more useful clGetProgramBuildInfo(). And the error went away! Compiler bug I guess.

However, when I run my kernels clEnqueueNDRangeKernel will sometimes fail with error -9999, which is not a valid OpenCL error code as far is I know. This is a different problem of course, but both these errors give me the feeling the nvidia OpenCL compiler is not very well maintained. The fact that their ICD (still) doesn’t conform to the spec (doesn’t export all the required symbols, sou your icd loader needs to jump through extra hoops to look up the required functions) gives me the same feeling OpenCL is a second class citizen at nVidia.

pity, because I like the harwdware.

Found out somehwere -9999 means ‘invalid buffer read/write’(nvidia specific).

Just in case it helps someone else looking for this info.

Alas the CL_OUT_OF_RESOURCES on clBuildprogram remains. It was gone adding the “-cl-nv-verbose” compiler flag, but it came back after some trivial changes to the kernel.