Skip to content

Commit a557905

Browse files
mandronoazhai219
mandrono
authored andcommitted
[FIX] [MSVC] Enabling SIMD functionality for VS2019
1 parent 2c26f58 commit a557905

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/common/dnnl_thread.hpp

+5-2
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,11 @@ 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+
/* MSVC still supports omp 2.0 only,
188+
however VS2019 also now offers SIMD functionality
189+
with the -openmp:experimental compilation switch that enables additional OpenMP features
190+
not available when using the -openmp switch */
191+
#if defined(_MSC_VER) && (_MSC_VER < 1900) && !defined(__clang__) && !defined(__INTEL_COMPILER)
189192
#define collapse(x)
190193
#define PRAGMA_OMP_SIMD(...)
191194
#else

src/cpu/gemm/f32/ref_gemm_f32.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,10 @@ template <typename data_t>
3838
void copy_A(
3939
bool isTransA, dim_t K, const data_t *A, const dim_t lda, data_t *ws) {
4040
for (dim_t k = 0; k < K; k++) {
41+
#if !defined(_MSC_VER)
42+
// Compilation with '#pragma omp simd' in this place on VS2019 to lead to fatal error C1001
4143
PRAGMA_OMP_SIMD()
44+
#endif
4245
for (dim_t i = 0; i < unroll_factor<data_t>::m; i++) {
4346
ws[i] = isTransA ? A[i * lda + k] : A[i + k * lda];
4447
}

0 commit comments

Comments
 (0)