From d326dec8115cf5e2cac9497633dc11ecc970361b Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Fri, 24 Sep 2021 13:46:02 +0200 Subject: gnu: python-pytorch: Unbundle NNPACK. * gnu/packages/machine-learning.scm (python-pytorch)[source]: Delete "third_party/NNPACK". [inputs]: Add NNPACK. [propagated-inputs]: Remove PYTHON-PEACHPY. * gnu/packages/patches/python-pytorch-system-libraries.patch: Remove hunk modifying NNPACK; add hunk to allow the use of our own NNPACK. --- gnu/packages/machine-learning.scm | 4 +-- .../patches/python-pytorch-system-libraries.patch | 38 +++++++++++++--------- 2 files changed, 25 insertions(+), 17 deletions(-) (limited to 'gnu/packages') diff --git a/gnu/packages/machine-learning.scm b/gnu/packages/machine-learning.scm index a8e2a40ed6..9b5d4c1743 100644 --- a/gnu/packages/machine-learning.scm +++ b/gnu/packages/machine-learning.scm @@ -2668,7 +2668,7 @@ (define-public python-pytorch ;; needs these. ;; "FP16" "FXdiv" "gemmlowp" "psimd" - "gloo" "googletest" "ios-cmake" + "gloo" "googletest" "ios-cmake" "NNPACK" "onnx" "protobuf" "pthreadpool" "pybind11" "python-enum" "python-peachpy" "python-six" "tbb" "XNNPACK" "zstd")) @@ -2733,6 +2733,7 @@ (define-public python-pytorch ("googletest" ,googletest) ("googlebenchmark" ,googlebenchmark) ("gloo" ,gloo) + ("nnpack" ,nnpack) ("openblas" ,openblas) ("openmpi" ,openmpi) ("pthreadpool" ,pthreadpool) @@ -2746,7 +2747,6 @@ (define-public python-pytorch ("python-numpy" ,python-numpy) ("python-pyyaml" ,python-pyyaml) ("python-cffi" ,python-cffi) - ("python-peachpy" ,python-peachpy) ("python-typing-extensions" ,python-typing-extensions) ("python-future" ,python-future) ("python-six" ,python-six) diff --git a/gnu/packages/patches/python-pytorch-system-libraries.patch b/gnu/packages/patches/python-pytorch-system-libraries.patch index c8d14b3f56..76c06520f0 100644 --- a/gnu/packages/patches/python-pytorch-system-libraries.patch +++ b/gnu/packages/patches/python-pytorch-system-libraries.patch @@ -81,7 +81,7 @@ diff --git a/torch/lib/c10d/test/CMakeLists.txt b/torch/lib/c10d/test/CMakeLists index b74d4b65f7..fc7c207505 100644 --- a/torch/lib/c10d/test/CMakeLists.txt +++ b/torch/lib/c10d/test/CMakeLists.txt -@@ -16,25 +16,25 @@ function(c10d_add_test test_src) +@@ -16,24 +16,24 @@ function(c10d_add_test test_src) add_test(NAME ${test_name} COMMAND $) endfunction() @@ -114,18 +114,26 @@ index b74d4b65f7..fc7c207505 100644 + c10d_add_test(ProcessGroupGlooTest.cpp c10d gtest_main gtest) endif() endif() + +diff --git a/cmake/External/nnpack.cmake b/cmake/External/nnpack.cmake +index a41343cbb5..6075bdd0a4 100644 +--- a/cmake/External/nnpack.cmake ++++ b/cmake/External/nnpack.cmake +@@ -40,7 +40,7 @@ endif() + # (3) Android, iOS, Linux, macOS - supported + ############################################################################## + +-if(ANDROID OR IOS OR ${CMAKE_SYSTEM_NAME} STREQUAL "Linux" OR ${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") ++if(FALSE) + message(STATUS "Brace yourself, we are building NNPACK") + set(CAFFE2_THIRD_PARTY_ROOT ${PROJECT_SOURCE_DIR}/third_party) + +@@ -114,6 +114,5 @@ endif() + # (4) Catch-all: not supported. + ############################################################################## -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 5ecd2df..24feae3 100644 ---- a/third_party/NNPACK/CMakeLists.txt -+++ b/third_party/NNPACK/CMakeLists.txt -@@ -427,8 +427,7 @@ IF(NNPACK_BACKEND STREQUAL "x86-64") - FILE(MAKE_DIRECTORY ${obj_dir}) - ADD_CUSTOM_COMMAND( - OUTPUT ${obj} -- COMMAND "PYTHONPATH=${PEACHPY_PYTHONPATH}" -- ${PYTHON_EXECUTABLE} -m peachpy.x86_64 -+ COMMAND ${PYTHON_EXECUTABLE} -m peachpy.x86_64 - -mabi=sysv -g4 -mimage-format=${PEACHPY_IMAGE_FORMAT} - "-I${PROJECT_SOURCE_DIR}/src" "-I${PROJECT_SOURCE_DIR}/src/x86_64-fma" "-I${FP16_SOURCE_DIR}/include" - -o ${obj} "${PROJECT_SOURCE_DIR}/${src}" +-message(WARNING "Unknown platform - I don't know how to build NNPACK. " +- "See cmake/External/nnpack.cmake for details.") +-set(USE_NNPACK OFF) ++set(NNPACK_FOUND TRUE) ++set(USE_NNPACK ON) -- cgit v1.2.3