clBuildProgram returns CL_BUILD_PROGRAM_FAILURE,但没有发生错误

clBuildProgram returns CL_BUILD_PROGRAM_FAILURE, but no error occured

我的程序在我的机器上运行良好。用户遇到奇怪的错误,目前我不知道如何调试。

clBuildProgram returns -11 表示 CL_BUILD_PROGRAM_FAILURE.

CL_PROGRAM_BUILD_STATUS 调用 clGetProgramBuildInfo,它 returns CL_SUCCESS 并且构建状态为 CL_BUILD_SUCCESS

CL_PROGRAM_BUILD_LOG调用clGetProgramBuildInfo,它returns CL_SUCCESS 日志粘贴在下面:

Compilation started
1:817:22: warning: array index -1 is before the beginning of the array
1:315:5: note: array 'event' declared here
1:884:20: warning: array index -1 is before the beginning of the array
1:315:5: note: array 'event' declared here
1:1095:40: warning: use of logical '||' with constant operand
1:1095:40: note: use '|' for a bitwise operation
1:1095:69: warning: use of logical '||' with constant operand
1:1095:69: note: use '|' for a bitwise operation
1:1109:42: warning: use of logical '||' with constant operand
1:1109:42: note: use '|' for a bitwise operation
1:1109:69: warning: use of logical '||' with constant operand
1:1109:69: note: use '|' for a bitwise operation
1:1372:71: warning: use of logical '||' with constant operand
1:1372:71: note: use '|' for a bitwise operation
Compilation done
Linking started
Linking done
Device build started
Device build done
Kernel <sim_iterate> was not vectorized
Done.

正如构建日志所说,编译和链接已完成,没有任何错误。那么可能是什么问题?

设备是Intel(R) Core(TM) i3-3240 CPU @ 3.40GHz

我解决了这个问题。 clBuildProgram参数不正确

// Before:
clBuildProgram(program, 0, 0, "-cl-single-precision-constant -cl-denorms-are-zero -cl-fast-relaxed-math", 0, 0)
// After:
clBuildProgram(program, 1, &device, "-cl-single-precision-constant -cl-denorms-are-zero -cl-fast-relaxed-math", 0, 0)