gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-02 10:46:55 25 4
gpt4 key购买 nike

将下面的OpenCL内核编译到我的GPU(HD Graphics 5000)时,出现“解析错误”。来自PROGRAM_BUILD_LOG。

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
}
}
}

但是,当编译到我的CPU时,它可以正常工作。同样,通过在代码示例中进行很少的更改,它将可以很好地进行编译。这里有3个例子,所有的作品。

范例1:
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
}
}
}

范例2:
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
}
}
}

范例3:
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
}
}

最佳答案

我刚刚尝试在OS X上为HD 4000编译此代码,并收到相同的错误。考虑到构建日志的性质以及相同的代码可以在其他设备上成功构建的事实,这显然是Apple的OpenCL实现的错误。以我的经验,Apple的OpenCL实现存在大量错误,通常涉及带有错误消息的编译失败。 HD图形设备似乎是造成这些故障的主要原因(这是OS X上的HD图形的第三个错误,在过去两周内发布到堆栈溢出),也许是因为它们的实现还相对不成熟。

我建议您通过Apple Bug Reporting System引发一个错误。

关于compiler-errors - OpenCL解析错误,仅在GPU设备上,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23313614/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com