oneDNN icon indicating copy to clipboard operation
oneDNN copied to clipboard

onednn-2.6 compiler error with Intel compiler 1.190 in Windows

Open rfg-gh opened this issue 3 years ago • 3 comments

When compiling onednn-2.6 in Windows with the intel compiler 1.190 we get the compiler error below in some of the files where mappings are defined using macros, for example in cpu_reorder_comp_f32_s8.cpp. Can you help me to find the reason? It seems that the comma before the last argument nullptr is missing after the macro expansion:

Here the compiler error:

.\onednn\onednn-2.6\src\onednn_library-ext\src\cpu\reorder\cpu_reorder_comp_f32_s8.cpp(26): error: expected a ","
      static const impl_list_map_t the_map = REG_REORDER_P({
                                             ^

Here the compiler flags we use:

cmake_object_order_depends_target_dnnl_cpu
  DEFINES = -DDNNL_ENABLE_CPU_ISA_HINTS -DDNNL_ENABLE_ITT_TASKS -DDNNL_ENABLE_MAX_CPU_ISA -DDNNL_X64=1 -DNOMINMAX -D_WIN -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS
  FLAGS = /EHsc /arch:sse2 /DWIN64  /DWIN32 /D_WINDOWS /W4 /GR /EHsc /Qwd82 /Qwd367 /Qwd504 /Qwd869 /Qwd2215 /Qwd3346 /Qwd15139 /D_CRT_SECURE_NO_WARNINGS /D_CRT_NONSTDC_NO_WARNINGS /DNO_EXTRA_HTON_FUNCTIONS -Qopenmp  /MP /bigobj -QxSSE4.1   -Qdiag-disable:13379 -Qdiag-disable:15552 -Qdiag-disable:3180 -Qdiag-disable:15009 -Qdiag-disable:11031 -Qdiag-disable:2586 /MT /O2 /Ob2 /DNDEBUG /Qopt-report:0 /Qopt-report-phase:vec /Qdiag-disable:cpu-dispatch,11074,11075,13408 /Qalign-loops=32

rfg-gh avatar Jun 14 '22 13:06 rfg-gh

Hi @rfg-gh, thank you for reporting the issue. I can reproduce it, let us look deeper in it and come back with findings. Thanks.

dzarukin avatar Jun 15 '22 16:06 dzarukin

Hi @rfg-gh, it seems to be a bug in Intel Compiler preprocessor which is triggered under certain conditions. The problem is that I can reproduce the issue with pretty latest versions of compiler, so, there are only couple quick options that I may suggest:

  1. Stop relying on Intel Compiler in favor of MSVC. If there are no restrictions on JIT code usage in your application, all highly optimized implementations should be available and most of problems should go there. Those codes are compiler-independent.
  2. Put a comma inside a line triggering the issue: DNNL_X64_ONLY(CPU_REORDER_INSTANCE(x64::jit_uni_reorder_t),) (note pre-last symbol). This may only work if the plan is to stick to Intel Compiler only.

I might be possible to write a set of macros to work around the bug and still get the desired level of support but it will take a while to do that.

Please let me know what do you think about it. Thank you.

dzarukin avatar Jun 30 '22 21:06 dzarukin

Hi dzarukin, thank you for your infos. As we have to use both compilers (Intel and Microsoft) we created a dynamic solution, which uses option 2 for the Intel Compiler case, and leaves the code as it is for the Microsoft Compiler. Thanks.

rfg-gh avatar Jul 01 '22 08:07 rfg-gh

No plans to implement workaround on oneDNN side, as the issue is fixed in current compiler versions.

vpirogov avatar Jun 28 '23 16:06 vpirogov