[LLVMdev] [NVPTX] powf intrinsic in unimplemented
Justin Holewinski
justin.holewinski at gmail.com
Thu Sep 6 07:18:01 PDT 2012
On 09/06/2012 10:02 AM, Dmitry N. Mikushin wrote:
> Dear all,
>
> During app compilation we have a crash in NVPTX backend:
>
> LLVM ERROR: Cannot select: 0x732b270: i64 = ExternalSymbol'__powisf2' [ID=18]
>
> As I understand LLVM tries to lower the following call
>
> %28 = call ptx_device float @llvm.powi.f32(float 2.000000e+00, i32 %8)
> nounwind readonly
>
> to device intrinsic. The table llvm/IntrinsicsNVVM.td does not contain
> such intrinsic, however it should be builtin, according to
> cuda/include/math_functions.h
It actually gets lowered into an external function call.
>
> Is my understanding correct, and we need simply add the corresponding
> definition to llvm/IntrinsicsNVVM.td ? How to do that, what are the
> rules?
PTX does not have an instruction (or simple series of instructions) that
implements pow, so this will not be handled. I would prefer not to
lower such things in the back-end since different compilers may want to
implement such functions differently based on speed vs. accuracy
trade-offs.
There also is no standard libm for PTX. It is up to the higher-level
compiler to link against a run-time library that provides functions like
pow (see include/math_functions.h in a CUDA distribution).
>
> Thanks,
> - D.
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
--
Thanks,
Justin Holewinski
More information about the llvm-dev
mailing list