From dad5bf3088a3bbcc646c9b260619bb3b0b5bf901 Mon Sep 17 00:00:00 2001 From: Gabriele Della Casa Venturelli Date: Wed, 2 Feb 2022 11:57:24 -0800 Subject: [PATCH 1/5] [xnnpack] Fix for linux-aarch64 building --- recipes/xnnpack/all/conanfile.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/recipes/xnnpack/all/conanfile.py b/recipes/xnnpack/all/conanfile.py index 1d8f3e3515f38..ec2c7d8d1fefb 100644 --- a/recipes/xnnpack/all/conanfile.py +++ b/recipes/xnnpack/all/conanfile.py @@ -76,8 +76,11 @@ def _configure_cmake(self): return self._cmake self._cmake = CMake(self) if self.settings.arch == "armv8": - # Not defined by Conan for Apple Silicon. See https://github.com/conan-io/conan/pull/8026 - self._cmake.definitions["CMAKE_SYSTEM_PROCESSOR"] = "arm64" + if self.settings.os == "Linux": + self._cmake.definitions["CMAKE_SYSTEM_PROCESSOR"] = "aarch64" + else: + # Not defined by Conan for Apple Silicon. See https://github.com/conan-io/conan/pull/8026 + self._cmake.definitions["CMAKE_SYSTEM_PROCESSOR"] = "arm64" self._cmake.definitions["XNNPACK_LIBRARY_TYPE"] = "default" self._cmake.definitions["XNNPACK_ENABLE_ASSEMBLY"] = self.options.assembly self._cmake.definitions["XNNPACK_ENABLE_MEMOPT"] = self.options.memopt From 83b233ce076a5107d37851deb8a77b04637d9b48 Mon Sep 17 00:00:00 2001 From: Gabriele Della Casa Venturelli Date: Wed, 2 Feb 2022 11:58:34 -0800 Subject: [PATCH 2/5] [xnnpack] Fix for step-by-step package creation, patching during `source` step --- recipes/xnnpack/all/conanfile.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/recipes/xnnpack/all/conanfile.py b/recipes/xnnpack/all/conanfile.py index ec2c7d8d1fefb..f48eec223af8f 100644 --- a/recipes/xnnpack/all/conanfile.py +++ b/recipes/xnnpack/all/conanfile.py @@ -61,20 +61,22 @@ def requirements(self): self.requires("fxdiv/cci.20200417") self.requires("pthreadpool/cci.20210218") + def _patch_sources(self): + tools.replace_in_file(os.path.join(self.source_folder, self._source_subfolder, "CMakeLists.txt"), + "LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}", + "LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}") + def source(self): tools.get(**self.conan_data["sources"][self.version]) extracted_dir = glob.glob("XNNPACK-*")[0] os.rename(extracted_dir, self._source_subfolder) - - def _patch_sources(self): - tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), - "LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}", - "LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}") + self._patch_sources() def _configure_cmake(self): if self._cmake: return self._cmake self._cmake = CMake(self) + self._cmake.definitions["CONAN_BUILD_FOLDER"] = self.build_folder if self.settings.arch == "armv8": if self.settings.os == "Linux": self._cmake.definitions["CMAKE_SYSTEM_PROCESSOR"] = "aarch64" @@ -92,7 +94,6 @@ def _configure_cmake(self): return self._cmake def build(self): - self._patch_sources() cmake = self._configure_cmake() cmake.build() From 699f32be6a70ea8a5f9ca130f86bf934b3638edf Mon Sep 17 00:00:00 2001 From: Gabriele Della Casa Venturelli Date: Wed, 2 Feb 2022 12:55:37 -0800 Subject: [PATCH 3/5] [xnnpack] Using `CMAKE_BINARY_DIR` to determine build folder --- recipes/xnnpack/all/CMakeLists.txt | 2 +- recipes/xnnpack/all/conanfile.py | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/recipes/xnnpack/all/CMakeLists.txt b/recipes/xnnpack/all/CMakeLists.txt index e83611470289d..297289017d303 100644 --- a/recipes/xnnpack/all/CMakeLists.txt +++ b/recipes/xnnpack/all/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.4) project(cmake_wrapper) -include(conanbuildinfo.cmake) +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) add_library(cpuinfo INTERFACE IMPORTED) diff --git a/recipes/xnnpack/all/conanfile.py b/recipes/xnnpack/all/conanfile.py index f48eec223af8f..7b093f60b9a1c 100644 --- a/recipes/xnnpack/all/conanfile.py +++ b/recipes/xnnpack/all/conanfile.py @@ -76,7 +76,6 @@ def _configure_cmake(self): if self._cmake: return self._cmake self._cmake = CMake(self) - self._cmake.definitions["CONAN_BUILD_FOLDER"] = self.build_folder if self.settings.arch == "armv8": if self.settings.os == "Linux": self._cmake.definitions["CMAKE_SYSTEM_PROCESSOR"] = "aarch64" From 92349862eb8ca510bfe8a779eefaa43eec7ca274 Mon Sep 17 00:00:00 2001 From: Gabriele Della Casa Venturelli Date: Thu, 3 Feb 2022 09:54:31 -0800 Subject: [PATCH 4/5] [xnnpack] Added xnnpack cc1.20211210 --- recipes/xnnpack/all/conandata.yml | 3 +++ recipes/xnnpack/all/conanfile.py | 3 ++- recipes/xnnpack/config.yml | 2 ++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/recipes/xnnpack/all/conandata.yml b/recipes/xnnpack/all/conandata.yml index cb321650343c1..af63c678acbef 100644 --- a/recipes/xnnpack/all/conandata.yml +++ b/recipes/xnnpack/all/conandata.yml @@ -5,3 +5,6 @@ sources: "cci.20211026": url: "https://github.com/google/XNNPACK/archive/ccbaedf11c70a3ff4db0ef17cfeacd710ffc3492.tar.gz" sha256: "9324aea663d21cea4538095c40928572ddb685e0601853f278b7e5ead697fe81" + "cci.20211210": + url: "https://github.com/google/XNNPACK/archive/113092317754c7dea47bfb3cb49c4f59c3c1fa10.tar.gz" + sha256: "065bb9c85438c453f9300251f263118c4d123d79b21acf8f66582a3124d95fb2" diff --git a/recipes/xnnpack/all/conanfile.py b/recipes/xnnpack/all/conanfile.py index 7b093f60b9a1c..feb629657b915 100644 --- a/recipes/xnnpack/all/conanfile.py +++ b/recipes/xnnpack/all/conanfile.py @@ -89,12 +89,13 @@ def _configure_cmake(self): self._cmake.definitions["XNNPACK_BUILD_TESTS"] = False self._cmake.definitions["XNNPACK_BUILD_BENCHMARKS"] = False self._cmake.definitions["XNNPACK_USE_SYSTEM_LIBS"] = True + self._cmake.definitions["CMAKE_SKIP_INSTALL_ALL_DEPENDENCY"] = True self._cmake.configure() return self._cmake def build(self): cmake = self._configure_cmake() - cmake.build() + cmake.build(target="XNNPACK") def package(self): self.copy("LICENSE", dst="licenses", src=self._source_subfolder) diff --git a/recipes/xnnpack/config.yml b/recipes/xnnpack/config.yml index 83591a98a3a71..ffb6d8aa36c49 100644 --- a/recipes/xnnpack/config.yml +++ b/recipes/xnnpack/config.yml @@ -3,3 +3,5 @@ versions: folder: all "cci.20211026": folder: all + "cci.20211210": + folder: all From 7be5451cac9e5be1c0d6f65bcb6aa0e8f7900097 Mon Sep 17 00:00:00 2001 From: Gabriele Della Casa Venturelli Date: Mon, 7 Feb 2022 01:28:30 -0800 Subject: [PATCH 5/5] [xnnpack] XNNPACK dependencies update and recipe tweaks --- recipes/xnnpack/all/conanfile.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/recipes/xnnpack/all/conanfile.py b/recipes/xnnpack/all/conanfile.py index feb629657b915..01fd4f7a4d2c1 100644 --- a/recipes/xnnpack/all/conanfile.py +++ b/recipes/xnnpack/all/conanfile.py @@ -57,8 +57,8 @@ def configure(self): def requirements(self): self.requires("cpuinfo/cci.20201217") - self.requires("fp16/cci.20200514") - self.requires("fxdiv/cci.20200417") + self.requires("fp16/cci.20210320") + # Note: using newer version of pthreadpool compared to reference cci.20201205 self.requires("pthreadpool/cci.20210218") def _patch_sources(self): @@ -82,14 +82,19 @@ def _configure_cmake(self): else: # Not defined by Conan for Apple Silicon. See https://github.com/conan-io/conan/pull/8026 self._cmake.definitions["CMAKE_SYSTEM_PROCESSOR"] = "arm64" - self._cmake.definitions["XNNPACK_LIBRARY_TYPE"] = "default" + self._cmake.definitions["XNNPACK_LIBRARY_TYPE"] = "shared" if self.options.shared else "static" self._cmake.definitions["XNNPACK_ENABLE_ASSEMBLY"] = self.options.assembly self._cmake.definitions["XNNPACK_ENABLE_MEMOPT"] = self.options.memopt self._cmake.definitions["XNNPACK_ENABLE_SPARSE"] = self.options.sparse self._cmake.definitions["XNNPACK_BUILD_TESTS"] = False self._cmake.definitions["XNNPACK_BUILD_BENCHMARKS"] = False + + # Use conan dependencies instead of downloading them during configuration self._cmake.definitions["XNNPACK_USE_SYSTEM_LIBS"] = True + + # Install only built targets, in this case just the XNNPACK target self._cmake.definitions["CMAKE_SKIP_INSTALL_ALL_DEPENDENCY"] = True + self._cmake.configure() return self._cmake