Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XNNPACK cci.20211210 #9330

Merged
merged 5 commits into from
Feb 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion recipes/xnnpack/all/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
3 changes: 3 additions & 0 deletions recipes/xnnpack/all/conandata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
33 changes: 21 additions & 12 deletions recipes/xnnpack/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,41 +57,50 @@ 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):
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)
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"
self._cmake.definitions["XNNPACK_LIBRARY_TYPE"] = "default"
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"] = "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

def build(self):
self._patch_sources()
cmake = self._configure_cmake()
cmake.build()
cmake.build(target="XNNPACK")

def package(self):
self.copy("LICENSE", dst="licenses", src=self._source_subfolder)
Expand Down
2 changes: 2 additions & 0 deletions recipes/xnnpack/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ versions:
folder: all
"cci.20211026":
folder: all
"cci.20211210":
folder: all