I am trying to make CPU and GPU synchronize via HSA using a shared variable in a A10 - 7850, so I tried to modify the examples provided with the HSA driver. This is my kernel code:
#pragma OPENCL EXTENSION cl_amd_c11_atomics : enable
#define NULL 0
__kernel void consumer(global volatile atomic_int * data)
int id = get_global_id(0);
int counter = 2;
while(data == 0)
counter = (counter + 1) ;
data = counter;
The host simply sets data = 0; sleeps for 2 ms and sets data = 1.
This example works fine, but whenever I update counter with a different operation (I tested counter = (counter + 1); counter = (counter + 1)%10; counter = (counter * 3); ) it freezes for a moment and restarts the computer.
Before restarting, windows 8.1 informs of an unhandled exception (sometimes SYSTEM_THREAD_EXCEPTION_NOT_HANDLED and sometimes SYSTEM_SERVICE_EXCEPTION) in the file amdkfd.sys
Is there any restriction with the beta driver, or am I doing something wrong=
I might want to launch this kernel in the CPU, but when building the program, it does not recognize the #pragma. Is there any way to force the CPU to recognize said pragma?