llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
28.54k stars 11.8k forks source link

[CUDA] call to pow is ambiguous #26871

Closed llvmbot closed 8 years ago

llvmbot commented 8 years ago
Bugzilla Link 26497
Resolution FIXED
Resolved on Feb 05, 2016 17:18
Version trunk
OS Linux
Reporter LLVM Bugzilla Contributor
CC @DougGregor,@hfinkel,@jlebar,@Artem-B

Extended Description

Is this intended?

// pow.cu using namespace std;

global void foo(double* dd) {
dd[0] = pow(dd[1], dd[2]);
}

$ clang++ pow.cu -c

pow.cu:4:11: error: call to 'pow' is ambiguous dd[0] = pow(dd[1], dd[2]); ^~~ /usr/local/cuda/include/math_functions_dbl_ptx3.hpp:350:41: note: candidate function MATH_FUNCTIONS_DBL_PTX3_DECL double pow(double a, double b) ^ /usr/local/google/home/jingyue/Work/llvm/install-git/bin/../lib/clang/3.9.0/include/clang_cuda_cmath.h:186:19: note: candidate function DEVICE double pow(double base, double exp) { return ::pow(base, exp); } ^ /usr/local/google/home/jingyue/Work/llvm/install-git/bin/../lib/clang/3.9.0/include/clang_cuda_cmath.h:187:19: note: candidate function DEVICE double pow(double base, int iexp) { return ::powi(base, iexp); } ^ /usr/local/google/home/jingyue/Work/llvm/install-git/bin/../lib/clang/3.9.0/include/clang_cuda_cmath.h:184:18: note: candidate function DEVICE float pow(float base, float exp) { return ::powf(base, exp); } ^ /usr/local/google/home/jingyue/Work/llvm/install-git/bin/../lib/clang/3.9.0/include/clang_cuda_cmath.h:185:18: note: candidate function DEVICE float pow(float base, int iexp) { return ::powif(base, iexp); } ^ 1 error generated.

Artem-B commented 8 years ago

Should be fixed in r259944

Artem-B commented 8 years ago

No, it was not intentional. The wrapper for math functions should only define overloads for functions with signatures not yet provided by CUDA headers in global scope.

llvmbot commented 8 years ago

This is a failed test reduced from SHOC's s3d benchmark. I noticed this test failing after http://reviews.llvm.org/D16593.