forked from OSchip/llvm-project
[Polly] Fix lib/Transform/ScheduleOptimizer.cpp compilation on Solaris
lib/Transform/ScheduleOptimizer.cpp fails to compile on Solaris, both on the 9.x branch (first noticed when running test-release.sh without -no-polly) and on trunk: /var/llvm/llvm-9.0.0-rc4/rc4/llvm.src/tools/polly/lib/Transform/ScheduleOptimizer.cpp: In function ‘MicroKernelParamsTy getMicroKernelParams(const llvm::TargetTransformInfo*, polly::MatMulInfoTy)’: /var/llvm/llvm-9.0.0-rc4/rc4/llvm.src/tools/polly/lib/Transform/ScheduleOptimizer.cpp:914:62: error: call of overloaded ‘sqrt(long unsigned int)’ is ambiguous 914 | ceil(sqrt(Nvec * LatencyVectorFma * ThroughputVectorFma) / Nvec) * Nvec; | ^ In file included from /usr/gcc/9/lib/gcc/x86_64-pc-solaris2.11/9.1.0/include-fixed/math.h:24, from /usr/gcc/9/include/c++/9.1.0/cmath:45, from /var/llvm/llvm-9.0.0-rc4/rc4/llvm.src/include/llvm-c/DataTypes.h:28, from /var/llvm/llvm-9.0.0-rc4/rc4/llvm.src/include/llvm/Support/DataTypes.h:16, from /var/llvm/llvm-9.0.0-rc4/rc4/llvm.src/include/llvm/ADT/Hashing.h:47, from /var/llvm/llvm-9.0.0-rc4/rc4/llvm.src/include/llvm/ADT/ArrayRef.h:12, from /var/llvm/llvm-9.0.0-rc4/rc4/llvm.src/tools/polly/include/polly/ScheduleOptimizer.h:12, from /var/llvm/llvm-9.0.0-rc4/rc4/llvm.src/tools/polly/lib/Transform/ScheduleOptimizer.cpp:48: /usr/gcc/9/lib/gcc/x86_64-pc-solaris2.11/9.1.0/include-fixed/iso/math_iso.h:220:21: note: candidate: ‘long double std::sqrt(long double)’ 220 | inline long double sqrt(long double __X) { return __sqrtl(__X); } | ^~~~ /usr/gcc/9/lib/gcc/x86_64-pc-solaris2.11/9.1.0/include-fixed/iso/math_iso.h:186:15: note: candidate: ‘float std::sqrt(float)’ 186 | inline float sqrt(float __X) { return __sqrtf(__X); } | ^~~~ /usr/gcc/9/lib/gcc/x86_64-pc-solaris2.11/9.1.0/include-fixed/iso/math_iso.h:74:15: note: candidate: ‘double std::sqrt(double)’ 74 | extern double sqrt __P((double)); | ^~~~ /var/llvm/llvm-9.0.0-rc4/rc4/llvm.src/tools/polly/lib/Transform/ScheduleOptimizer.cpp:915:67: error: call of overloaded ‘ceil(long unsigned int)’ is ambiguous 915 | int Mr = ceil(Nvec * LatencyVectorFma * ThroughputVectorFma / Nr); | ^ In file included from /usr/gcc/9/lib/gcc/x86_64-pc-solaris2.11/9.1.0/include-fixed/math.h:24, from /usr/gcc/9/include/c++/9.1.0/cmath:45, from /var/llvm/llvm-9.0.0-rc4/rc4/llvm.src/include/llvm-c/DataTypes.h:28, from /var/llvm/llvm-9.0.0-rc4/rc4/llvm.src/include/llvm/Support/DataTypes.h:16, from /var/llvm/llvm-9.0.0-rc4/rc4/llvm.src/include/llvm/ADT/Hashing.h:47, from /var/llvm/llvm-9.0.0-rc4/rc4/llvm.src/include/llvm/ADT/ArrayRef.h:12, from /var/llvm/llvm-9.0.0-rc4/rc4/llvm.src/tools/polly/include/polly/ScheduleOptimizer.h:12, from /var/llvm/llvm-9.0.0-rc4/rc4/llvm.src/tools/polly/lib/Transform/ScheduleOptimizer.cpp:48: /usr/gcc/9/lib/gcc/x86_64-pc-solaris2.11/9.1.0/include-fixed/iso/math_iso.h:196:21: note: candidate: ‘long double std::ceil(long double)’ 196 | inline long double ceil(long double __X) { return __ceill(__X); } | ^~~~ /usr/gcc/9/lib/gcc/x86_64-pc-solaris2.11/9.1.0/include-fixed/iso/math_iso.h:160:15: note: candidate: ‘float std::ceil(float)’ 160 | inline float ceil(float __X) { return __ceilf(__X); } | ^~~~ /usr/gcc/9/lib/gcc/x86_64-pc-solaris2.11/9.1.0/include-fixed/iso/math_iso.h:76:15: note: candidate: ‘double std::ceil(double)’ 76 | extern double ceil __P((double)); | ^~~~ Fixed by adding casts to disambiguate, checked that it now compiles on both amd64-pc-solaris2.11 and sparcv9-sun-solaris2.11 and on x86_64-pc-linux-gnu. Differential Revision: https://reviews.llvm.org/D67442 llvm-svn: 371825
This commit is contained in:
parent
8a4595199a
commit
570c50aa92
|
@ -910,9 +910,10 @@ getMicroKernelParams(const TargetTransformInfo *TTI, MatMulInfoTy MMI) {
|
|||
auto Nvec = RegisterBitwidth / ElementSize;
|
||||
if (Nvec == 0)
|
||||
Nvec = 2;
|
||||
int Nr =
|
||||
ceil(sqrt(Nvec * LatencyVectorFma * ThroughputVectorFma) / Nvec) * Nvec;
|
||||
int Mr = ceil(Nvec * LatencyVectorFma * ThroughputVectorFma / Nr);
|
||||
int Nr = ceil(sqrt((double)(Nvec * LatencyVectorFma * ThroughputVectorFma)) /
|
||||
Nvec) *
|
||||
Nvec;
|
||||
int Mr = ceil((double)(Nvec * LatencyVectorFma * ThroughputVectorFma / Nr));
|
||||
return {Mr, Nr};
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue