我正在尝试评估 AMD 的 OpenCL 之间的性能差异。我在内核中有用于 hough 转换的内核我在运行内核时有两个 #pragma unroll 语句不会产生任何加速
kernel void hough_circle(read_only image2d_t imageIn, global int* in,const int w_hough,__global int * circle)
{
sampler_t sampler=CLK_NORMALIZED_COORDS_FALSE | CLK_ADDRESS_CLAMP_TO_EDGE | CLK_FILTER_NEAREST;
int gid0 = get_global_id(0);
int gid1 = get_global_id(1);
uint4 pixel;
int x0=0,y0=0,r;
int maxval=0;
pixel=read_imageui(imageIn,sampler,(int2)(gid0,gid1));
if(pixel.x==255)
{
#pragma unroll 20
for(int r=90;r<110;r+=1)
{
// int r=190;
#pragma unroll 360
for(int theta=0; theta<360;theta++)
{
x0=(int) round(gid0-r*cos( (float) radians( (float) theta) ));
y0=(int) round(gid1-r*sin( (float) radians( (float) theta) ));
// if((x0>0) && (x0<get_global_size(0)) && (y0>0)&&(y0<get_global_size(1)))
//in[w_hough*y0+x0]++;
}
}
}
}
#pragma unroll 对 AMD OpenCL 有帮助吗