Skip to content

Commit

Permalink
[cpuinfo,pthreadpool,xnnpack] update for future works (#114)
Browse files Browse the repository at this point in the history
* [pthreadpool] create a new port

* support uwp build

* [pthreadpool] update baseline

* [cpuinfo] update to latest

* [cpuinfo] update baseline

* [xnnpack] update to 2023-04-13

* [xnnpack] update baseline

* add dropped files
  • Loading branch information
luncliff authored Sep 27, 2023
1 parent 6b2c8be commit 6809b17
Show file tree
Hide file tree
Showing 12 changed files with 90 additions and 17 deletions.
6 changes: 2 additions & 4 deletions ports/cpuinfo/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,9 @@ endif()
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO pytorch/cpuinfo
REF eb4a6674bfe9cf91b63b9817412ae5f6862c8432
SHA512 2b8bca09c140ad5d3c7c42d4a117642bad8ec1644085c20876006575428db756c11a1ffaaa24788b43020fc0822ca56695e6969c8a946070aafee93d2f7a66a3
REF 959002f82d7962a473d8bf301845f2af720e0aa4
SHA512 9aedaac08493e67d339fdffd430f39b2f3a2bf231d0454b9e5193a2c22b51fe728e89ea6066a2915a718b27c0741471f27489e1ea6f36c01dec59ea2c499eeb5
HEAD_REF main
PATCHES
build-clog.patch
)

vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
Expand Down
2 changes: 1 addition & 1 deletion ports/cpuinfo/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cpuinfo",
"version-date": "2023-03-19",
"version-date": "2023-09-12",
"description": "CPU INFOrmation library (x86/x86-64/ARM/ARM64, Linux/Windows/Android/macOS/iOS)",
"homepage": "https://github.com/pytorch/cpuinfo",
"license": "BSD-2-Clause",
Expand Down
13 changes: 13 additions & 0 deletions ports/pthreadpool/fix-cmake-uwp.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7fa4285..35b2eee 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -80,7 +80,7 @@ ELSE()
LIST(APPEND PTHREADPOOL_SRCS src/portable-api.c src/memory.c)
IF(APPLE AND (PTHREADPOOL_SYNC_PRIMITIVE STREQUAL "default" OR PTHREADPOOL_SYNC_PRIMITIVE STREQUAL "gcd"))
LIST(APPEND PTHREADPOOL_SRCS src/gcd.c)
- ELSEIF(CMAKE_SYSTEM_NAME MATCHES "^(Windows|CYGWIN|MSYS)$" AND (PTHREADPOOL_SYNC_PRIMITIVE STREQUAL "default" OR PTHREADPOOL_SYNC_PRIMITIVE STREQUAL "event"))
+ ELSEIF(CMAKE_SYSTEM_NAME MATCHES "^(Windows|WindowsStore|CYGWIN|MSYS)$" AND (PTHREADPOOL_SYNC_PRIMITIVE STREQUAL "default" OR PTHREADPOOL_SYNC_PRIMITIVE STREQUAL "event"))
LIST(APPEND PTHREADPOOL_SRCS src/windows.c)
ELSE()
LIST(APPEND PTHREADPOOL_SRCS src/pthreads.c)
22 changes: 22 additions & 0 deletions ports/pthreadpool/portfile.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
if(VCPKG_TARGET_IS_WINDOWS)
vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
endif()

vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO Maratyszcza/pthreadpool
REF 4fe0e1e183925bf8cfa6aae24237e724a96479b8
SHA512 764d81219f2bf1f056983b5c2576f377aeef37f0f2282e74f81bfe1eac5353e175603f80a6647c96165b24ebdcb7bc2189a376e8577ce4319d82679c33750451
PATCHES fix-cmake-uwp.patch
)

vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
-DPTHREADPOOL_BUILD_TESTS=OFF
-DPTHREADPOOL_BUILD_BENCHMARKS=OFF
)
vcpkg_cmake_install()

file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
16 changes: 16 additions & 0 deletions ports/pthreadpool/vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "pthreadpool",
"version-date": "2023-09-12",
"description": "Portable (POSIX/Windows/Emscripten) thread pool for C/C++",
"homepage": "https://github.com/Maratyszcza/pthreadpool",
"dependencies": [
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
}
]
}
9 changes: 5 additions & 4 deletions ports/xnnpack/fix-cmake.patch
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,14 @@ index 2e7f753..b33f03d 100644
IF(NOT XNNPACK_USE_SYSTEM_LIBS)
SET(CPUINFO_BUILD_TOOLS OFF CACHE BOOL "")
SET(CPUINFO_BUILD_UNIT_TESTS OFF CACHE BOOL "")
@@ -843,7 +845,9 @@ IF(XNNPACK_BUILD_LIBRARY)
@@ -843,7 +845,10 @@ IF(XNNPACK_BUILD_LIBRARY)
ENDIF()

