Ono-Sendai

Severe memory leak bug with printf in OpenCL kernel on RX 480

Discussion created by Ono-Sendai on Sep 7, 2016
Latest reply on Oct 4, 2016 by dipak

Hi AMD developers,

We have run into a severe memory leak bug with the AMD OpenCL drivers on the RX 480.

The issue is, is that if there is a printf call anywhere in the kernel C source code, then about 500KB of system RAM (not GPU RAM) is leaked per kernel execution.

This only seems to happen on RX 480s. 

Maybe it happens on other GPUs as well, but we haven't had any users run into problems on other GPUs.

This results in memory exhaustion rapidly.

 

Commenting out any calls to printf causes the memory leak to not occur.

 

An example kernel that leaks:

 

 

int print_int_(int x) { printf("%i\n", x); return x; }   

 

 

__kernel void testKernel(__global int* result0)

{

  const int gid = get_global_id(0);

  result0[0] = gid;

}

Outcomes