[Bf-blender-cvs] [9311a5b] master: Cycles: Speedup BVH build for certain compilers

Sergey Sharybin noreply at git.blender.org
Mon Nov 24 14:51:37 CET 2014


Commit: 9311a5be04b66411442e4e2b99b3211a06d7e326
Author: Sergey Sharybin
Date:   Mon Nov 24 17:18:02 2014 +0500
Branches: master
https://developer.blender.org/rB9311a5be04b66411442e4e2b99b3211a06d7e326

Cycles: Speedup BVH build for certain compilers

The issue was noticed with gcc-4.7 (used by the release build environment)
which didn't generate optimal enough code for BVH references swap. Seems it
looked up for the assign operator for each of the reference structure members
even though nothing special was required for assignment.

Forcing compiler to use simple memory copy gives speedup of like 2-3 times.

The issue doesn't happen with OSX's clang and new gcc-4.9, but since we're
gonna to stick to gcc-4.7 for official releases for quite some time still it's
nice to have performance issues resolved for all the compilers.

Didn't put the code into #ifdef so if in the future some issues appears with
alignment or assignment which need to happen as an operator we notice this
earlier.

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

M	intern/cycles/bvh/bvh_params.h

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

diff --git a/intern/cycles/bvh/bvh_params.h b/intern/cycles/bvh/bvh_params.h
index e073b69..43c2d9b 100644
--- a/intern/cycles/bvh/bvh_params.h
+++ b/intern/cycles/bvh/bvh_params.h
@@ -115,6 +115,11 @@ public:
 	__forceinline int prim_object() const { return __float_as_int(rbounds.max.w); }
 	__forceinline int prim_type() const { return type; }
 
+	BVHReference& operator=(const BVHReference &arg) {
+		memcpy(this, &arg, sizeof(BVHReference));
+		return *this;
+	}
+
 protected:
 	BoundBox rbounds;
 	uint type;




More information about the Bf-blender-cvs mailing list