当我选择带有矢量化调度的 constant_exterior() 类型的边界条件时,我无法使用 Halide 生成 OpenCL 实现。
编译时,我收到以下错误:
Error:
Vector of bool not valid in OpenCL C (yet)
我不明白为什么它需要使用布尔向量..
我的函数看起来像这样:
void dummy_step()
{
Var x("x"), y("y"), c("c");
Func src("src");
Func dst("dst");
// input parameters
ImageParam image(UInt(8), 3, "inputImage");
Param<int> W;
Param<int> H;
// boundary condition
src = constant_exterior(image, 0, 0, W, 0, H);
Expr x0 = cast<int>(x + y);
Expr y0 = cast<int>(x - y);
dst(x, y, c) = cast<uint8_t>(clamp(src(x0, y0, c), 0.0f, 255.0f));
// scheduling
dst.vectorize(x, 4).gpu_tile(x, y, 16, 8).compute_root();
dst.compile_to_file("test", {image, W, H});
}
如果我删除.vectorize(x, 4)
,代码会编译。如果我使用另一个边界条件,假设src = repeat_edge(image, 0, W, 0, H);
它也有效。