Compiler errors OpenCL解析错误,仅在GPU设备上

Compiler errors OpenCL解析错误,仅在GPU设备上,compiler-errors,opencl,Compiler Errors,Opencl,当将下面的OpenCL内核编译到我的GPU(HD Graphics 5000)时,我从程序构建日志中得到了“解析错误” constant int cols = 946; kernel void run(global const uchar4 *curr) { int row = get_global_id(0); int col = get_global_id(1); int cell = row * cols + col; if (col > 0 &

当将下面的OpenCL内核编译到我的GPU(HD Graphics 5000)时,我从程序构建日志中得到了“解析错误”

constant int cols = 946;

kernel void run(global const uchar4 *curr) {
    int row = get_global_id(0);
    int col = get_global_id(1);

    int cell = row * cols + col;

    if (col > 0 && col < (cols - 1)) {
        if (curr[ cell ].x == 243) {
            // something
        }
    }
}

我刚刚尝试为OSX上的HD4000编译这段代码,但收到了相同的错误。鉴于构建日志的性质以及相同代码在其他设备上成功构建的事实,这显然是苹果OpenCL实现的一个缺陷。根据我的经验,苹果的OpenCL实现展示了大量的bug,通常包括编译失败和无用的错误消息。HD图形设备似乎是造成这些问题的主要原因(这是OSX上HD图形在过去两周内出现堆栈溢出的第三个错误),可能是因为它们的实现还相对不成熟


我建议您通过发出错误。

这是使用英特尔平台还是苹果系统?构建日志的完整输出是什么?英特尔编译器经常使用“^”来指出问题所在。这是在苹果系统上。还有“Parse error.”是所有的输出,因此很混乱。
constant int cols = 946;

kernel void run(global const uchar4 *curr) {
    int row = get_global_id(0);
    int col = get_global_id(1);

    if (col > 0 && col < (cols - 1)) {
        if (curr[ row * cols + col ].x == 243) {
            // something
        }
    }
}
kernel void run(global const uchar4 *curr) {
    int row = get_global_id(0);
    int col = get_global_id(1);
    int cols = 946;

    int cell = row * cols + col;

    if (col > 0 && col < (cols - 1)) {
        if (curr[ cell ].x == 243) {
            // something
        }
    }
}
constant int cols = 946;

kernel void run(global const uchar4 *curr) {
    int row = get_global_id(0);
    int col = get_global_id(1);

    int cell = row * cols + col;

    if (curr[ cell ].x == 243) {
        // something
    }
}