forked from tensorflow/tfjs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
BUILD.bazel
116 lines (106 loc) · 3.19 KB
/
BUILD.bazel
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# Copyright 2021 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# =============================================================================
load("@bazel_skylib//rules:copy_file.bzl", "copy_file")
load("@build_bazel_rules_nodejs//:index.bzl", "pkg_npm")
load("//tools:copy_to_dist.bzl", "copy_to_dist", "copy_ts_library_to_dist")
load("//tools:tfjs_bundle.bzl", "tfjs_bundle")
load("//tools:tfjs_web_test.bzl", "tfjs_web_test")
package(default_visibility = ["//visibility:public"])
tfjs_bundle(
name = "tf-backend-webgpu",
entry_point = "//tfjs-backend-webgpu/src:index.ts",
external = [
"@tensorflow/tfjs-core",
"@webgpu/types",
"node-fetch",
"util",
],
globals = {
"@tensorflow/tfjs-core": "tf",
},
umd_name = "tf",
deps = [
"//tfjs-backend-webgpu/src:tfjs-backend-webgpu_lib",
"//tfjs-backend-webgpu/src:tfjs-backend-webgpu_src_lib",
],
)
copy_ts_library_to_dist(
name = "copy_src_to_dist",
srcs = [
"//tfjs-backend-webgpu/src:tfjs-backend-webgpu_lib",
"//tfjs-backend-webgpu/src:tfjs-backend-webgpu_src_lib",
],
root = "src",
)
copy_to_dist(
name = "copy_bundles",
srcs = [
":tf-backend-webgpu",
":tf-backend-webgpu.es2017",
":tf-backend-webgpu.es2017.min",
":tf-backend-webgpu.fesm",
":tf-backend-webgpu.fesm.min",
":tf-backend-webgpu.min",
":tf-backend-webgpu.node",
],
)
copy_file(
name = "copy_miniprogram",
src = ":tf-backend-webgpu.min.js",
out = "dist/miniprogram/index.js",
)
copy_file(
name = "copy_miniprogram_map",
src = ":tf-backend-webgpu.min.js.map",
out = "dist/miniprogram/index.js.map",
)
pkg_npm(
name = "tfjs-backend-webgpu_pkg",
package_name = "@tensorflow/tfjs-backend-webgpu",
srcs = [
"README.md",
"package.json",
],
tags = ["ci"],
deps = [
":copy_bundles",
":copy_miniprogram",
":copy_miniprogram_map",
":copy_src_to_dist",
],
)
STATIC_FILES = [
# Listed here so sourcemaps are served
"//tfjs-backend-webgpu/src:tfjs-backend-webgpu_test_bundle",
]
tfjs_web_test(
name = "tfjs-backend-webgpu_test",
srcs = [
"//tfjs-backend-webgpu/src:tfjs-backend-webgpu_test_bundle",
],
args = [
"--testEnv",
"webgpu",
"--flags",
'{"WEBGPU_CPU_FORWARD": false}',
],
browsers = [],
local_browser = select({
"@bazel_tools//src/conditions:linux_x86_64": "chrome_webgpu_linux",
"@bazel_tools//src/conditions:windows": "chrome_webgpu",
"//conditions:default": "chrome_webgpu",
}),
static_files = STATIC_FILES,
)