在我的内核中,我需要一组累加器。
__kernel myKernel(...)
{
float accum[SIZE] = {};
for(i=0; i<ITER; ++i) {
accum[...] += ...
}
...
}
Run Code Online (Sandbox Code Playgroud)
在 C 中,= {}会为我初始化数组以填充 0,但我不确定 OpenCL 中是否是这种情况?我需要像下面这样的东西,还是浪费周期?
float accum[SIZE];
for(int i=0; i<SIZE; ++i) accum[i] = 0;
Run Code Online (Sandbox Code Playgroud)