Driver crash on OpenCL compiling for old GPUs

Some time ago our users encountered driver crashes in amdocl12cl64.dll on OpenCL compilations for some old GPUs like these:

- HD 7570 (Turks)

- HD 7500G (Devastator)

- ATI FirePro V7800 (FireGL) (Cypress)

- AMD Radeon HD 5800 Series (Cypress)

- AMD Radeon HD 6670 (Turks)

- AMD Radeon HD 8670D (Devastator)

- AMD FirePro M3900 (Caicos)

 

While the same binary was successfully executed on R9 390X, HD 7970 and multiple Intel iGPUs.

 

And I want to log this problem here just in case somebody will encounter the similar problem.

 

We workarounded the problem by buying old HD 6670 and running kernels compilation after commenting out more and more code until driver stopped crashing on compilation. And the problem place was found to be in this function:

 

unsigned short atomicAdd_g_u16(volatile __global unsigned short *addr, unsigned short val)

{

   volatile __global unsigned int *base_address = (volatile __global unsigned int *) ((volatile __global char *) addr - ((size_t) addr & 2));

   unsigned int long_val = ((size_t) addr & 2) ? ((unsigned int) val << 16) : (unsigned short) val;

   unsigned int long_old = atomic_add(base_address, long_val);

   if((size_t) addr & 2) {

   return (unsigned short) (long_old >> 16);

  } else {

   return (unsigned short) (long_old & 0xffff);

  }

}

 

So it seems that for old GPUs driver couldn't compile cast from pointer to size_t.

 

BTW In may I reported the problem via very slow and awkward form www.amd.com/report, got email with questions like "please update driver/does it run successfully on any other GPUs", answered to it, and after ten days I got email with "we have sent a response to your inquiry and have had no reply from you in the last 10 days", I answered to it that in fact I replied and still have the problem, after that I got "Your Service Request has been received and will be processed shortly" and that's it (last email in 05.06.2017). Ticket number 8200754994.