我有这个非常简单的opencl代码,我正在尝试交叉编译.ptx架构:
__kernel void lancementKernel
(
__global float *tabPhotons
)
{
// idx est l'indice du thread considéré
unsigned int idx = get_local_id(1) + get_local_size(1) * (get_local_id(0) + get_local_size(0) * ( get_group_id(1) + get_group_id(0) * get_num_groups(1)));
tabPhotons[idx] = tabPhotons[idx] * log(1.f-(float)idx);
};
所有这一切都是在浮点类型上调用日志函数。
我的生成脚本如下(注意我不掌握clang / llvm,所以我可能犯了错误或忘记了一些东西):
clang \
-target nvptx \
-S \
-std=CL1.1 \
test.cl -o test.ll \
-I/usr/local/include/clc/ \
-include clc/clc.h \
-Dcl_clang_storage_class_specifiers \
-fmacro-backtrace-limit=0 \
-emit-llvm
llc -march nvptx test.ll -mcpu=sm_20 -mattr=ptx30 -o test.ptx
现在我得到的是第二步(一步)的错误,基本上是说 “无法选择:0x1c8a340:i32 = ExternalSymbol'log2f'”
我的日志功能似乎是#defined,作为log2函数(cf clc / math / log.h)。
clang的--save_temps选项允许我查看一个中间.i文件,其中我看到我的日志函数已被_clc_log2调用替换。 /usr/local/include/clc/math/unary_intrin.inc文件给了我这个线索:
__attribute__((overloadable)) float __clc_log2(float f) __asm("llvm.log2" ".f32");
由此我倾向于认为没有为float类型实现llvm.log2函数。但实际上我到目前为止并没有太多其他内容。
你知道什么可能(完成)错了吗?或至少任何解决方法?
谢谢,