# ---[ Configure pthreadpool
-IF(NOT TARGET pthreadpool)
+find_package(unofficial-pthreadpool CONFIG REQUIRED)
+add_library(pthreadpool ALIAS unofficial::pthreadpool)
+find_path(PTHREADPOOL_INCLUDE_DIRS "pthreadpool.h" REQUIRED)
+include_directories(${PTHREADPOOL_INCLUDE_DIRS})
+find_library(PTHREADPOOL_LIBRARY NAMES pthreadpool REQUIRED)
+IF(FALSE)
IF(NOT XNNPACK_USE_SYSTEM_LIBS)
SET(PTHREADPOOL_BUILD_TESTS OFF CACHE BOOL "")
Expand All @@ -56,7 +57,7 @@ index 2e7f753..b33f03d 100644
TARGET_LINK_LIBRARIES(packing PRIVATE pthreadpool)
IF(XNNPACK_BUILD_LIBRARY)
- TARGET_LINK_LIBRARIES(XNNPACK PUBLIC pthreadpool)
+ TARGET_LINK_LIBRARIES(XNNPACK PRIVATE pthreadpool)
+ TARGET_LINK_LIBRARIES(XNNPACK PRIVATE ${PTHREADPOOL_LIBRARY})
TARGET_LINK_LIBRARIES(allocator PRIVATE pthreadpool)
TARGET_LINK_LIBRARIES(cache PRIVATE memory pthreadpool)
TARGET_LINK_LIBRARIES(subgraph PRIVATE pthreadpool)
Expand Down
6 changes: 4 additions & 2 deletions ports/xnnpack/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@ if(VCPKG_TARGET_IS_WINDOWS)
vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
endif()

# for onnxruntime, using just before https://github.com/google/XNNPACK/commit/142aceb06d509b57d02ddc2a9558ab35eacbb6fb

vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO google/XNNPACK
REF bad81856dce9fea265866c87ea524afbbdd69012 # 2023-03-19
SHA512 eed30cc207639a32fe247f979de33c3600abbd46f98b367eaf88e4f17453ce30464cafff237eb742832411502f068af7a79f12c547ad00bc179f2972444da0d0
REF db68602a37353f3050c1835d5609a1ce1a3f3d2a # 2023-04-13
SHA512 66d8546678fb268e75b318cff997d24748db49447df2ec0c2fec7a4c6a0bdb3d985d25df18c6eb85aec8a66627b62e41c02c584c3b7ee7d631fb95b42aee074b
HEAD_REF master
PATCHES
fix-cmake.patch
Expand Down
4 changes: 1 addition & 3 deletions ports/xnnpack/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
{
"name": "xnnpack",
"version-date": "2023-03-19",
"port-version": 1,
"version-date": "2023-04-13",
"description": "High-efficiency floating-point neural network inference operators for mobile, server, and Web",
"homepage": "https://github.com/google/XNNPACK",
"dependencies": [
"cpuinfo",
"fp16",
"fxdiv",
"pthreadpool",
{
"name": "vcpkg-cmake",
Expand Down
10 changes: 7 additions & 3 deletions versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"port-version": 2
},
"cpuinfo": {
"baseline": "2023-03-19",
"baseline": "2023-09-12",
"port-version": 0
},
"directml": {
Expand Down Expand Up @@ -84,6 +84,10 @@
"baseline": "3.1.2",
"port-version": 0
},
"pthreadpool": {
"baseline": "2023-09-12",
"port-version": 0
},
"ruy": {
"baseline": "2022-09-12",
"port-version": 0
Expand All @@ -105,8 +109,8 @@
"port-version": 0
},
"xnnpack": {
"baseline": "2023-03-19",
"port-version": 1
"baseline": "2023-04-13",
"port-version": 0
},
"xnvctrl": {
"baseline": "515.43.04",
Expand Down
5 changes: 5 additions & 0 deletions versions/c-/cpuinfo.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "f3cd834cda6172defea6f895cab5cfb3c14e5575",
"version-date": "2023-09-12",
"port-version": 0
},
{
"git-tree": "4f5344fbf5c6a3c3cbf6235b90a910fab8f41699",
"version-date": "2023-03-19",
Expand Down
9 changes: 9 additions & 0 deletions versions/p-/pthreadpool.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"versions": [
{
"git-tree": "25cedef8cdfa7dff81489f4133c7571ed6b906c4",
"version-date": "2023-09-12",
"port-version": 0
}
]
}
5 changes: 5 additions & 0 deletions versions/x-/xnnpack.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "0b5f7dd7067bc8a77c929fee398177748dbc1e8d",
"version-date": "2023-04-13",
"port-version": 0
},
{
"git-tree": "f037a2f398e6f417dddf87e832810c260c14e92d",
"version-date": "2023-03-19",
Expand Down

0 comments on commit 6809b17

Please sign in to comment.