Fix cycles crash on some processors. We actually need S-SSE3 support for this
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Tue, 18 Jun 2013 16:52:02 +0000 (16:52 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Tue, 18 Jun 2013 16:52:02 +0000 (16:52 +0000)
new BVH traversal code, not just SSE3.

intern/cycles/kernel/kernel_bvh_traversal.h
intern/cycles/kernel/kernel_sse3.cpp
intern/cycles/util/util_system.cpp
intern/cycles/util/util_types.h

index 9fd466a67310f430aa4a5297caa243f7f3d9da6d..900aa7e75fb054139786dcf6e035b212295b8569 100644 (file)
@@ -80,7 +80,7 @@ __device bool BVH_FUNCTION_NAME
        isect->u = 0.0f;
        isect->v = 0.0f;
 
-#if defined(__KERNEL_SSE3__) && !FEATURE(BVH_HAIR_MINIMUM_WIDTH)
+#if defined(__KERNEL_SSSE3__) && !FEATURE(BVH_HAIR_MINIMUM_WIDTH)
        const __m128i shuffle_identity = _mm_set_epi8(15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0);
        const __m128i shuffle_swap = _mm_set_epi8(7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12, 11, 10, 9, 8);
 
@@ -111,10 +111,10 @@ __device bool BVH_FUNCTION_NAME
                        {
                                bool traverseChild0, traverseChild1;
                                int nodeAddrChild1;
-                               float t = isect->t;
 
-#if !defined(__KERNEL_SSE3__) || FEATURE(BVH_HAIR_MINIMUM_WIDTH)
+#if !defined(__KERNEL_SSSE3__) || FEATURE(BVH_HAIR_MINIMUM_WIDTH)
                                /* Intersect two child bounding boxes, non-SSE version */
+                               float t = isect->t;
 
                                /* fetch node data */
                                float4 node0 = kernel_tex_fetch(__bvh_nodes, nodeAddr*BVH_NODE_SIZE+0);
@@ -166,8 +166,8 @@ __device bool BVH_FUNCTION_NAME
                                traverseChild1 = (c1max >= c1min);
 #endif
 
-#else // __KERNEL_SSE3__
-                               /* Intersect two child bounding boxes, SSE3 version adapted from Embree */
+#else // __KERNEL_SSSE3__
+                               /* Intersect two child bounding boxes, SSSE3 version adapted from Embree */
 
                                /* fetch node data */
                                __m128 *bvh_nodes = (__m128*)kg->__bvh_nodes.data + nodeAddr*BVH_NODE_SIZE;
@@ -190,14 +190,14 @@ __device bool BVH_FUNCTION_NAME
                                traverseChild0 = (_mm_movemask_ps(lrhit) & 1);
                                traverseChild1 = (_mm_movemask_ps(lrhit) & 2);
 #endif
-#endif // __KERNEL_SSE3__
+#endif // __KERNEL_SSSE3__
 
                                nodeAddr = __float_as_int(cnodes.x);
                                nodeAddrChild1 = __float_as_int(cnodes.y);
 
                                if(traverseChild0 && traverseChild1) {
                                        /* both children were intersected, push the farther one */
-#if !defined(__KERNEL_SSE3__) || FEATURE(BVH_HAIR_MINIMUM_WIDTH)
+#if !defined(__KERNEL_SSSE3__) || FEATURE(BVH_HAIR_MINIMUM_WIDTH)
                                        bool closestChild1 = (c1min < c0min);
 #else
                                        union { __m128 m128; float v[4]; } uminmax;
@@ -282,7 +282,7 @@ __device bool BVH_FUNCTION_NAME
                                                                hit = bvh_triangle_intersect(kg, isect, P, idir, visibility, object, primAddr);
 
                                                        /* shadow ray early termination */
-#if defined(__KERNEL_SSE3__) && !FEATURE(BVH_HAIR_MINIMUM_WIDTH)
+#if defined(__KERNEL_SSSE3__) && !FEATURE(BVH_HAIR_MINIMUM_WIDTH)
                                                        if(hit) {
                                                                if(visibility == PATH_RAY_SHADOW_OPAQUE)
                                                                        return true;
@@ -315,7 +315,7 @@ __device bool BVH_FUNCTION_NAME
                                                bvh_instance_push(kg, object, ray, &P, &idir, &isect->t, tmax);
 #endif
 
-#if defined(__KERNEL_SSE3__) && !FEATURE(BVH_HAIR_MINIMUM_WIDTH)
+#if defined(__KERNEL_SSSE3__) && !FEATURE(BVH_HAIR_MINIMUM_WIDTH)
                                                Psplat[0] = _mm_set_ps1(P.x);
                                                Psplat[1] = _mm_set_ps1(P.y);
                                                Psplat[2] = _mm_set_ps1(P.z);
@@ -359,7 +359,7 @@ __device bool BVH_FUNCTION_NAME
                        bvh_instance_pop(kg, object, ray, &P, &idir, &isect->t, tmax);
 #endif
 
-#if defined(__KERNEL_SSE3__) && !FEATURE(BVH_HAIR_MINIMUM_WIDTH)
+#if defined(__KERNEL_SSSE3__) && !FEATURE(BVH_HAIR_MINIMUM_WIDTH)
                        Psplat[0] = _mm_set_ps1(P.x);
                        Psplat[1] = _mm_set_ps1(P.y);
                        Psplat[2] = _mm_set_ps1(P.z);
index ccd3ee5ac74e4c23a5bb58812115b88ba160f8e6..ff6bb412d5bd84eb1ba33731cfd479d94bfb12c0 100644 (file)
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  */
 
-/* Optimized CPU kernel entry points. This file is compiled with SSE3
+/* Optimized CPU kernel entry points. This file is compiled with SSE3/SSSE3
  * optimization flags and nearly all functions inlined, while kernel.cpp
  * is compiled without for other CPU's. */
 
 #ifdef WITH_OPTIMIZED_KERNEL
 
 #define __KERNEL_SSE3__
+#define __KERNEL_SSSE3__
 
 #include "kernel.h"
 #include "kernel_compat_cpu.h"
index c3ecc303a346d1ce77211eae29a7ca8d9eb542a2..7ba749f4287bff9948c4c3a2d60092a6fa770b16 100644 (file)
@@ -194,7 +194,7 @@ bool system_cpu_support_sse2()
 bool system_cpu_support_sse3()
 {
        CPUCapabilities& caps = system_cpu_capabilities();
-       return caps.sse && caps.sse2 && caps.sse3;
+       return caps.sse && caps.sse2 && caps.sse3 && caps.ssse3;
 }
 
 #else
index 7ad0403e6c63a1bd1be2acc1233b1ddc56933cd7..d0116186ee813580867a829f8462a653e88ea89a 100644 (file)
 #include <xmmintrin.h> /* SSE 1 */
 #include <emmintrin.h> /* SSE 2 */
 #include <pmmintrin.h> /* SSE 3 */
-#include <tmmintrin.h> /* SSE 3 */
+#include <tmmintrin.h> /* SSSE 3 */
 #include <smmintrin.h> /* SSE 4 */
 
 #ifndef __KERNEL_SSE2__
 #define __KERNEL_SSE2__
 #endif
 
-#ifndef __KERNEL_SSE3__
-#define __KERNEL_SSE3__
+#ifndef __KERNEL_SSSE3__
+#define __KERNEL_SSSE3__
+#endif
+
+#ifndef __KERNEL_SSSE3__
+#define __KERNEL_SSSE3__
 #endif
 
 #ifndef __KERNEL_SSE4__
@@ -86,7 +90,7 @@
 
 #else
 
-#if defined(__x86_64__) || defined(__KERNEL_SSE3__)
+#if defined(__x86_64__) || defined(__KERNEL_SSSE3__)
 
 /* MinGW64 has conflicting declarations for these SSE headers in <windows.h>.
  * Since we can't avoid including <windows.h>, better only include that */
 #include <xmmintrin.h> /* SSE 1 */
 #include <emmintrin.h> /* SSE 2 */
 
-#ifdef __KERNEL_SSE3__
+#ifdef __KERNEL_SSSE3__
 #include <pmmintrin.h> /* SSE 3 */
-#include <tmmintrin.h> /* SSE 3 */
+#endif
+#ifdef __KERNEL_SSSE3__
+#include <tmmintrin.h> /* SSSE 3 */
 #endif
 #endif
 
 
 #endif
 
+/* int8_t, uint16_t, and friends */
 #ifndef _WIN32
-
 #include <stdint.h>
-
 #endif
 
 #endif
@@ -486,7 +491,7 @@ __device_inline int4 make_int4(const float3& f)
 
 #endif
 
-#ifdef __KERNEL_SSE3__
+#ifdef __KERNEL_SSSE3__
 
 /* SSE shuffle utility functions */