Skip to content

Commit df73011

Browse files
committed
common: disabling #pragma omp simd on windows debug builds
1 parent a6a4255 commit df73011

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/common/dnnl_thread.hpp

+7-3
Original file line numberDiff line numberDiff line change
@@ -184,13 +184,17 @@ inline int dnnl_get_current_num_threads() {
184184
#define OMP_GET_NUM_THREADS() 1
185185
#endif
186186

187-
// MSVC still supports omp 2.0 only
188-
#if defined(_MSC_VER) && !defined(__clang__) && !defined(__INTEL_COMPILER)
187+
// Disabling OMP SIMD feature in the following scenarios:
188+
// * For MSVC as it only supports OpenMP 2.0
189+
// * In debug mode on Windows to avoid incorrect code generation by Intel C++/DPC++ Compiler
190+
#if defined(_MSC_VER) \
191+
&& ((!defined(__clang__) && !defined(__INTEL_COMPILER)) \
192+
|| defined(_DEBUG))
189193
#define collapse(x)
190194
#define PRAGMA_OMP_SIMD(...)
191195
#else
192196
#define PRAGMA_OMP_SIMD(...) PRAGMA_MACRO(CHAIN2(omp, simd __VA_ARGS__))
193-
#endif // defined(_MSC_VER) && !defined(__clang__) && !defined(__INTEL_COMPILER)
197+
#endif // defined(_MSC_VER) && ((!defined(__clang__) && !defined(__INTEL_COMPILER)) || defined(_DEBUG))
194198

195199
namespace dnnl {
196200
namespace impl {

0 commit comments

Comments
 (0)