[Bf-blender-cvs] [888a04c7e4e] master: Build: fixes for the Intel compiler versions 2016, 2017, 2018.

Milan Jaros noreply at git.blender.org
Mon Apr 2 16:52:47 CEST 2018


Commit: 888a04c7e4e6002ac7d757fdb6d443561de696dd
Author: Milan Jaros
Date:   Mon Apr 2 16:11:11 2018 +0200
Branches: master
https://developer.blender.org/rB888a04c7e4e6002ac7d757fdb6d443561de696dd

Build: fixes for the Intel compiler versions 2016, 2017, 2018.

Differential Revision: https://developer.blender.org/D3109

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

M	CMakeLists.txt
M	build_files/cmake/macros.cmake
M	intern/cycles/CMakeLists.txt
M	intern/cycles/util/util_types_float4.h
M	intern/cycles/util/util_types_float4_impl.h
M	source/blender/blenkernel/intern/displist.c
M	source/blender/blenlib/BLI_utildefines.h

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

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 212587d6d08..566754d4883 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1496,8 +1496,8 @@ elseif(CMAKE_C_COMPILER_ID MATCHES "Intel")
 	ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_SIGN_COMPARE -Wno-sign-compare)
 
 	# disable numbered, false positives
-	set(C_WARNINGS "${C_WARNINGS} -wd188,186,144,913,556")
-	set(CXX_WARNINGS "${CXX_WARNINGS} -wd188,186,144,913,556")
+	set(C_WARNINGS "${C_WARNINGS} -wd188,186,144,913,556,858,597,177,1292,167,279,592,94,2722,3199")
+	set(CXX_WARNINGS "${CXX_WARNINGS} -wd188,186,144,913,556,858,597,177,1292,167,279,592,94,2722,3199")
 elseif(CMAKE_C_COMPILER_ID MATCHES "MSVC")
 	# most msvc warnings are C & C++
 	set(_WARNINGS
diff --git a/build_files/cmake/macros.cmake b/build_files/cmake/macros.cmake
index d159bde845d..107b29e0cc8 100644
--- a/build_files/cmake/macros.cmake
+++ b/build_files/cmake/macros.cmake
@@ -807,7 +807,7 @@ macro(TEST_SSE_SUPPORT
 		endif()
 	elseif(CMAKE_C_COMPILER_ID MATCHES "Intel")
 		set(${_sse_flags} "")  # icc defaults to -msse
-		set(${_sse2_flags} "-msse2")
+		set(${_sse2_flags} "")  # icc defaults to -msse2
 	else()
 		message(WARNING "SSE flags for this compiler: '${CMAKE_C_COMPILER_ID}' not known")
 		set(${_sse_flags})
diff --git a/intern/cycles/CMakeLists.txt b/intern/cycles/CMakeLists.txt
index 9df1e91e239..c3305ac3dd8 100644
--- a/intern/cycles/CMakeLists.txt
+++ b/intern/cycles/CMakeLists.txt
@@ -104,6 +104,54 @@ elseif(CMAKE_COMPILER_IS_GNUCC OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang"))
 	endif()
 
 	set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CYCLES_KERNEL_FLAGS}")
+elseif(WIN32 AND CMAKE_CXX_COMPILER_ID MATCHES "Intel")
+	check_cxx_compiler_flag(/QxSSE2 CXX_HAS_SSE)
+	check_cxx_compiler_flag(/arch:AVX CXX_HAS_AVX)
+	check_cxx_compiler_flag(/QxCORE-AVX2 CXX_HAS_AVX2)
+
+	if(CXX_HAS_SSE)
+		set(CYCLES_SSE2_KERNEL_FLAGS "/QxSSE2")
+		set(CYCLES_SSE3_KERNEL_FLAGS "/QxSSSE3")
+		set(CYCLES_SSE41_KERNEL_FLAGS "/QxSSE4.1")
+
+		if(CXX_HAS_AVX)
+			set(CYCLES_AVX_KERNEL_FLAGS "/arch:AVX")
+		endif()
+
+		if(CXX_HAS_AVX2)
+			set(CYCLES_AVX2_KERNEL_FLAGS "/QxCORE-AVX2")
+		endif()
+	endif()
+elseif(CMAKE_CXX_COMPILER_ID MATCHES "Intel")
+	if(APPLE)
+		# ICC does not support SSE2 flag on MacOSX
+		check_cxx_compiler_flag(-xssse3 CXX_HAS_SSE)
+	else()
+		check_cxx_compiler_flag(-xsse2 CXX_HAS_SSE)
+	endif()
+
+	check_cxx_compiler_flag(-xavx CXX_HAS_AVX)
+	check_cxx_compiler_flag(-xcore-avx2 CXX_HAS_AVX2)
+
+	if(CXX_HAS_SSE)
+		if(APPLE)
+			# ICC does not support SSE2 flag on MacOSX
+			set(CYCLES_SSE2_KERNEL_FLAGS "-xssse3")
+		else()
+			set(CYCLES_SSE2_KERNEL_FLAGS "-xsse2")
+		endif()
+
+		set(CYCLES_SSE3_KERNEL_FLAGS "-xssse3")
+		set(CYCLES_SSE41_KERNEL_FLAGS "-xsse4.1")
+
+		if(CXX_HAS_AVX)
+			set(CYCLES_AVX_KERNEL_FLAGS "-xavx")
+		endif()
+
+		if(CXX_HAS_AVX2)
+			set(CYCLES_AVX2_KERNEL_FLAGS "-xcore-avx2")
+		endif()
+	endif()
 endif()
 
 if(CXX_HAS_SSE)
diff --git a/intern/cycles/util/util_types_float4.h b/intern/cycles/util/util_types_float4.h
index a7d9abe1b95..154391f6881 100644
--- a/intern/cycles/util/util_types_float4.h
+++ b/intern/cycles/util/util_types_float4.h
@@ -34,7 +34,6 @@ struct ccl_try_align(16) float4 {
 	};
 
 	__forceinline float4();
-	__forceinline float4(const float4& a);
 	__forceinline explicit float4(const __m128& a);
 
 	__forceinline operator const __m128&(void) const;
diff --git a/intern/cycles/util/util_types_float4_impl.h b/intern/cycles/util/util_types_float4_impl.h
index ff3ec4d4ecf..09f45f47d38 100644
--- a/intern/cycles/util/util_types_float4_impl.h
+++ b/intern/cycles/util/util_types_float4_impl.h
@@ -33,11 +33,6 @@ __forceinline float4::float4()
 {
 }
 
-__forceinline float4::float4(const float4& a)
-        : m128(a.m128)
-{
-}
-
 __forceinline float4::float4(const __m128& a)
         : m128(a)
 {
diff --git a/source/blender/blenkernel/intern/displist.c b/source/blender/blenkernel/intern/displist.c
index 2a300cbe47b..8433634f749 100644
--- a/source/blender/blenkernel/intern/displist.c
+++ b/source/blender/blenkernel/intern/displist.c
@@ -297,7 +297,10 @@ bool BKE_displist_surfindex_get(DispList *dl, int a, int *b, int *p1, int *p2, i
 }
 
 /* ****************** make displists ********************* */
-
+#ifdef __INTEL_COMPILER
+/* ICC with the optimization -02 causes crashes. */
+#   pragma intel optimization_level 1
+#endif
 static void curve_to_displist(Curve *cu, ListBase *nubase, ListBase *dispbase,
                               const bool for_render, const bool use_render_resolution)
 {
diff --git a/source/blender/blenlib/BLI_utildefines.h b/source/blender/blenlib/BLI_utildefines.h
index 11c8a586784..46b3748c7ce 100644
--- a/source/blender/blenlib/BLI_utildefines.h
+++ b/source/blender/blenlib/BLI_utildefines.h
@@ -411,7 +411,7 @@ extern "C" {
 	} (void)0
 
 /* assuming a static array */
-#if defined(__GNUC__) && !defined(__cplusplus) && !defined(__clang__)
+#if defined(__GNUC__) && !defined(__cplusplus) && !defined(__clang__) && !defined(__INTEL_COMPILER)
 #  define ARRAY_SIZE(arr) \
 	((sizeof(struct {int isnt_array : ((const void *)&(arr) == &(arr)[0]);}) * 0) + \
 	 (sizeof(arr) / sizeof(*(arr))))



More information about the Bf-blender-cvs mailing list