File: 1030-use-system-dnnl.patch

package info (click to toggle)
pytorch-cuda 2.6.0%2Bdfsg-7
  • links: PTS, VCS
  • area: contrib
  • in suites: forky, sid, trixie
  • size: 161,620 kB
  • sloc: python: 1,278,832; cpp: 900,322; ansic: 82,710; asm: 7,754; java: 3,363; sh: 2,811; javascript: 2,443; makefile: 597; ruby: 195; xml: 84; objc: 68
file content (66 lines) | stat: -rw-r--r-- 2,205 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
Description: Enable DNNL/ideep integration
Author: Mo Zhou
Forwarded: not-needed
Last-update: 2023-09-30

---

Index: pytorch/cmake/public/mkldnn.cmake
===================================================================
--- pytorch.orig/cmake/public/mkldnn.cmake
+++ pytorch/cmake/public/mkldnn.cmake
@@ -5,6 +5,8 @@ if(CPU_AARCH64)
 endif()
 
 find_package(MKLDNN QUIET)
+find_library(MKLDNN_LIBRARIES dnnl)
+set(MKLDNN_FOUND TRUE)
 
 if(NOT TARGET caffe2::mkldnn)
   add_library(caffe2::mkldnn INTERFACE IMPORTED)
Index: pytorch/cmake/Modules/FindMKLDNN.cmake
===================================================================
--- pytorch.orig/cmake/Modules/FindMKLDNN.cmake
+++ pytorch/cmake/Modules/FindMKLDNN.cmake
@@ -16,8 +16,10 @@ IF(NOT MKLDNN_FOUND)
   SET(MKLDNN_LIBRARIES)
   SET(MKLDNN_INCLUDE_DIR)
 
-  SET(IDEEP_ROOT "${PROJECT_SOURCE_DIR}/third_party/ideep")
-  SET(MKLDNN_ROOT "${PROJECT_SOURCE_DIR}/third_party/ideep/mkl-dnn")
+  set(IDEEP_ROOT "/usr")
+  set(MKLDNN_ROOT "/usr")
+  set(IDEEP_INCLUDE_DIR "/usr/include")
+  set(MKLDNN_INCLUDE_DIR "/usr/include")
 
   if(USE_XPU) # Build oneDNN GPU library
     if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
@@ -90,6 +92,7 @@ IF(NOT MKLDNN_FOUND)
   IF(EXISTS "${MKLDNN_ROOT}/include/oneapi/dnnl/dnnl_ukernel.hpp")
     MESSAGE("-- Will build oneDNN UKERNEL")
     SET(DNNL_EXPERIMENTAL_UKERNEL ON CACHE BOOL "" FORCE)
+    ADD_DEFINITIONS(-DDNNL_EXPERIMENTAL_UKERNEL)
   ENDIF(EXISTS "${MKLDNN_ROOT}/include/oneapi/dnnl/dnnl_ukernel.hpp")
 
   FIND_PACKAGE(BLAS)
@@ -165,18 +168,14 @@ IF(NOT MKLDNN_FOUND)
     ENDIF()
   ENDIF()
 
-  ADD_SUBDIRECTORY(${MKLDNN_ROOT})
+  find_package(dnnl REQUIRED)
+  add_library(dnnl ALIAS DNNL::dnnl)
 
   IF(NOT TARGET dnnl)
     MESSAGE("Failed to include MKL-DNN target")
     RETURN()
   ENDIF(NOT TARGET dnnl)
 
-  IF(NOT APPLE AND CMAKE_COMPILER_IS_GNUCC)
-    TARGET_COMPILE_OPTIONS(dnnl PRIVATE -Wno-maybe-uninitialized)
-    TARGET_COMPILE_OPTIONS(dnnl PRIVATE -Wno-strict-overflow)
-    TARGET_COMPILE_OPTIONS(dnnl PRIVATE -Wno-error=strict-overflow)
-  ENDIF(NOT APPLE AND CMAKE_COMPILER_IS_GNUCC)
   LIST(APPEND MKLDNN_LIBRARIES ${MKL_OPENMP_LIBRARY})
   LIST(APPEND MKLDNN_LIBRARIES dnnl)