Repository: pytorch
Issue: oneDNN kernel fails to compile
Labels: triaged,module: mkldnn

### 🐛 Describe the bug

I am trying to compile latest PyTorch master on Arch Linux with Cuda, mkl and onednn. The process is  not sufficiently documented at all.

First I gave up on TensorRT, because pytorch does not support v8+. After that I still got errors, but I found my error in an open issue which stated to reinstall gcc-10 because of regressions. I did that and kept going forward. Now I have hit other errors. Cleaned up all build files and ccache but have hit this wall.

I have manually installed Cuda 11.8, latest cudnn 8, nccl 2.16.5. And also system packages for mkl and onednn 2023.1

There are more than 2000 lines of error but I'll provide an excerpt:

```cc
/home/psi/git/pytorch/third_party/ideep/mkl-dnn/third_party/oneDNN/src/../include/oneapi/dnnl/dnnl_types.h:3091:3: error: conflicting declaration ‘typedef enum dnnl_stream_flags_t dnnl_stream_flags_t’
 3091 | } dnnl_stream_flags_t;
      |   ^~~~~~~~~~~~~~~~~~~
In file included from /usr/include/oneapi/dnnl/dnnl_common.h:23,
                 from /usr/include/oneapi/dnnl/dnnl_common.hpp:32,
                 from /usr/include/oneapi/dnnl/dnnl_graph.hpp:20,
                 from /home/psi/git/pytorch/torch/csrc/jit/codegen/onednn/graph_helper.h:3,
                 from /home/psi/git/pytorch/torch/csrc/jit/codegen/onednn/kernel.cpp:1:
/usr/include/oneapi/dnnl/dnnl_common_types.h:165:3: note: previous declaration as ‘typedef enum dnnl_stream_flags_t dnnl_stream_flags_t’
  165 | } dnnl_stream_flags_t;
      |   ^~~~~~~~~~~~~~~~~~~
In file included from /home/psi/git/pytorch/build/third_party/ideep/mkl-dnn/third_party/oneDNN/include/oneapi/dnnl/dnnl_config.h:20,
                 from /usr/include/oneapi/dnnl/dnnl_common.h:24,
                 from /usr/include/oneapi/dnnl/dnnl_common.hpp:32,
                 from /usr/include/oneapi/dnnl/dnnl_graph.hpp:20,
                 from /home/psi/git/pytorch/torch/csrc/jit/codegen/onednn/graph_helper.h:3,
                 from /home/psi/git/pytorch/torch/csrc/jit/codegen/onednn/kernel.cpp:1:
/home/psi/git/pytorch/third_party/ideep/mkl-dnn/third_party/oneDNN/src/../include/oneapi/dnnl/dnnl_types.h:3139:3: error: conflicting declaration ‘typedef struct dnnl_version_t dnnl_version_t’
 3139 | } dnnl_version_t;
      |   ^~~~~~~~~~~~~~
In file included from /usr/include/oneapi/dnnl/dnnl_common.h:23,
                 from /usr/include/oneapi/dnnl/dnnl_common.hpp:32,
                 from /usr/include/oneapi/dnnl/dnnl_graph.hpp:20,
                 from /home/psi/git/pytorch/torch/csrc/jit/codegen/onednn/graph_helper.h:3,
                 from /home/psi/git/pytorch/torch/csrc/jit/codegen/onednn/kernel.cpp:1:
/usr/include/oneapi/dnnl/dnnl_common_types.h:213:3: note: previous declaration as ‘typedef struct dnnl_version_t dnnl_version_t’
  213 | } dnnl_version_t;
      |   ^~~~~~~~~~~~~~
/home/psi/git/pytorch/torch/csrc/jit/codegen/onednn/kernel.cpp: In constructor ‘torch::jit::fuser::onednn::LlgaKernel::LlgaKernel(const torch::jit::Node*)’:
/home/psi/git/pytorch/torch/csrc/jit/codegen/onednn/kernel.cpp:32:34: error: ‘class dnnl::graph::partition’ has no member named ‘get_in_ports’; did you mean ‘get_input_ports’?
   32 |   nPartitionInputs_ = partition_.get_in_ports().size();
      |                                  ^~~~~~~~~~~~
      |                                  get_input_ports
/home/psi/git/pytorch/torch/csrc/jit/codegen/onednn/kernel.cpp: In member function ‘void torch::jit::fuser::onednn::LlgaKernel:
:initializeConstantInputs()’:
/home/psi/git/pytorch/torch/csrc/jit/codegen/onednn/kernel.cpp:43:30: error: ‘class dnnl::graph::partition’ has no member named ‘get_in_ports’; did you mean ‘get_input_ports’?
   43 |   for (auto& lt : partition_.get_in_ports()) {
      |                              ^~~~~~~~~~~~
      |                              get_input_ports
In file included from /home/psi/git/pytorch/c10/util/Exception.h:4,
                 from /home/psi/git/pytorch/aten/src/ATen/core/Generator.h:11,
                 from /home/psi/git/pytorch/aten/src/ATen/CPUGeneratorImpl.h:3,
                 from /home/psi/git/pytorch/aten/src/ATen/Context.h:3,
                 from /home/psi/git/pytorch/aten/src/ATen/ATen.h:7,
                 from /home/psi/git/pytorch/torch/csrc/jit/codegen/onednn/LlgaTensorImpl.h:3,
                 from /home/psi/git/pytorch/torch/csrc/jit/codegen/onednn/operator.h:4,
                 from /home/psi/git/pytorch/torch/csrc/jit/codegen/onednn/graph_helper.h:4,
                 from /home/psi/git/pytorch/torch/csrc/jit/codegen/onednn/kernel.cpp:1:
/home/psi/git/pytorch/torch/csrc/jit/codegen/onednn/kernel.cpp:55:45: error: expected primary-expression before ‘>’ token
   55 |               value->type()->cast<TensorType>(),
      |                                             ^
/home/psi/git/pytorch/c10/macros/Macros.h:200:64: note: in definition of macro ‘C10_UNLIKELY’
  200 | #define C10_UNLIKELY(expr) (__builtin_expect(static_cast<bool>(expr), 0))
      |                                                                ^~~~
/home/psi/git/pytorch/c10/util/Exception.h:503:7: note: in expansion of macro ‘C10_UNLIKELY_OR_CONST’
  503 |   if (C10_UNLIKELY_OR_CONST(!(cond))) {            \
      |       ^~~~~~~~~~~~~~~~~~~~~
/home/psi/git/pytorch/torch/csrc/jit/codegen/onednn/kernel.cpp:53:7: note: in expansion of macro ‘TORCH_CHECK’
   53 |       TORCH_CHECK(
      |       ^~~~~~~~~~~
/home/psi/git/pytorch/torch/csrc/jit/codegen/onednn/kernel.cpp:55:47: error: expected primary-expression before ‘)’ token
   55 |               value->type()->cast<TensorType>(),
      |                                               ^
/home/psi/git/pytorch/c10/macros/Macros.h:200:64: note: in definition of macro ‘C10_UNLIKELY’
  200 | #define C10_UNLIKELY(expr) (__builtin_expect(static_cast<bool>(expr), 0))
      |                                                                ^~~~
/home/psi/git/pytorch/c10/util/Exception.h:503:7: note: in expansion of macro ‘C10_UNLIKELY_OR_CONST’
  503 |   if (C10_UNLIKELY_OR_CONST(!(cond))) {            \
      |       ^~~~~~~~~~~~~~~~~~~~~
/home/psi/git/pytorch/torch/csrc/jit/codegen/onednn/kernel.cpp:53:7: note: in expansion of macro ‘TORCH_CHECK’
   53 |       TORCH_CHECK(
      |       ^~~~~~~~~~~
/home/psi/git/pytorch/torch/csrc/jit/codegen/onednn/kernel.cpp: In member function ‘std::map<long unsigned int, long int> torch::jit::fuser::onednn::LlgaKernel::initializeTensorIdToOccurence() const’:
/home/psi/git/pytorch/torch/csrc/jit/codegen/onednn/kernel.cpp:69:30: error: ‘const class dnnl::graph::partition’ has no member named ‘get_in_ports’; did you mean ‘get_input_ports’?
   69 |   for (auto& lt : partition_.get_in_ports()) {
      |                              ^~~~~~~~~~~~
      |                              get_input_ports
At global scope:
cc1plus: note: unrecognized command-line option ‘-Wno-aligned-allocation-unavailable’ may have been intended to silence earlier diagnostics
cc1plus: note: unrecognized command-line option ‘-Wno-unused-private-field’ may have been intended to silence earlier diagnostics
cc1plus: note: unrecognized command-line option ‘-Wno-invalid-partial-specialization’ may have been intended to silence earlier diagnostics
[5461/7068] Building CXX object caffe2/CMakeFiles/torch_cpu.dir/__/aten/src/ATen/native/cpu/Activation.cpp.DEFAULT.cpp.o^C
ninja: build stopped: interrupted by user.

```


