cl_float2 값 배열을 상수 메모리에 복사하려고하면 Nvidia 플랫폼에서 예상대로 작동하지 않습니다. y 부분은 0 인 것 같습니다. AMD 및 Intel 플랫폼에서이 문제가 발생하지 않습니다.Nvidia 플랫폼에서 작동하지 않는 상수 메모리에 cl_float2 복사
// Host
c_Quadrature_Filter_1 = clCreateBuffer(context, CL_MEM_READ_ONLY, FILTER_SIZE * FILTER_SIZE * sizeof(cl_float2), NULL, &createBufferErrorQuadratureFilter1);
cl_float2* filter_temp = (cl_float2*)malloc(FILTER_SIZE * FILTER_SIZE * sizeof(cl_float2));
cl_float2 test;
test.s[0] = 3.0f;
test.s[1] = 13.0f;
for (int xx = 0; xx < FILTER_SIZE; xx++)
{
for (int yy = 0; yy < FILTER_SIZE; yy++)
{
filter_temp[xx + yy * FILTER_SIZE].s[0] = test.s[0];
filter_temp[xx + yy * FILTER_SIZE].s[1] = test.s[1];
}
}
clEnqueueWriteBuffer(commandQueue, c_Quadrature_Filter_1, CL_TRUE, 0, FILTER_SIZE * FILTER_SIZE * sizeof(cl_float2), filter_temp, 0, NULL, NULL);
free(filter_temp);
//Device
__kernel(__global float2* Filter_Response, __constant float2* c_Quadrature_Filter_1, __private int DATA_W, __private int DATA_H, __private int DATA_D)
{
int x = get_global_id(0);
int y = get_global_id(1);
int z = get_global_id(2);
Filter_Response[Calculate3DIndex(x,y,z,DATA_W,DATA_H)].y = c_Quadrature_Filter_1[0].y;
}
당신은'float4'를 사용하여 0으로 마지막 두 요소를 설정하려고 할 수 있습니까? 이것은 NVidia 구현의 버그 일 수 있습니다. 여기서 아무 것도 볼 수 없습니다. – Thomas
모두 괜찮아 보입니다. 커널 밖의 입력과 출력을 다시 확인하십시오. 그 중 하나 또는 드라이버 버그. – DarkZeros