[PATCH] D27334: [OpenCL] Ambiguous function call.
Alexey Bader via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sun Dec 4 00:51:21 PST 2016
bader added a comment.
In https://reviews.llvm.org/D27334#611703, @Anastasia wrote:
> This change seems to modify normal C behavior again. Is there any strong motivation for doing this and if yes could it be done generically with C?
Motivation:
// Non-portable OpenCL 1.2 code
__kernel void foo(global float* out) {
out[get_global_id(0)] = sin(get_global_id(0));
}
This program compiles fine on OpenCL platform w/o doubles support and fails otherwise.
If OpenCL driver supports doubles it provides at least two versions of 'sin' built-in math function and compiler will not be able to choose the right one for 'size_t' argument.
The goal of this warning is to let OpenCL developer know about potential issues with code portability.
This might be not so serious issue for C, since C doesn't support function overloading, whereas OpenCL built-in functions library must overload most of the functions.
https://reviews.llvm.org/D27334
More information about the cfe-commits
mailing list