Code cleanup: some reshuffling of SIMD defines moving more code to util_optimization.h.
This commit is contained in:
@@ -20,7 +20,6 @@
|
|||||||
/* CPU Kernel Interface */
|
/* CPU Kernel Interface */
|
||||||
|
|
||||||
#include "util_types.h"
|
#include "util_types.h"
|
||||||
#include "util_optimization.h"
|
|
||||||
|
|
||||||
CCL_NAMESPACE_BEGIN
|
CCL_NAMESPACE_BEGIN
|
||||||
|
|
||||||
|
@@ -18,15 +18,15 @@
|
|||||||
* optimization flags and nearly all functions inlined, while kernel.cpp
|
* optimization flags and nearly all functions inlined, while kernel.cpp
|
||||||
* is compiled without for other CPU's. */
|
* is compiled without for other CPU's. */
|
||||||
|
|
||||||
#include "util_optimization.h"
|
|
||||||
|
|
||||||
#ifdef WITH_CYCLES_OPTIMIZED_KERNEL_SSE2
|
|
||||||
|
|
||||||
/* SSE optimization disabled for now on 32 bit, see bug #36316 */
|
/* SSE optimization disabled for now on 32 bit, see bug #36316 */
|
||||||
#if !(defined(__GNUC__) && (defined(i386) || defined(_M_IX86)))
|
#if !(defined(__GNUC__) && (defined(i386) || defined(_M_IX86)))
|
||||||
#define __KERNEL_SSE2__
|
#define __KERNEL_SSE2__
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "util_optimization.h"
|
||||||
|
|
||||||
|
#ifdef WITH_CYCLES_OPTIMIZED_KERNEL_SSE2
|
||||||
|
|
||||||
#include "kernel.h"
|
#include "kernel.h"
|
||||||
#include "kernel_compat_cpu.h"
|
#include "kernel_compat_cpu.h"
|
||||||
#include "kernel_math.h"
|
#include "kernel_math.h"
|
||||||
|
@@ -18,10 +18,6 @@
|
|||||||
* optimization flags and nearly all functions inlined, while kernel.cpp
|
* optimization flags and nearly all functions inlined, while kernel.cpp
|
||||||
* is compiled without for other CPU's. */
|
* is compiled without for other CPU's. */
|
||||||
|
|
||||||
#include "util_optimization.h"
|
|
||||||
|
|
||||||
#ifdef WITH_CYCLES_OPTIMIZED_KERNEL_SSE3
|
|
||||||
|
|
||||||
/* SSE optimization disabled for now on 32 bit, see bug #36316 */
|
/* SSE optimization disabled for now on 32 bit, see bug #36316 */
|
||||||
#if !(defined(__GNUC__) && (defined(i386) || defined(_M_IX86)))
|
#if !(defined(__GNUC__) && (defined(i386) || defined(_M_IX86)))
|
||||||
#define __KERNEL_SSE2__
|
#define __KERNEL_SSE2__
|
||||||
@@ -29,6 +25,10 @@
|
|||||||
#define __KERNEL_SSSE3__
|
#define __KERNEL_SSSE3__
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "util_optimization.h"
|
||||||
|
|
||||||
|
#ifdef WITH_CYCLES_OPTIMIZED_KERNEL_SSE3
|
||||||
|
|
||||||
#include "kernel.h"
|
#include "kernel.h"
|
||||||
#include "kernel_compat_cpu.h"
|
#include "kernel_compat_cpu.h"
|
||||||
#include "kernel_math.h"
|
#include "kernel_math.h"
|
||||||
|
@@ -18,10 +18,6 @@
|
|||||||
* optimization flags and nearly all functions inlined, while kernel.cpp
|
* optimization flags and nearly all functions inlined, while kernel.cpp
|
||||||
* is compiled without for other CPU's. */
|
* is compiled without for other CPU's. */
|
||||||
|
|
||||||
#include "util_optimization.h"
|
|
||||||
|
|
||||||
#ifdef WITH_CYCLES_OPTIMIZED_KERNEL_SSE41
|
|
||||||
|
|
||||||
/* SSE optimization disabled for now on 32 bit, see bug #36316 */
|
/* SSE optimization disabled for now on 32 bit, see bug #36316 */
|
||||||
#if !(defined(__GNUC__) && (defined(i386) || defined(_M_IX86)))
|
#if !(defined(__GNUC__) && (defined(i386) || defined(_M_IX86)))
|
||||||
#define __KERNEL_SSE2__
|
#define __KERNEL_SSE2__
|
||||||
@@ -30,6 +26,10 @@
|
|||||||
#define __KERNEL_SSE41__
|
#define __KERNEL_SSE41__
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "util_optimization.h"
|
||||||
|
|
||||||
|
#ifdef WITH_CYCLES_OPTIMIZED_KERNEL_SSE41
|
||||||
|
|
||||||
#include "kernel.h"
|
#include "kernel.h"
|
||||||
#include "kernel_compat_cpu.h"
|
#include "kernel_compat_cpu.h"
|
||||||
#include "kernel_math.h"
|
#include "kernel_math.h"
|
||||||
|
@@ -14,8 +14,31 @@
|
|||||||
* limitations under the License
|
* limitations under the License
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifndef __UTIL_OPTIMIZATION_H__
|
||||||
|
#define __UTIL_OPTIMIZATION_H__
|
||||||
|
|
||||||
|
#ifndef __KERNEL_GPU__
|
||||||
|
|
||||||
|
/* x86
|
||||||
|
*
|
||||||
|
* Compile a regular, SSE2 and SSE3 kernel. */
|
||||||
|
|
||||||
|
#if defined(i386) || defined(_M_IX86)
|
||||||
|
|
||||||
|
#define WITH_CYCLES_OPTIMIZED_KERNEL_SSE2
|
||||||
|
#define WITH_CYCLES_OPTIMIZED_KERNEL_SSE3
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* x86-64
|
||||||
|
*
|
||||||
|
* Compile a regular (includes SSE2), SSE3 and SSE 4.1 kernel. */
|
||||||
|
|
||||||
#if defined(__x86_64__) || defined(_M_X64)
|
#if defined(__x86_64__) || defined(_M_X64)
|
||||||
|
|
||||||
|
/* SSE2 is always available on x86-64 CPUs, so auto enable */
|
||||||
|
#define __KERNEL_SSE2__
|
||||||
|
|
||||||
/* no SSE2 kernel on x86-64, part of regular kernel */
|
/* no SSE2 kernel on x86-64, part of regular kernel */
|
||||||
#define WITH_CYCLES_OPTIMIZED_KERNEL_SSE3
|
#define WITH_CYCLES_OPTIMIZED_KERNEL_SSE3
|
||||||
#define WITH_CYCLES_OPTIMIZED_KERNEL_SSE41
|
#define WITH_CYCLES_OPTIMIZED_KERNEL_SSE41
|
||||||
@@ -27,9 +50,60 @@
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(i386) || defined(_M_IX86)
|
/* SSE Experiment
|
||||||
|
*
|
||||||
|
* This is disabled code for an experiment to use SSE types globally for types
|
||||||
|
* such as float3 and float4. Currently this gives an overall slowdown. */
|
||||||
|
|
||||||
#define WITH_CYCLES_OPTIMIZED_KERNEL_SSE2
|
#if 0
|
||||||
#define WITH_CYCLES_OPTIMIZED_KERNEL_SSE3
|
#define __KERNEL_SSE__
|
||||||
|
#ifndef __KERNEL_SSE2__
|
||||||
|
#define __KERNEL_SSE2__
|
||||||
|
#endif
|
||||||
|
#ifndef __KERNEL_SSE3__
|
||||||
|
#define __KERNEL_SSE3__
|
||||||
|
#endif
|
||||||
|
#ifndef __KERNEL_SSSE3__
|
||||||
|
#define __KERNEL_SSSE3__
|
||||||
|
#endif
|
||||||
|
#ifndef __KERNEL_SSE4__
|
||||||
|
#define __KERNEL_SSE4__
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* SSE Intrinsics includes
|
||||||
|
*
|
||||||
|
* We assume __KERNEL_SSEX__ flags to have been defined at this point */
|
||||||
|
|
||||||
|
/* SSE intrinsics headers */
|
||||||
|
#ifndef FREE_WINDOWS64
|
||||||
|
|
||||||
|
#ifdef __KERNEL_SSE2__
|
||||||
|
#include <xmmintrin.h> /* SSE 1 */
|
||||||
|
#include <emmintrin.h> /* SSE 2 */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __KERNEL_SSE3__
|
||||||
|
#include <pmmintrin.h> /* SSE 3 */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __KERNEL_SSSE3__
|
||||||
|
#include <tmmintrin.h> /* SSSE 3 */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __KERNEL_SSE41__
|
||||||
|
#include <smmintrin.h> /* SSE 4.1 */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
/* MinGW64 has conflicting declarations for these SSE headers in <windows.h>.
|
||||||
|
* Since we can't avoid including <windows.h>, better only include that */
|
||||||
|
#include <windows.h>
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* __UTIL_OPTIMIZATION_H__ */
|
||||||
|
|
||||||
|
@@ -57,67 +57,19 @@
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* SIMD Types */
|
/* Standard Integer Types */
|
||||||
|
|
||||||
#ifndef __KERNEL_GPU__
|
#ifndef __KERNEL_GPU__
|
||||||
|
|
||||||
#define __KERNEL_SSE2__
|
|
||||||
|
|
||||||
/* not enabled, globally applying it gives slowdown, only for testing. */
|
|
||||||
#if 0
|
|
||||||
#define __KERNEL_SSE__
|
|
||||||
#ifndef __KERNEL_SSE2__
|
|
||||||
#define __KERNEL_SSE2__
|
|
||||||
#endif
|
|
||||||
#ifndef __KERNEL_SSE3__
|
|
||||||
#define __KERNEL_SSE3__
|
|
||||||
#endif
|
|
||||||
#ifndef __KERNEL_SSSE3__
|
|
||||||
#define __KERNEL_SSSE3__
|
|
||||||
#endif
|
|
||||||
#ifndef __KERNEL_SSE4__
|
|
||||||
#define __KERNEL_SSE4__
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* SSE2 is always available on x86_64 CPUs, so auto enable */
|
|
||||||
#if defined(__x86_64__) && !defined(__KERNEL_SSE2__)
|
|
||||||
#define __KERNEL_SSE2__
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* SSE intrinsics headers */
|
|
||||||
#ifndef FREE_WINDOWS64
|
|
||||||
|
|
||||||
#ifdef __KERNEL_SSE2__
|
|
||||||
#include <xmmintrin.h> /* SSE 1 */
|
|
||||||
#include <emmintrin.h> /* SSE 2 */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __KERNEL_SSE3__
|
|
||||||
#include <pmmintrin.h> /* SSE 3 */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __KERNEL_SSSE3__
|
|
||||||
#include <tmmintrin.h> /* SSSE 3 */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __KERNEL_SSE41__
|
|
||||||
#include <smmintrin.h> /* SSE 4.1 */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
/* MinGW64 has conflicting declarations for these SSE headers in <windows.h>.
|
|
||||||
* Since we can't avoid including <windows.h>, better only include that */
|
|
||||||
#include <windows.h>
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* int8_t, uint16_t, and friends */
|
/* int8_t, uint16_t, and friends */
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* SIMD Types */
|
||||||
|
|
||||||
|
#include "util_optimization.h"
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
CCL_NAMESPACE_BEGIN
|
CCL_NAMESPACE_BEGIN
|
||||||
|
Reference in New Issue
Block a user