<details>
  <summary>Cmake config:</summary>

```
/usr/bin/g++-10 /home/psi/git/pytorch/torch/abi-check.cpp -o /home/psi/git/pytorch/build/abi-check
Determined _GLIBCXX_USE_CXX11_ABI=1
Current compiler supports avx2 extension. Will build perfkernels.
Current compiler supports avx512f extension. Will build fbgemm.
Found CUDAToolkit: /opt/cuda/include (found version "11.8.89") 
Caffe2: CUDA detected: 11.8
Caffe2: CUDA nvcc is: /opt/cuda/bin/nvcc
Caffe2: CUDA toolkit directory: /opt/cuda
Caffe2: Header version is: 11.8
/opt/cuda/lib64/libnvrtc.so shorthash is 672ee683
Autodetected CUDA architecture(s):  6.1 5.2
Added CUDA NVCC flags for: -gencode;arch=compute_61,code=sm_61;-gencode;arch=compute_52,code=sm_52
Building using own protobuf under third_party per request.
Use custom protobuf build.

3.13.0.0
Caffe2 protobuf include directory: $<BUILD_INTERFACE:/home/psi/git/pytorch/third_party/protobuf/src>$<INSTALL_INTERFACE:include>
Trying to find preferred BLAS backend of choice: MKL
MKL_THREADING = OMP
CMake Warning (dev) at /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:438 (message):
  The package name passed to `find_package_handle_standard_args` (OpenMP_C)
  does not match the name of the calling package (OpenMP).  This can lead to
  problems in calling code that expects `find_package` result variables
  (e.g., `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
  cmake/Modules/FindOpenMP.cmake:584 (find_package_handle_standard_args)
  cmake/Modules/FindMKL.cmake:239 (FIND_PACKAGE)
  cmake/Modules/FindMKL.cmake:334 (CHECK_ALL_LIBRARIES)
  cmake/Dependencies.cmake:196 (find_package)
  CMakeLists.txt:705 (include)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:438 (message):
  The package name passed to `find_package_handle_standard_args` (OpenMP_CXX)
  does not match the name of the calling package (OpenMP).  This can lead to
  problems in calling code that expects `find_package` result variables
  (e.g., `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
  cmake/Modules/FindOpenMP.cmake:584 (find_package_handle_standard_args)
  cmake/Modules/FindMKL.cmake:239 (FIND_PACKAGE)
  cmake/Modules/FindMKL.cmake:334 (CHECK_ALL_LIBRARIES)
  cmake/Dependencies.cmake:196 (find_package)
  CMakeLists.txt:705 (include)
This warning is for project developers.  Use -Wno-dev to suppress it.

MKL libraries: /opt/intel/oneapi/mkl/latest/lib/intel64/libmkl_intel_lp64.so;/opt/intel/oneapi/mkl/latest/lib/intel64/libmkl_gnu_thread.so;/opt/intel/oneapi/mkl/latest/lib/intel64/libmkl_core.so;-fopenmp;/usr/lib/libpthread.a;/usr/lib/libm.so;/usr/lib/libdl.a
MKL include directory: /opt/intel/oneapi/mkl/latest/include
MKL OpenMP type: GNU
MKL OpenMP library: -fopenmp
Brace yourself, we are building NNPACK
NNPACK backend is x86-64
LLVM FileCheck Found: /usr/bin/FileCheck
git version: v1.6.1 normalized to 1.6.1
Version: 1.6.1
Performing Test HAVE_STD_REGEX -- success
Performing Test HAVE_GNU_POSIX_REGEX -- failed to compile
Performing Test HAVE_POSIX_REGEX -- success
Performing Test HAVE_STEADY_CLOCK -- success
CMake Warning (dev) at /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:438 (message):
  The package name passed to `find_package_handle_standard_args` (OpenMP_C)
  does not match the name of the calling package (OpenMP).  This can lead to
  problems in calling code that expects `find_package` result variables
  (e.g., `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
  cmake/Modules/FindOpenMP.cmake:584 (find_package_handle_standard_args)
  third_party/fbgemm/CMakeLists.txt:129 (find_package)
This warning is for project developers.  Use -Wno-dev to suppress it.

Found OpenMP_C: -fopenmp  
CMake Warning (dev) at /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:438 (message):
  The package name passed to `find_package_handle_standard_args` (OpenMP_CXX)
  does not match the name of the calling package (OpenMP).  This can lead to
  problems in calling code that expects `find_package` result variables
  (e.g., `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
  cmake/Modules/FindOpenMP.cmake:584 (find_package_handle_standard_args)
  third_party/fbgemm/CMakeLists.txt:129 (find_package)
This warning is for project developers.  Use -Wno-dev to suppress it.

Found OpenMP_CXX: -fopenmp  
Found OpenMP: TRUE   
CMake Warning at third_party/fbgemm/CMakeLists.txt:131 (message):
  OpenMP found! OpenMP_C_INCLUDE_DIRS =


CMake Warning at third_party/fbgemm/CMakeLists.txt:224 (message):
  ==========


CMake Warning at third_party/fbgemm/CMakeLists.txt:225 (message):
  CMAKE_BUILD_TYPE = Release


CMake Warning at third_party/fbgemm/CMakeLists.txt:226 (message):
  CMAKE_CXX_FLAGS_DEBUG is -g


CMake Warning at third_party/fbgemm/CMakeLists.txt:227 (message):
  CMAKE_CXX_FLAGS_RELEASE is -O3 -DNDEBUG


CMake Warning at third_party/fbgemm/CMakeLists.txt:228 (message):
  ==========


** AsmJit Summary **
   ASMJIT_DIR=/home/psi/git/pytorch/third_party/fbgemm/third_party/asmjit
   ASMJIT_TEST=OFF
   ASMJIT_TARGET_TYPE=STATIC
   ASMJIT_DEPS=pthread;rt
   ASMJIT_LIBS=asmjit;pthread;rt
   ASMJIT_CFLAGS=-DASMJIT_STATIC
   ASMJIT_PRIVATE_CFLAGS=-Wall;-Wextra;-Wconversion;-fno-math-errno;-fno-threadsafe-statics;-fno-semantic-interposition;-DASMJIT_STATIC
   ASMJIT_PRIVATE_CFLAGS_DBG=
   ASMJIT_PRIVATE_CFLAGS_REL=-O2;-fmerge-all-constants;-fno-enforce-eh-specs
INFOUSING OPENCL
Found Numa  (include: /usr/include, library: /usr/lib/libnuma.so)
OpenCV found (/usr/lib/cmake/opencv4)
Found FFMPEG or Libav: /usr/lib/libavcodec.so;/usr/lib/libavformat.so;/usr/lib/libavutil.so;/usr/lib/libswscale.so;/usr/lib/libswresample.so, /usr/include
Found FFMPEG/LibAV libraries
Using third party subdirectory Eigen.
Found PythonInterp: /home/psi/.conda/envs/ai/bin/python (found suitable version "3.8.16", minimum required is "3.0") 
NumPy ver. 1.23.0 found (include: /home/psi/.conda/envs/ai/lib/python3.8/site-packages/numpy/core/include)
Using third_party/pybind11.
pybind11 include dirs: /home/psi/git/pytorch/cmake/../third_party/pybind11/include
MPI support found
MPI compile flags: 
MPI include path: /usr/include
MPI LINK flags path: -Wl,-rpath -Wl,/usr/lib -Wl,--enable-new-dtags
MPI libraries: /usr/lib/libmpi_cxx.so/usr/lib/libmpi.so
Found OpenMPI with CUDA support built.
Adding OpenMP CXX_FLAGS: -fopenmp
Will link against OpenMP libraries: /usr/lib/gcc/x86_64-pc-linux-gnu/10.3.0/libgomp.so;/usr/lib/libpthread.a
Autodetected CUDA architecture(s):  6.1 5.2
CMake Warning at cmake/External/nccl.cmake:69 (message):
  Enabling NCCL library slimming
Call Stack (most recent call first):
  cmake/Dependencies.cmake:1345 (include)
  CMakeLists.txt:705 (include)


Converting CMAKE_CUDA_FLAGS to CUDA_NVCC_FLAGS:
    CUDA_NVCC_FLAGS                = -Xfatbin;-compress-all;-DONNX_NAMESPACE=onnx_torch;-gencode;arch=compute_61,code=sm_61;-gencode;arch=compute_52,code=sm_52;-Xcudafe;--diag_suppress=cc_clobber_ignored,--diag_suppress=set_but_not_used,--diag_suppress=field_without_dll_interface,--diag_suppress=base_class_has_different_dll_interface,--diag_suppress=dll_interface_conflict_none_assumed,--diag_suppress=dll_interface_conflict_dllexport_assumed,--diag_suppress=bad_friend_decl;--expt-relaxed-constexpr;--expt-extended-lambda
    CUDA_NVCC_FLAGS_DEBUG          = -g
    CUDA_NVCC_FLAGS_RELEASE        = -O3;-DNDEBUG
    CUDA_NVCC_FLAGS_RELWITHDEBINFO = -O2;-g;-DNDEBUG
    CUDA_NVCC_FLAGS_MINSIZEREL     = -O1;-DNDEBUG
summary of build options:
    Install prefix:  /home/psi/git/pytorch/torch
    Target system:   Linux
    Compiler:
      C compiler:    /usr/bin/gcc-10
      CFLAGS:         

Gloo build as SHARED library
MPI include path: /usr/include
MPI libraries: /usr/lib/libmpi_cxx.so/usr/lib/libmpi.so
CMake Warning (dev) at third_party/gloo/cmake/Cuda.cmake:109 (find_package):
  Policy CMP0074 is not set: find_package uses <PackageName>_ROOT variables.
  Run "cmake --help-policy CMP0074" for policy details.  Use the cmake_policy
  command to set the policy and suppress this warning.

  CMake variable CUDAToolkit_ROOT is set to:

    /opt/cuda

  For compatibility, CMake is ignoring the variable.
Call Stack (most recent call first):
  third_party/gloo/cmake/Dependencies.cmake:115 (include)
  third_party/gloo/CMakeLists.txt:111 (include)
This warning is for project developers.  Use -Wno-dev to suppress it.

Found CUDAToolkit: /opt/cuda/include (found suitable version "11.8.89", minimum required is "7.0") 
CUDA detected: 11.8.89
CMake Deprecation Warning at third_party/zstd/build/cmake/CMakeLists.txt:11 (CMAKE_MINIMUM_REQUIRED):
  Compatibility with CMake < 2.8.12 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.


ZSTD_LEGACY_SUPPORT not defined!
ZSTD VERSION 1.3.2
Found PythonInterp: /home/psi/.conda/envs/ai/bin/python (found version "3.8.16") 
Generated: /home/psi/git/pytorch/build/third_party/onnx/onnx/onnx_onnx_torch-ml.proto
Generated: /home/psi/git/pytorch/build/third_party/onnx/onnx/onnx-operators_onnx_torch-ml.proto
Generated: /home/psi/git/pytorch/build/third_party/onnx/onnx/onnx-data_onnx_torch.proto

******** Summary ********
  CMake version             : 3.26.4
  CMake command             : /usr/bin/cmake
  System                    : Linux
  C++ compiler              : /usr/bin/g++-10
  C++ compiler version      : 10.3.0
  CXX flags                 :  -D_GLIBCXX_USE_CXX11_ABI=1 -fvisibility-inlines-hidden -DUSE_PTHREADPOOL -Wnon-virtual-dtor
  Build type                : Release
  Compile definitions       : ONNX_ML=1;ONNXIFI_ENABLE_EXT=1;__STDC_FORMAT_MACROS
  CMAKE_PREFIX_PATH         : /opt/cuda
  CMAKE_INSTALL_PREFIX      : /home/psi/git/pytorch/torch
  CMAKE_MODULE_PATH         : /home/psi/git/pytorch/cmake/Modules;/home/psi/git/pytorch/cmake/public/../Modules_CUDA_fix

  ONNX version              : 1.14.0
  ONNX NAMESPACE            : onnx_torch
  ONNX_USE_LITE_PROTO       : OFF
  USE_PROTOBUF_SHARED_LIBS  : OFF
  Protobuf_USE_STATIC_LIBS  : ON
  ONNX_DISABLE_EXCEPTIONS   : OFF
  ONNX_WERROR               : OFF
  ONNX_BUILD_TESTS          : OFF
  ONNX_BUILD_BENCHMARKS     : OFF

  Protobuf compiler         : 
  Protobuf includes         : 
  Protobuf libraries        : 
  BUILD_ONNX_PYTHON         : OFF

******** Summary ********
  CMake version         : 3.26.4
  CMake command         : /usr/bin/cmake
  System                : Linux
  C++ compiler          : /usr/bin/g++-10
  C++ compiler version  : 10.3.0
  CXX flags             :  -D_GLIBCXX_USE_CXX11_ABI=1 -fvisibility-inlines-hidden -DUSE_PTHREADPOOL -Wnon-virtual-dtor
  Build type            : Release
  Compile definitions   : ONNX_ML=1;ONNXIFI_ENABLE_EXT=1
  CMAKE_PREFIX_PATH     : /opt/cuda
  CMAKE_INSTALL_PREFIX  : /home/psi/git/pytorch/torch
  CMAKE_MODULE_PATH     : /home/psi/git/pytorch/cmake/Modules;/home/psi/git/pytorch/cmake/public/../Modules_CUDA_fix

  ONNX version          : 1.4.1
  ONNX NAMESPACE        : onnx_torch
  ONNX_BUILD_TESTS      : OFF
  ONNX_BUILD_BENCHMARKS : OFF
  ONNX_USE_LITE_PROTO   : OFF
  ONNXIFI_DUMMY_BACKEND : 

  Protobuf compiler     : 
  Protobuf includes     : 
  Protobuf libraries    : 
  BUILD_ONNX_PYTHON     : OFF
Found CUDA with FP16 support, compiling with torch.cuda.HalfTensor
Adding -DNDEBUG to compile flags
Compiling with MAGMA support
MAGMA INCLUDE DIRECTORIES: /usr/include
MAGMA LIBRARIES: /usr/lib/libmagma.so
MAGMA V2 check: 0
Could not find hardware support for NEON on this machine.
No OMAP3 processor on this machine.
No OMAP4 processor on this machine.
Found a library with LAPACK API (mkl).
disabling ROCM because NOT USE_ROCM is set
MIOpen not found. Compiling without MIOpen support
-- Will build oneDNN Graph
MKLDNN_CPU_RUNTIME = OMP
cmake version: 3.26.4
CMake Deprecation Warning at third_party/ideep/mkl-dnn/CMakeLists.txt:36 (cmake_policy):
  The OLD behavior for policy CMP0025 will be removed from a future version
  of CMake.

  The cmake-policies(7) manual explains that the OLD behaviors of all
  policies are deprecated and that a policy should be set to OLD only under
  specific short-term circumstances.  Projects should be ported to the NEW
  behavior and not rely on setting a policy to OLD.


DNNL_TARGET_ARCH: X64
DNNL_LIBRARY_NAME: dnnl
CMake Warning (dev) at /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:438 (message):
  The package name passed to `find_package_handle_standard_args` (OpenMP_C)
  does not match the name of the calling package (OpenMP).  This can lead to
  problems in calling code that expects `find_package` result variables
  (e.g., `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
  cmake/Modules/FindOpenMP.cmake:584 (find_package_handle_standard_args)
  third_party/ideep/mkl-dnn/third_party/oneDNN/cmake/OpenMP.cmake:69 (find_package)
  third_party/ideep/mkl-dnn/third_party/oneDNN/CMakeLists.txt:117 (include)
This warning is for project developers.  Use -Wno-dev to suppress it.

Found OpenMP_C: -fopenmp  
CMake Warning (dev) at /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:438 (message):
  The package name passed to `find_package_handle_standard_args` (OpenMP_CXX)
  does not match the name of the calling package (OpenMP).  This can lead to
  problems in calling code that expects `find_package` result variables
  (e.g., `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
  cmake/Modules/FindOpenMP.cmake:584 (find_package_handle_standard_args)
  third_party/ideep/mkl-dnn/third_party/oneDNN/cmake/OpenMP.cmake:69 (find_package)
  third_party/ideep/mkl-dnn/third_party/oneDNN/CMakeLists.txt:117 (include)
This warning is for project developers.  Use -Wno-dev to suppress it.

Found OpenMP_CXX: -fopenmp  
Could NOT find Doxyrest (missing: DOXYREST_EXECUTABLE) 
Found PythonInterp: /home/psi/.conda/envs/ai/bin/python (found suitable version "3.8.16", minimum required is "2.7") 
Could NOT find Sphinx (missing: SPHINX_EXECUTABLE) 
Enabled workload: TRAINING
Enabled primitives: ALL
Enabled primitive CPU ISA: ALL
Enabled primitive GPU ISA: ALL
Primitive cache is enabled
CMake Warning (dev) at /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:438 (message):
  The package name passed to `find_package_handle_standard_args` (OpenMP_C)
  does not match the name of the calling package (OpenMP).  This can lead to
  problems in calling code that expects `find_package` result variables
  (e.g., `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
  cmake/Modules/FindOpenMP.cmake:584 (find_package_handle_standard_args)
  third_party/ideep/mkl-dnn/cmake/OpenMP.cmake:62 (find_package)
  third_party/ideep/mkl-dnn/CMakeLists.txt:179 (include)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:438 (message):
  The package name passed to `find_package_handle_standard_args` (OpenMP_CXX)
  does not match the name of the calling package (OpenMP).  This can lead to
  problems in calling code that expects `find_package` result variables
  (e.g., `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
  cmake/Modules/FindOpenMP.cmake:584 (find_package_handle_standard_args)
  third_party/ideep/mkl-dnn/cmake/OpenMP.cmake:62 (find_package)
  third_party/ideep/mkl-dnn/CMakeLists.txt:179 (include)
This warning is for project developers.  Use -Wno-dev to suppress it.

DNNL_GRAPH_BUILD_FOR_CI is set to be OFF
Compiling oneDNN Graph with CPU runtime OMP support
Compiling oneDNN Graph with GPU runtime NONE support
Graph compiler backend is disabled.
Set version definitions to /home/psi/git/pytorch/third_party/ideep/mkl-dnn/src/utils/verbose.cpp
Compiled partition cache is enabled
Found MKL-DNN: TRUE
-- <FindZVECTOR>
-- check z16
-- check z15
-- check z14
-- </FindZVECTOR>
Module support is disabled.
Version: 9.1.0
Build type: Release
CXX_STANDARD: 17
Required features: cxx_variadic_templates
Using Kineto with CUPTI support
Configuring Kineto dependency:
  KINETO_SOURCE_DIR = /home/psi/git/pytorch/third_party/kineto/libkineto
  KINETO_BUILD_TESTS = OFF
  KINETO_LIBRARY_TYPE = static
  CUDA_SOURCE_DIR = /opt/cuda
  CUDA_INCLUDE_DIRS = /opt/cuda/include
  CUPTI_INCLUDE_DIR = /opt/cuda/extras/CUPTI/include
  CUDA_cupti_LIBRARY = /opt/cuda/extras/CUPTI/lib64/libcupti.so
Found CUPTI
Found PythonInterp: /home/psi/.conda/envs/ai/bin/python (found version "3.8.16") 
INFO ROCM_SOURCE_DIR = 
Kineto: FMT_SOURCE_DIR = /home/psi/git/pytorch/third_party/fmt
Kineto: FMT_INCLUDE_DIR = /home/psi/git/pytorch/third_party/fmt/include
INFO CUPTI_INCLUDE_DIR = /opt/cuda/extras/CUPTI/include
INFO ROCTRACER_INCLUDE_DIR = /include/roctracer
INFO DYNOLOG_INCLUDE_DIR = /home/psi/git/pytorch/third_party/kineto/libkineto/third_party/dynolog/
INFO IPCFABRIC_INCLUDE_DIR = /home/psi/git/pytorch/third_party/kineto/libkineto/third_party/dynolog//dynolog/src/ipcfabric/
Configured Kineto
GCC 10.3.0: Adding gcc and gcc_s libs to link line
NUMA paths:
/usr/include
/usr/lib/libnuma.so
headers outputs: 
sources outputs: 
declarations_yaml outputs: 
Using ATen parallel backend: OMP
CMake Deprecation Warning at third_party/sleef/CMakeLists.txt:91 (cmake_policy):
  The OLD behavior for policy CMP0066 will be removed from a future version
  of CMake.

  The cmake-policies(7) manual explains that the OLD behaviors of all
  policies are deprecated and that a policy should be set to OLD only under
  specific short-term circumstances.  Projects should be ported to the NEW
  behavior and not rely on setting a policy to OLD.


Found OpenMP_C: -fopenmp (found version "4.5") 
Found OpenMP_CXX: -fopenmp (found version "4.5") 
Found OpenMP: TRUE (found version "4.5")  
Configuring build for SLEEF-v3.6.0
   Target system: Linux-6.3.5-zen1-1-zen
   Target processor: x86_64
   Host system: Linux-6.3.5-zen1-1-zen
   Host processor: x86_64
   Detected C compiler: GNU @ /usr/bin/gcc-10
   CMake: 3.26.4
   Make program: /usr/bin/ninja
Using option `-Wall -Wno-unused -Wno-attributes -Wno-unused-result -Wno-psabi -ffp-contract=off -fno-math-errno -fno-trapping-math` to compile libsleef
Building shared libs : OFF
Building static test bins: OFF
MPFR : /usr/lib/libmpfr.so
MPFR header file in /usr/include
GMP : /usr/lib/libgmp.so
RT : /usr/lib/librt.a
FFTW3 : /usr/lib/libfftw3.so
OPENSSL : 1.1.1t
SDE : SDE_COMMAND-NOTFOUND
RUNNING_ON_TRAVIS : 
COMPILER_SUPPORTS_OPENMP : 1
AT_INSTALL_INCLUDE_DIR include/ATen/core
core header install: /home/psi/git/pytorch/build/aten/src/ATen/core/TensorBody.h
core header install: /home/psi/git/pytorch/build/aten/src/ATen/core/aten_interned_strings.h
core header install: /home/psi/git/pytorch/build/aten/src/ATen/core/enum_tag.h
Generating sources for unboxing kernels /home/psi/.conda/envs/ai/bin/python;-m;torchgen.gen_executorch;--source-path=/home/psi/git/pytorch/test/edge/../../test/edge;--install-dir=/home/psi/git/pytorch/build/out;--tags-path=/home/psi/git/pytorch/test/edge/../../aten/src/ATen/native/tags.yaml;--aten-yaml-path=/home/psi/git/pytorch/test/edge/../../aten/src/ATen/native/native_functions.yaml;--use-aten-lib;--op-selection-yaml-path=/home/psi/git/pytorch/test/edge/../../test/edge/selected_operators.yaml;--custom-ops-yaml-path=/home/psi/git/pytorch/test/edge/../../test/edge/custom_ops.yaml
_GLIBCXX_USE_CXX11_ABI=1 is already defined as a cmake variable
CMake Warning (dev) at torch/CMakeLists.txt:379:
  Syntax Warning in cmake code at column 107

  Argument not separated from preceding token by whitespace.
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at torch/CMakeLists.txt:379:
  Syntax Warning in cmake code at column 115

  Argument not separated from preceding token by whitespace.
This warning is for project developers.  Use -Wno-dev to suppress it.

Autodetected CUDA architecture(s):  6.1 5.2
Using lib/python3.8/site-packages as python relative installation path
CMake Warning at CMakeLists.txt:1081 (message):
  Generated cmake files are only fully tested if one builds with system glog,
  gflags, and protobuf.  Other settings may generate files that are not well
  tested.



******** Summary ********
General:
  CMake version         : 3.26.4
  CMake command         : /usr/bin/cmake
  System                : Linux
  C++ compiler          : /usr/bin/g++-10
  C++ compiler id       : GNU
  C++ compiler version  : 10.3.0
  Using ccache if found : ON
  Found ccache          : /usr/bin/ccache
  CXX flags             :  -D_GLIBCXX_USE_CXX11_ABI=1 -fvisibility-inlines-hidden -DUSE_PTHREADPOOL -DNDEBUG -DUSE_KINETO -DLIBKINETO_NOROCTRACER -DUSE_FBGEMM -DUSE_QNNPACK -DUSE_PYTORCH_QNNPACK -DUSE_XNNPACK -DSYMBOLICATE_MOBILE_DEBUG_HANDLE -O2 -fPIC -Wall -Wextra -Werror=return-type -Werror=non-virtual-dtor -Werror=bool-operation -Wnarrowing -Wno-missing-field-initializers -Wno-type-limits -Wno-array-bounds -Wno-unknown-pragmas -Wno-unused-parameter -Wno-unused-function -Wno-unused-result -Wno-strict-overflow -Wno-strict-aliasing -Wno-stringop-overflow -Wno-psabi -Wno-error=pedantic -Wno-error=old-style-cast -Wno-invalid-partial-specialization -Wno-unused-private-field -Wno-aligned-allocation-unavailable -Wno-missing-braces -fdiagnostics-color=always -faligned-new -Wno-unused-but-set-variable -Wno-maybe-uninitialized -fno-math-errno -fno-trapping-math -Werror=format -Werror=cast-function-type -Wno-stringop-overflow
  Build type            : Release
  Compile definitions   : ONNX_ML=1;ONNXIFI_ENABLE_EXT=1;ONNX_NAMESPACE=onnx_torch;IDEEP_USE_MKL;HAVE_MMAP=1;_FILE_OFFSET_BITS=64;HAVE_SHM_OPEN=1;HAVE_SHM_UNLINK=1;HAVE_MALLOC_USABLE_SIZE=1;USE_EXTERNAL_MZCRC;MINIZ_DISABLE_ZIP_READER_CRC32_CHECKS;BUILD_NVFUSER
  CMAKE_PREFIX_PATH     : /opt/cuda
  CMAKE_INSTALL_PREFIX  : /home/psi/git/pytorch/torch
  USE_GOLD_LINKER       : OFF

  TORCH_VERSION         : 2.1.0
  BUILD_CAFFE2          : OFF
  BUILD_CAFFE2_OPS      : OFF
  BUILD_STATIC_RUNTIME_BENCHMARK: OFF
  BUILD_TENSOREXPR_BENCHMARK: OFF
  BUILD_NVFUSER_BENCHMARK: OFF
  BUILD_BINARY          : OFF
  BUILD_CUSTOM_PROTOBUF : ON
    Link local protobuf : ON
  BUILD_DOCS            : OFF
  BUILD_PYTHON          : ON
    Python version      : 3.8.16
    Python executable   : /home/psi/.conda/envs/ai/bin/python
    Pythonlibs version  : 3.8.16
    Python library      : /home/psi/.conda/envs/ai/lib/libpython3.8.so.1.0
    Python includes     : /home/psi/.conda/envs/ai/include/python3.8
    Python site-packages: lib/python3.8/site-packages
  BUILD_SHARED_LIBS     : ON
  CAFFE2_USE_MSVC_STATIC_RUNTIME     : OFF
  BUILD_TEST            : ON
  BUILD_JNI             : OFF
  BUILD_MOBILE_AUTOGRAD : OFF
  BUILD_LITE_INTERPRETER: OFF
  INTERN_BUILD_MOBILE   : 
  TRACING_BASED         : OFF
  USE_BLAS              : 1
    BLAS                : mkl
    BLAS_HAS_SBGEMM     : 
  USE_LAPACK            : 1
    LAPACK              : mkl
  USE_ASAN              : OFF
  USE_TSAN              : OFF
  USE_CPP_CODE_COVERAGE : OFF
  USE_CUDA              : ON
    Split CUDA          : 
    CUDA static link    : OFF
    USE_CUDNN           : ON
    USE_EXPERIMENTAL_CUDNN_V8_API: ON
    CUDA version        : 11.8
    USE_FLASH_ATTENTION : ON
    cuDNN version       : 8.9.1
    CUDA root directory : /opt/cuda
    CUDA library        : /usr/lib/libcuda.so
    cudart library      : /opt/cuda/lib64/libcudart.so
    cublas library      : /opt/cuda/lib64/libcublas.so
    cufft library       : /opt/cuda/lib64/libcufft.so
    curand library      : /opt/cuda/lib64/libcurand.so
    cusparse library    : /opt/cuda/lib64/libcusparse.so
    cuDNN library       : /opt/cudnn/lib/libcudnn.so
    nvrtc               : /opt/cuda/lib64/libnvrtc.so
    CUDA include path   : /opt/cuda/include
    NVCC executable     : /opt/cuda/bin/nvcc
    CUDA compiler       : /opt/cuda/bin/nvcc
    CUDA flags          :  -Xfatbin -compress-all -DONNX_NAMESPACE=onnx_torch -gencode arch=compute_61,code=sm_61 -gencode arch=compute_52,code=sm_52 -Xcudafe --diag_suppress=cc_clobber_ignored,--diag_suppress=set_but_not_used,--diag_suppress=field_without_dll_interface,--diag_suppress=base_class_has_different_dll_interface,--diag_suppress=dll_interface_conflict_none_assumed,--diag_suppress=dll_interface_conflict_dllexport_assumed,--diag_suppress=bad_friend_decl --expt-relaxed-constexpr --expt-extended-lambda  -Wno-deprecated-gpu-targets --expt-extended-lambda -DCUB_WRAPPED_NAMESPACE=at_cuda_detail -DCUDA_HAS_FP16=1 -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ -D__CUDA_NO_BFLOAT16_CONVERSIONS__
    CUDA host compiler  : 
    CUDA --device-c     : OFF
    USE_TENSORRT        : OFF
  USE_ROCM              : OFF
  BUILD_NVFUSER         : ON
  USE_EIGEN_FOR_BLAS    : 
  USE_FBGEMM            : ON
    USE_FAKELOWP          : OFF
  USE_KINETO            : ON
  USE_FFMPEG            : ON
  USE_GFLAGS            : OFF
  USE_GLOG              : OFF
  USE_LEVELDB           : OFF
  USE_LITE_PROTO        : OFF
  USE_LMDB              : OFF
  USE_METAL             : OFF
  USE_PYTORCH_METAL     : OFF
  USE_PYTORCH_METAL_EXPORT     : OFF
  USE_MPS               : OFF
  USE_FFTW              : OFF
  USE_MKL               : ON
  USE_MKLDNN            : ON
  USE_MKLDNN_ACL        : OFF
  USE_MKLDNN_CBLAS      : ON
  USE_UCC               : OFF
  USE_ITT               : ON
  USE_NCCL              : ON
    USE_SYSTEM_NCCL     : OFF
    USE_NCCL_WITH_UCC   : OFF
  USE_NNPACK            : ON
  USE_NUMPY             : ON
  USE_OBSERVERS         : ON
  USE_OPENCL            : ON
  USE_OPENCV            : ON
    OpenCV version      : 4.7.0
  USE_OPENMP            : ON
  USE_TBB               : OFF
  USE_VULKAN            : OFF
  USE_PROF              : OFF
  USE_QNNPACK           : ON
  USE_PYTORCH_QNNPACK   : ON
  USE_XNNPACK           : ON
  USE_REDIS             : OFF
  USE_ROCKSDB           : OFF
  USE_ZMQ               : OFF
  USE_DISTRIBUTED       : ON
    USE_MPI               : ON
    USE_GLOO              : ON
    USE_GLOO_WITH_OPENSSL : OFF
    USE_TENSORPIPE        : ON
  Public Dependencies  : caffe2::mkl
  Private Dependencies : Threads::Threads;pthreadpool;cpuinfo;qnnpack;pytorch_qnnpack;nnpack;XNNPACK;fbgemm;/opt/cuda/lib64/libOpenCL.so;/usr/lib/libnuma.so;opencv_core;opencv_highgui;opencv_imgproc;opencv_imgcodecs;opencv_optflow;opencv_videoio;opencv_video;/usr/lib/libavcodec.so;/usr/lib/libavformat.so;/usr/lib/libavutil.so;/usr/lib/libswscale.so;/usr/lib/libswresample.so;ittnotify;fp16;/usr/lib/libmpi_cxx.so;/usr/lib/libmpi.so;caffe2::openmp;tensorpipe;gloo;libzstd_static;foxi_loader;rt;fmt::fmt-header-only;kineto;gcc_s;gcc;dl
  Public CUDA Deps.    : caffe2::cufft;caffe2::curand;caffe2::cublas
  Private CUDA Deps.   : torch::cudnn;__caffe2_nccl;tensorpipe_cuda;gloo_cuda;/opt/cuda/lib64/libcudart.so;CUDA::cusparse;CUDA::curand;CUDA::cufft;ATEN_CUDA_FILES_GEN_LIB
  USE_COREML_DELEGATE     : OFF
  BUILD_LAZY_TS_BACKEND   : ON
  TORCH_DISABLE_GPU_ASSERTS : ON
Configuring done (24.6s)
Generating done (1.9s)
```

</details>

### Versions

PyTorch version: N/A
Is debug build: N/A
CUDA used to build PyTorch: N/A
ROCM used to build PyTorch: N/A

OS: Arch Linux (x86_64)
GCC version: (Arch Linux 10.3.0-2) 10.3.0
Clang version: 15.0.7
CMake version: version 3.26.4
Libc version: glibc-2.37

Python version: 3.8.16 (default, Mar  2 2023, 03:21:46)  [GCC 11.2.0] (64-bit runtime)
Python platform: Linux-6.3.5-zen1-1-zen-x86_64-with-glibc2.17
Is CUDA available: N/A
CUDA runtime version: 11.8.89
CUDA_MODULE_LOADING set to: N/A
GPU models and configuration: 
GPU 0: NVIDIA GeForce GTX 1060 6GB
GPU 1: NVIDIA GeForce GTX 970

Nvidia driver version: 530.41.03
cuDNN version: Could not collect
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: N/A

CPU:
Architecture:                    x86_64
CPU op-mode(s):                  32-bit, 64-bit
Address sizes:                   39 bits physical, 48 bits virtual
Byte Order:                      Little Endian
CPU(s):                          12
On-line CPU(s) list:             0-11
Vendor ID:                       GenuineIntel
Model name:                      Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz
CPU family:                      6
Model:                           158
Thread(s) per core:              2
Core(s) per socket:              6
Socket(s):                       1
Stepping:                        10
CPU(s) scaling MHz:              98%
CPU max MHz:                     4900.0000
CPU min MHz:                     800.0000
BogoMIPS:                        7399.70
Flags:                           fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault invpcid_single pti ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust sgx bmi1 avx2 smep bmi2 erms invpcid mpx rdseed adx smap clflushopt intel_pt xsaveopt xsavec xgetbv1 xsaves dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp md_clear flush_l1d arch_capabilities
Virtualization:                  VT-x
L1d cache:                       192 KiB (6 instances)
L1i cache:                       192 KiB (6 instances)
L2 cache:                        1.5 MiB (6 instances)
L3 cache:                        12 MiB (1 instance)
NUMA node(s):                    1
NUMA node0 CPU(s):               0-11
Vulnerability Itlb multihit:     KVM: Mitigation: VMX disabled
Vulnerability L1tf:              Mitigation; PTE Inversion; VMX conditional cache flushes, SMT vulnerable
Vulnerability Mds:               Mitigation; Clear CPU buffers; SMT vulnerable
Vulnerability Meltdown:          Mitigation; PTI
Vulnerability Mmio stale data:   Mitigation; Clear CPU buffers; SMT vulnerable
Vulnerability Retbleed:          Mitigation; IBRS
Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl
Vulnerability Spectre v1:        Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Vulnerability Spectre v2:        Mitigation; IBRS, IBPB conditional, STIBP conditional, RSB filling, PBRSB-eIBRS Not affected
Vulnerability Srbds:             Mitigation; Microcode
Vulnerability Tsx async abort:   Mitigation; TSX disabled

Versions of relevant libraries:
[pip3] numpy==1.23.0
[conda] numpy                     1.23.0                   pypi_0    pypi

cc @gujinghui @PenghuiCheng @XiaobingSuper @jianyuh @jgong5 @mingfeima @sanchitintel @ashokei @jingxu10 @min-jean-cho @yanbing-j @Guobing-Chen @Xia-Weiwen