OpenCl:Codegen阶段编译失败

问题描述 投票:0回答:1

我有一个非常简单的内核,应该对某些输入做出一点决定。输入的类型为float4,而bit_decision的类型为uchar4。在我的AMD卡上,出现编译错误:

用于保存值的数据结构类型的大小太小

错误:HSAIL程序未成功完成。

Codegen阶段编译失败。

错误:BRIG最终确定为ISA失败。

__kernel void hard_decision(__global const float4 *input,
                            __global  uchar4 *bit_decision,
                            uchar4 zero,
                            uchar4 one)
{
    bit_decision[get_global_id(0)] = select(zero, one, input[get_global_id(0)]<0);
}

知道代码有什么问题吗?

c opencl pyopencl
1个回答
0
投票

我添加了convert_uchar4(...)之后,不再出现编译错误。似乎select(a,b,condition)函数中的参数条件必须与a和b具有相同的类型。我还将条件部分的0更改为(float4)(0,0,0,0)。

__kernel void hard_decision(__global const float4 *input,
                            __global  uchar4 *bit_decision,
                            uchar4 zero,
                            uchar4 one)
{
    bit_decision[get_global_id(0)] = select(zero, one, convert_uchar4(input[get_global_id(0)]<(float4)(0,0,0,0)));
}
© www.soinside.com 2019 - 2024. All rights reserved.