[Bf-blender-cvs] [a8b9402] master: Cycles: Tweak to the expf() speed workaround

Sergey Sharybin noreply at git.blender.org
Fri Nov 7 09:38:48 CET 2014


Commit: a8b9402c8ffdcf294929e11051bcc49e1bbc1037
Author: Sergey Sharybin
Date:   Fri Nov 7 13:35:45 2014 +0500
Branches: master
https://developer.blender.org/rBa8b9402c8ffdcf294929e11051bcc49e1bbc1037

Cycles: Tweak to the expf() speed workaround

Add compile-time check for particular glibc version which fixed the issue.
This makes it so own-compiled blender is the fastest in the world, and the
only issue remains what should we do for release builds.

After some discussion with Campbell we decided to keep it as is for now
because slowdown is not that much noticeable. We'll disable this workaround
for release builds when all the majority of the distros will switch to the
new version of glibc.

===================================================================

M	intern/cycles/kernel/kernel_compat_cpu.h

===================================================================

diff --git a/intern/cycles/kernel/kernel_compat_cpu.h b/intern/cycles/kernel/kernel_compat_cpu.h
index 37cba03..08c8bdd 100644
--- a/intern/cycles/kernel/kernel_compat_cpu.h
+++ b/intern/cycles/kernel/kernel_compat_cpu.h
@@ -25,10 +25,12 @@
 #include "util_half.h"
 #include "util_types.h"
 
-/* On 64bit linux single precision exponent is really slow comparing to the
- * double precision version, even with float<->double conversion involved.
+/* On x86_64, versions of glibc < 2.16 have an issue where expf is
+ * much slower than the double version.  This was fixed in glibc 2.16.
  */
-#if !defined(__KERNEL_GPU__) && defined(__linux__) && defined(__x86_64__)
+#if !defined(__KERNEL_GPU__)  && defined(__x86_64__) && defined(__x86_64__) && \
+     defined(__GNU_LIBRARY__) && defined(__GLIBC__ ) && defined(__GLIBC_MINOR__) && \
+     (__GLIBC__ <= 2 && __GLIBC_MINOR__ < 16)
 #  define expf(x) ((float)exp((double)(x)))
 #endif




More information about the Bf-blender-cvs mailing list