Skip to content

Commit dbc57c4

Browse files
mcr229facebook-github-bot
authored andcommitted
add pthreadpool (#47)
Summary: Pull Request resolved: #47 add pthreadpool submodule for XNNPACK OSS dep Differential Revision: D48176168 fbshipit-source-id: a35aed698eee1fe48dcb14b4a94ca6c6d1dcd1d0
1 parent d7d91a2 commit dbc57c4

File tree

5 files changed

+55
-0
lines changed

5 files changed

+55
-0
lines changed

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,6 @@
1010
[submodule "third-party/gflags"]
1111
path = third-party/gflags
1212
url = https://github.com/gflags/gflags.git
13+
[submodule "backends/xnnpack/third-party/pthreadpool"]
14+
path = backends/xnnpack/third-party/pthreadpool
15+
url = https://github.com/Maratyszcza/pthreadpool.git
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
load(":pthreadpool_defs.bzl", "define_pthreadpool")
2+
3+
define_pthreadpool()
Submodule pthreadpool added at a134dd5
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
def define_pthreadpool():
2+
# @lint-ignore BUCKLINT: native and fb_native are explicitly forbidden in fbcode.
3+
native.cxx_library(
4+
name = "pthreadpool",
5+
srcs = ["pthreadpool/src/legacy-api.c", "pthreadpool/src/memory.c", "pthreadpool/src/portable-api.c", "pthreadpool/src/pthreads.c"],
6+
deps = [
7+
":FXdiv",
8+
],
9+
exported_deps = [
10+
":pthreadpool_header",
11+
],
12+
compiler_flags = [
13+
"-w",
14+
"-Os",
15+
"-fstack-protector-strong",
16+
"-fno-delete-null-pointer-checks",
17+
],
18+
headers = {
19+
"threadpool-atomics.h": "pthreadpool/src/threadpool-atomics.h",
20+
"threadpool-common.h": "pthreadpool/src/threadpool-common.h",
21+
"threadpool-object.h": "pthreadpool/src/threadpool-object.h",
22+
"threadpool-utils.h": "pthreadpool/src/threadpool-utils.h",
23+
},
24+
header_namespace = "",
25+
preferred_linkage = "static",
26+
platform_preprocessor_flags = [["windows", ["-D_WINDOWS", "-D_WIN32", "-DWIN32", "-DNOMINMAX", "-D_CRT_SECURE_NO_WARNINGS", "-D_USE_MATH_DEFINES"]], ["windows.*64$", ["-D_WIN64"]]],
27+
preprocessor_flags = ["-DPTHREADPOOL_USE_FUTEX=0", "-DPTHREADPOOL_USE_GCD=0"],
28+
visibility = ["PUBLIC"],
29+
)
30+
31+
# @lint-ignore BUCKLINT: native and fb_native are explicitly forbidden in fbcode.
32+
native.cxx_library(
33+
name = "pthreadpool_header",
34+
header_namespace = "",
35+
exported_headers = {
36+
"pthreadpool.h": "pthreadpool/include/pthreadpool.h",
37+
},
38+
visibility = ["PUBLIC"],
39+
)
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/bash
2+
# Copyright (c) Meta Platforms, Inc. and affiliates.
3+
# All rights reserved.
4+
#
5+
# This source code is licensed under the BSD-style license found in the
6+
# LICENSE file in the root directory of this source tree.
7+
8+
printf "\nCreating Third-Party Buck TARGETS\n"
9+
mv TARGETS.oss TARGETS

0 commit comments

Comments
 (0)