Skip to content

Commit 4977cca

Browse files
authored
Revert "[wasm] Update xnnpack (#7507)" (#7735)
This reverts commit c66f302.
1 parent 281d8f8 commit 4977cca

File tree

7 files changed

+52
-32
lines changed

7 files changed

+52
-32
lines changed

.bazelrc

-3
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@ build --cxxopt="-std=c++17"
1212
build --cxxopt="-fno-rtti"
1313
build --cxxopt="-fno-exceptions"
1414
build --cxxopt="-fomit-frame-pointer"
15-
# Avoid unused function error `xnn_vlog` when building XNNPACK with `-c opt`.
16-
build:xnnpack-opt --copt="-DXNN_LOG_TO_STDIO=0"
17-
build:xnnpack-opt --define=xnn_log_level=none
1815

1916
# The following --define=EXECUTOR=remote will be able to be removed
2017
# once https://github.com/bazelbuild/bazel/issues/7254 is fixed

WORKSPACE

+46-20
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,9 @@ http_archive(
102102
name = "emsdk",
103103
# TODO: Remove repo_mapping when emsdk updates to rules_nodejs 5
104104
repo_mapping = {"@nodejs": "@nodejs_host"},
105-
sha256 = "bbea764c57af830e761f1fb8600d42dc303aa63ffd43647694eda5b8b757b469",
106-
strip_prefix = "emsdk-3.1.35/bazel",
107-
urls = ["https://github.com/emscripten-core/emsdk/archive/refs/tags/3.1.35.tar.gz"],
105+
sha256 = "b8270749b99d8d14922d1831b93781a5560fba6f7bce65cd477fc1b6aa262535",
106+
strip_prefix = "emsdk-3.1.28/bazel",
107+
urls = ["https://github.com/emscripten-core/emsdk/archive/refs/tags/3.1.28.tar.gz"],
108108
)
109109

110110
load("@emsdk//:deps.bzl", emsdk_deps = "deps")
@@ -124,9 +124,9 @@ load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
124124
# xnnpack used for fast vectorized wasm operations
125125
git_repository(
126126
name = "xnnpack",
127-
commit = "fa94f297e58c1e139ca64f78786df3744f557819",
127+
commit = "5e8033a72a8d0f1c2b1f06e29137cc697c6b661d",
128128
remote = "https://github.com/google/XNNPACK.git",
129-
shallow_since = "1683912990 -0700",
129+
shallow_since = "1643627844 -0800",
130130
)
131131

132132
# The libraries below are transitive dependencies of XNNPACK that we need to
@@ -136,10 +136,10 @@ git_repository(
136136
http_archive(
137137
name = "FP16",
138138
build_file = "@xnnpack//third_party:FP16.BUILD",
139-
sha256 = "e66e65515fa09927b348d3d584c68be4215cfe664100d01c9dbc7655a5716d70",
140-
strip_prefix = "FP16-0a92994d729ff76a58f692d3028ca1b64b145d91",
139+
sha256 = "0d56bb92f649ec294dbccb13e04865e3c82933b6f6735d1d7145de45da700156",
140+
strip_prefix = "FP16-3c54eacb74f6f5e39077300c5564156c424d77ba",
141141
urls = [
142-
"https://github.com/Maratyszcza/FP16/archive/0a92994d729ff76a58f692d3028ca1b64b145d91.zip",
142+
"https://github.com/Maratyszcza/FP16/archive/3c54eacb74f6f5e39077300c5564156c424d77ba.zip",
143143
],
144144
)
145145

@@ -156,35 +156,61 @@ http_archive(
156156
# pthreadpool library, used for parallelization
157157
http_archive(
158158
name = "pthreadpool",
159-
sha256 = "e6370550a1abf1503daf3c2c196e0a1c2b253440c39e1a57740ff49af2d8bedf",
160-
strip_prefix = "pthreadpool-43edadc654d6283b4b6e45ba09a853181ae8e850",
159+
sha256 = "8461f6540ae9f777ce20d1c0d1d249e5e61c438744fb390c0c6f91940aa69ea3",
160+
strip_prefix = "pthreadpool-545ebe9f225aec6dca49109516fac02e973a3de2",
161161
urls = [
162-
"https://github.com/Maratyszcza/pthreadpool/archive/43edadc654d6283b4b6e45ba09a853181ae8e850.zip",
162+
"https://github.com/Maratyszcza/pthreadpool/archive/545ebe9f225aec6dca49109516fac02e973a3de2.zip",
163+
],
164+
)
165+
166+
# clog library, used for logging
167+
http_archive(
168+
name = "clog",
169+
build_file = "@xnnpack//third_party:clog.BUILD",
170+
sha256 = "3f2dc1970f397a0e59db72f9fca6ff144b216895c1d606f6c94a507c1e53a025",
171+
strip_prefix = "cpuinfo-d5e37adf1406cf899d7d9ec1d317c47506ccb970",
172+
urls = [
173+
"https://github.com/pytorch/cpuinfo/archive/d5e37adf1406cf899d7d9ec1d317c47506ccb970.tar.gz",
163174
],
164175
)
165176

166177
# cpuinfo library, used for detecting processor characteristics
167178
http_archive(
168179
name = "cpuinfo",
169-
sha256 = "ba668f9f8ea5b4890309b7db1ed2e152aaaf98af6f9a8a63dbe1b75c04e52cb9",
170-
strip_prefix = "cpuinfo-3dc310302210c1891ffcfb12ae67b11a3ad3a150",
180+
build_file = "@xnnpack//third_party:cpuinfo.BUILD",
181+
patches = ["@xnnpack//third_party:cpuinfo.patch"],
182+
sha256 = "a7f9a188148a1660149878f737f42783e72f33a4f842f3e362fee2c981613e53",
183+
strip_prefix = "cpuinfo-ed8b86a253800bafdb7b25c5c399f91bff9cb1f3",
171184
urls = [
172-
"https://github.com/pytorch/cpuinfo/archive/3dc310302210c1891ffcfb12ae67b11a3ad3a150.zip",
185+
"https://github.com/pytorch/cpuinfo/archive/ed8b86a253800bafdb7b25c5c399f91bff9cb1f3.zip",
173186
],
174187
)
175188

176-
# Google Test framework, used by most unit-tests.
189+
# psimd library, used for fallback 128-bit SIMD micro-kernels
177190
http_archive(
191+
name = "psimd",
192+
build_file = "@xnnpack//third_party:psimd.BUILD",
193+
sha256 = "dc615342bcbe51ca885323e51b68b90ed9bb9fa7df0f4419dbfa0297d5e837b7",
194+
strip_prefix = "psimd-072586a71b55b7f8c584153d223e95687148a900",
195+
urls = [
196+
"https://github.com/Maratyszcza/psimd/archive/072586a71b55b7f8c584153d223e95687148a900.zip",
197+
],
198+
)
199+
200+
git_repository(
178201
name = "com_google_googletest",
179-
sha256 = "5cb522f1427558c6df572d6d0e1bf0fd076428633d080e88ad5312be0b6a8859",
180-
strip_prefix = "googletest-e23cdb78e9fef1f69a9ef917f447add5638daf2a",
181-
urls = ["https://github.com/google/googletest/archive/e23cdb78e9fef1f69a9ef917f447add5638daf2a.zip"],
202+
commit = "cd17fa2abda2a2e4111cdabd62a87aea16835014",
203+
remote = "https://github.com/google/googletest.git",
204+
shallow_since = "1570558426 -0400",
182205
)
183206

184207
http_archive(
185208
name = "rules_cc",
186-
strip_prefix = "rules_cc-main",
187-
urls = ["https://github.com/bazelbuild/rules_cc/archive/main.zip"],
209+
sha256 = "90d5a66950b492cbf86201cdc49c4b59796a85a4eb9fd63c07afe5f7132ea623",
210+
strip_prefix = "rules_cc-8346df34b6593b051403b8e429db15c7f4ead937",
211+
urls = [
212+
"https://github.com/bazelbuild/rules_cc/archive/8346df34b6593b051403b8e429db15c7f4ead937.zip",
213+
],
188214
)
189215

190216
http_archive(

tfjs-backend-wasm/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414
"jsdelivr": "dist/tf-backend-wasm.min.js",
1515
"miniprogram": "dist/miniprogram",
1616
"scripts": {
17-
"build": "bazel build -c opt --config=xnnpack-opt :tfjs-backend-wasm_pkg",
17+
"build": "bazel build -c opt :tfjs-backend-wasm_pkg",
1818
"build-dbg": "bazel build -c dbg :tfjs-backend-wasm_pkg",
19-
"publish-npm": "bazel run -c opt --config=xnnpack-opt :tfjs-backend-wasm_pkg.publish",
19+
"publish-npm": "bazel run -c opt :tfjs-backend-wasm_pkg.publish",
2020
"clean": "bazel clean --expunge",
2121
"cpplint": "./scripts/cpplint.js",
2222
"test": "bazel test -c dbg :tests --test_output=all",

tfjs-backend-wasm/src/cc/backend.h

-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ const size_t num_tensors();
9292
extern size_t xnn_operator_count;
9393

9494
extern pthreadpool *threadpool;
95-
9695
} // namespace backend
9796

9897
namespace wasm {

tfjs-backend-wasm/src/cc/batch_mat_mul_impl.cc

+1-2
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,7 @@ void xnn_matmul(const size_t a_id, const size_t* a_shape_ptr,
128128
const uint32_t flags = XNN_FLAG_TRANSPOSE_WEIGHTS;
129129
xnn_status status = xnn_create_fully_connected_nc_f32(
130130
input_channels, output_channels, input_stride, output_stride, b_buf,
131-
bias_buf, output_min, output_max, flags,
132-
/*code_cache=*/nullptr, /*weights_cache=*/nullptr, &fully_connected_op);
131+
bias_buf, output_min, output_max, flags, &fully_connected_op);
133132
if (status != xnn_status_success) {
134133
tfjs::util::warn(
135134
"XNN status for xnn_create_fully_connected_nc_f32 is not successful. "

tfjs-backend-wasm/src/cc/conv2d_impl.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ void conv2d(const size_t x_id, const size_t batch_size,
236236
stride_height, stride_width, dilation_height, dilation_width, groups,
237237
group_input_channels, group_output_channels, input_pixel_stride,
238238
output_pixel_stride, filter_xnn, bias_buf, output_min, output_max,
239-
flags, /*code_cache=*/nullptr, /*weights_cache=*/nullptr, &conv2d_op);
239+
flags, &conv2d_op);
240240
if (status != xnn_status_success) {
241241
util::warn(
242242
"XNN status for xnn_create_convolution2d_nhwc_f32 is not successful. "

tfjs-backend-wasm/src/cc/prelu_impl.cc

+2-3
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,8 @@ void prelu(const float* x_buf, const size_t x_size, const size_t weights_id,
6060
const size_t strides = channels;
6161

6262
const uint32_t flags = 0;
63-
xnn_status status = xnn_create_prelu_nc_f32(
64-
channels, strides, strides, weights_buf, flags,
65-
/*code_cache=*/nullptr, /*weights_cache=*/nullptr, &prelu_op);
63+
xnn_status status = xnn_create_prelu_nc_f32(channels, strides, strides,
64+
weights_buf, flags, &prelu_op);
6665
if (status != xnn_status_success) {
6766
util::warn(
6867
"XNN status for xnn_create_prelu_nc_f32 is not successful. Got "

0 commit comments

Comments
 (0)