Skip to content

Commit f596714

Browse files
authored
common: disabling #pragma omp simd on windows debug builds (#2834)
1 parent 1adeab5 commit f596714

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/common/dnnl_thread.hpp

+8-3
Original file line numberDiff line numberDiff line change
@@ -184,13 +184,18 @@ 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
190+
// by Intel(R) oneAPI DPC++/C++ Compiler
191+
#if defined(_MSC_VER) \
192+
&& ((!defined(__clang__) && !defined(__INTEL_COMPILER)) \
193+
|| defined(_DEBUG))
189194
#define collapse(x)
190195
#define PRAGMA_OMP_SIMD(...)
191196
#else
192197
#define PRAGMA_OMP_SIMD(...) PRAGMA_MACRO(CHAIN2(omp, simd __VA_ARGS__))
193-
#endif // defined(_MSC_VER) && !defined(__clang__) && !defined(__INTEL_COMPILER)
198+
#endif // defined(_MSC_VER) && ((!defined(__clang__) && !defined(__INTEL_COMPILER)) || defined(_DEBUG))
194199

195200
namespace dnnl {
196201
namespace impl {

0 commit comments

Comments
 (0)