Closed ilya-lavrenov closed 2 months ago
oneDNN should be buildable with C++ 20, so this looks like a bug. Relevant error message:
ccache C:\BuildTools\VC\Tools\MSVC\14.40.33807\bin\Hostx64\x64\cl.exe /nologo /TP -DCL_TARGET_OPENCL_VERSION=200 -DDNNL_DLL -DDNNL_DLL_EXPORTS -DDNNL_ENABLE_CPU_ISA_HINTS -DDNNL_ENABLE_MAX_CPU_ISA -DDNNL_X64=1 -DENABLE_ONEDNN_FOR_GPU -DIN_OV_COMPONENT -DNGEN_CPP11 -DNGEN_NEO_INTERFACE -DNGEN_NO_OP_NAMES -DNGEN_SAFE -DNGEN_WINDOWS_COMPAT -DOPENVINO_STATIC_LIBRARY -DOV_BUILD_POSTFIX=\"\" -DOV_GPU_OPENCL_HPP_HAS_UUID -DOV_GPU_USE_OPENCL_HPP -DOV_NATIVE_PARENT_PROJECT_ROOT_DIR=\"openvino\" -DOV_THREAD=OV_THREAD_TBB -DTBB_PREVIEW_WAITING_FOR_WORKERS=1 -DCMAKE_INTDIR=\"Release\" -IC:\actions-runner\_work\openvino\openvino\openvino\src\plugins\intel_gpu\include -IC:\actions-runner\_work\openvino\openvino\openvino\src\plugins\intel_gpu\src\kernel_selector -IC:\actions-runner\_work\openvino\openvino\openvino\src\plugins\intel_gpu\src\kernel_selector\kernels -IC:\actions-runner\_work\openvino\openvino\openvino_build\src\plugins\intel_gpu\src\kernel_selector\codegen\include -IC:\actions-runner\_work\openvino\openvino\openvino\src\plugins\intel_gpu\thirdparty -IC:\actions-runner\_work\openvino\openvino\openvino_build\src\plugins\intel_gpu\thirdparty\onednn_gpu_install\include -IC:\actions-runner\_work\openvino\openvino\openvino\src\plugins\intel_gpu\thirdparty\onednn_gpu\src -IC:\actions-runner\_work\openvino\openvino\openvino\thirdparty\ocl\cl_headers -IC:\actions-runner\_work\openvino\openvino\openvino\thirdparty\ocl\clhpp_headers\include -IC:\actions-runner\_work\openvino\openvino\openvino\src\core\include -IC:\actions-runner\_work\openvino\openvino\openvino\src\frontends\common\include -IC:\actions-runner\_work\openvino\openvino\openvino\src\inference\include /DWIN32 /D_WINDOWS /GR /EHsc /D_CRT_SECURE_NO_WARNINGS /D_SCL_SECURE_NO_WARNINGS /EHsc /Gy /W3 /bigobj /MP /wd4251 /wd4275 /wd4996 /wd4244 /wd4018 /O2 /Ob2 /DNDEBUG /sdl /guard:cf /wd4996 -std:c++20 -MD /Os -WX /showIncludes /Fosrc\plugins\intel_gpu\src\kernel_selector\CMakeFiles\openvino_intel_gpu_kernels.dir\Release\kernel_selector_common.cpp.obj /FdC:\actions-runner\_work\openvino\openvino\openvino\bin\intel64\Release\ /FS -c C:\actions-runner\_work\openvino\openvino\openvino\src\plugins\intel_gpu\src\kernel_selector\kernel_selector_common.cpp
C:\actions-runner\_work\openvino\openvino\openvino\src\plugins\intel_gpu\thirdparty\onednn_gpu\src\gpu/intel/jit/gemm/utils.hpp(94): error C2039: 'source_location': is not a member of 'std'
C:\actions-runner\_work\openvino\openvino\openvino\src\plugins\intel_gpu\thirdparty\onednn_gpu\src\common\primitive_hashing.hpp(138): note: see declaration of 'std'
C:\actions-runner\_work\openvino\openvino\openvino\src\plugins\intel_gpu\thirdparty\onednn_gpu\src\gpu/intel/jit/gemm/utils.hpp(93): error C3829: attribute [[noreturn]] may only be applied to a function declaration
C:\actions-runner\_work\openvino\openvino\openvino\src\plugins\intel_gpu\thirdparty\onednn_gpu\src\gpu/intel/jit/gemm/utils.hpp(93): error C2182: 'stub': this use of 'void' is not valid
C:\actions-runner\_work\openvino\openvino\openvino\src\plugins\intel_gpu\thirdparty\onednn_gpu\src\gpu/intel/jit/gemm/utils.hpp(94): error C2065: 'source_location': undeclared identifier
C:\actions-runner\_work\openvino\openvino\openvino\src\plugins\intel_gpu\thirdparty\onednn_gpu\src\gpu/intel/jit/gemm/utils.hpp(94): error C2146: syntax error: missing ')' before identifier 'where'
C:\actions-runner\_work\openvino\openvino\openvino\src\plugins\intel_gpu\thirdparty\onednn_gpu\src\gpu/intel/jit/gemm/utils.hpp(94): error C3083: 'source_location': the symbol to the left of a '::' must be a type
C:\actions-runner\_work\openvino\openvino\openvino\src\plugins\intel_gpu\thirdparty\onednn_gpu\src\gpu/intel/jit/gemm/utils.hpp(94): error C2039: 'current': is not a member of 'std'
C:\actions-runner\_work\openvino\openvino\openvino\src\plugins\intel_gpu\thirdparty\onednn_gpu\src\common\primitive_hashing.hpp(138): note: see declaration of 'std'
C:\actions-runner\_work\openvino\openvino\openvino\src\plugins\intel_gpu\thirdparty\onednn_gpu\src\gpu/intel/jit/gemm/utils.hpp(94): error C2143: syntax error: missing ';' before '{'
C:\actions-runner\_work\openvino\openvino\openvino\src\plugins\intel_gpu\thirdparty\onednn_gpu\src\gpu/intel/jit/gemm/utils.hpp(94): error C2447: '{': missing function header (old-style formal list?)
C:\actions-runner\_work\openvino\openvino\openvino\src\plugins\intel_gpu\thirdparty\onednn_gpu\src\gpu/intel/jit/gemm/utils.hpp(99): error C2039: 'source_location': is not a member of 'std'
C:\actions-runner\_work\openvino\openvino\openvino\src\plugins\intel_gpu\thirdparty\onednn_gpu\src\common\primitive_hashing.hpp(138): note: see declaration of 'std'
C:\actions-runner\_work\openvino\openvino\openvino\src\plugins\intel_gpu\thirdparty\onednn_gpu\src\gpu/intel/jit/gemm/utils.hpp(99): error C2061: syntax error: identifier 'source_location'
C:\actions-runner\_work\openvino\openvino\openvino\src\plugins\intel_gpu\thirdparty\onednn_gpu\src\gpu/intel/jit/gemm/utils.hpp(98): error C2365: 'dnnl::impl::gpu::intel::jit::stub': redefinition; previous definition was 'data variable'
C:\actions-runner\_work\openvino\openvino\openvino\src\plugins\intel_gpu\thirdparty\onednn_gpu\src\gpu/intel/jit/gemm/utils.hpp(93): note: see declaration of 'dnnl::impl::gpu::intel::jit::stub'
C:\actions-runner\_work\openvino\openvino\openvino\src\plugins\intel_gpu\thirdparty\onednn_gpu\src\gpu/intel/jit/gemm/utils.hpp(100): error C2065: 'where': undeclared identifier
C:\actions-runner\_work\openvino\openvino\openvino\src\plugins\intel_gpu\thirdparty\onednn_gpu\src\gpu/intel/jit/gemm/utils.hpp(100): error C2065: 'where': undeclared identifier
C:\actions-runner\_work\openvino\openvino\openvino\src\plugins\intel_gpu\thirdparty\onednn_gpu\src\gpu\intel\jit\gemm\gen_gemm_kernel_generator.hpp(123): error C2064: term does not evaluate to a function taking 0 arguments
+@rjoursler, @petercad
@rjoursler Looks like this line needs to take into account __cplusplus
.
@rjoursler Looks like this line needs to take into account
__cplusplus
.
No, as I stated in the description:
Problematic place https://github.com/oneapi-src/oneDNN/blob/main/src/gpu/intel/jit/gemm/include/internal/utils.hpp#L22 - __cplusplus is defined to 1997 value for MSVC compiler.
You need to rely on _MSVC_LANG for MSVC compiler instead of __cplusplus
WA on OpenVINO side is to use https://learn.microsoft.com/en-us/cpp/build/reference/zc-cplusplus?view=msvc-170, but we want to avoid it.
This should be fixed by commit ece6802e6f166ef19978205ca10dd5760eafbd3b, @ilya-lavrenov could you please confirm this issue is fully resolved?
Summary
oneDNN and some software which uses it (e.g. OpenVINO), are distributed as source code. And some users may want to compile it with their own C++ standard and compile flags.
Problem statement
oneDNN with GPU backend enabled cannot be compiled with C++ 20 with MSVC compiler. Build logs are https://github.com/openvinotoolkit/openvino/actions/runs/10289707118/job/28478073165
Problematic place https://github.com/oneapi-src/oneDNN/blob/main/src/gpu/intel/jit/gemm/include/internal/utils.hpp#L22 - __cplusplus is defined to 1997 value for MSVC compiler.
Preferred solution
Please, enable C++20 support om compilation level.