Skip to content

Commit 9d7436c

Browse files
authored
Merge branch 'master' into TFS_Load_TfLite_BE
2 parents 9d2bac0 + d63e1b1 commit 9d7436c

122 files changed

Lines changed: 1424 additions & 758 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.bazelrc

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,20 @@ build:cuda --@local_config_cuda//:enable_cuda
1111
build:cuda_clang --config=cuda
1212
build:cuda_clang --copt=-Wno-gnu-offsetof-extensions
1313
build:cuda_clang --copt=-Wno-error=unused-command-line-argument
14+
build --linkopt=-Wno-unused-command-line-argument
15+
build --host_linkopt=-Wno-unused-command-line-argument
1416
build:cuda_clang --host_copt=-Wno-error=unused-command-line-argument
1517
build:cuda_clang --repo_env TF_NEED_TENSORRT=0
1618
build:cuda_clang --action_env=TF_CUDA_CLANG="1"
1719
build:cuda_clang --@local_config_cuda//:cuda_compiler=clang
18-
build:cuda_clang --repo_env=TF_CUDA_COMPUTE_CAPABILITIES="sm_60,sm_70,sm_80,compute_90"
20+
build:cuda_clang --repo_env=TF_CUDA_COMPUTE_CAPABILITIES="sm_60,sm_70,sm_80,sm_89,compute_90"
1921

20-
build:cuda_clang --repo_env=HERMETIC_CUDA_VERSION="12.2.0"
21-
build:cuda_clang --repo_env=HERMETIC_CUDNN_VERSION="8.9.4.25"
22+
build:cuda_clang --repo_env=HERMETIC_CUDA_VERSION="12.5.1"
23+
build:cuda_clang --repo_env=HERMETIC_CUDNN_VERSION="9.3.0"
24+
build:cuda_clang --repo_env=HERMETIC_NVSHMEM_VERSION="3.2.5"
2225
build:cuda_clang --action_env=GCC_HOST_COMPILER_PATH="/usr/bin/gcc-10"
2326
build:cuda_clang --action_env=CLANG_CUDA_COMPILER_PATH="/usr/lib/llvm-17/bin/clang"
2427

25-
build:kokoro --repo_env=CC="/usr/bin/gcc-10"
26-
build:kokoro --action_env=CC="/usr/bin/gcc-10"
27-
2828
# Options used to build with TPU support.
2929
build:tpu --define=with_tpu_support=true --define=framework_shared_object=false
3030
build:tpu --copt=-DLIBTPU_ON_GCE
@@ -110,4 +110,16 @@ build --copt=-Wno-unused-but-set-variable # due to `ifdefs` in ml_dtypes
110110
# Revert to the legacy WORKSPACE dependency resolution system
111111
# and disable Bzlmod.
112112
common --enable_bzlmod=false
113-
common --noincompatible_enable_cc_toolchain_resolution
113+
common --incompatible_enable_cc_toolchain_resolution
114+
common --repo_env USE_HERMETIC_CC_TOOLCHAIN=1
115+
common --repo_env=HERMETIC_PYTHON_VERSION="3.10"
116+
build --features=-layering_check
117+
build --define=framework_shared_object=false
118+
build --dynamic_mode=off
119+
120+
121+
common:clang_local --noincompatible_enable_cc_toolchain_resolution
122+
common:clang_local --noincompatible_enable_android_toolchain_resolution
123+
common:clang_local --@rules_ml_toolchain//cc_toolchain/config:enable_hermetic_cc=False
124+
common:clang_local --repo_env USE_HERMETIC_CC_TOOLCHAIN=0
125+

WORKSPACE

Lines changed: 97 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,17 @@ local_repository(
2424
load("//tensorflow_serving:repo.bzl", "tensorflow_http_archive")
2525
tensorflow_http_archive(
2626
name = "org_tensorflow",
27-
sha256 = "e2dea5a1873f900a6af48ae16eccc20b275b5f3edd5b1a3b47da3feadfb513d9",
28-
git_commit = "5fb3b1fefda9320202da184752a3366fbeddfeac",
27+
sha256 = "86150d55ce57b2298d8ed42caa7b91c466ad33d9f7f347117c2257cc576d3413",
28+
git_commit = "72fbba3d20f4616d7312b5e2b7f79daf6e82f2fa",
2929
patch = "//third_party/tensorflow:tensorflow.patch",
30+
patch_cmds = [
31+
"sed -i '/cc_library = _cc_library/d' tensorflow/core/platform/rules_cc.bzl",
32+
"echo -e \"\\ndef cc_library_oss(deps=[], **kwargs):\\n if kwargs.get(\\\"name\\\") == \\\"lib_internal_impl\\\" or \\\"protobuf\\\" in kwargs.get(\\\"name\\\", \\\"\\\"):\\n _cc_library(deps = deps, **kwargs)\\n return\\n if type(deps) == \\\"list\\\":\\n if \\\"@com_google_protobuf//:protobuf\\\" not in deps:\\n deps = deps + [\\\"@com_google_protobuf//:protobuf\\\"]\\n else:\\n deps = deps + [\\\"@com_google_protobuf//:protobuf\\\"]\\n _cc_library(deps = deps, **kwargs)\\ncc_library = cc_library_oss\" >> tensorflow/core/platform/rules_cc.bzl",
33+
"sed -i 's#deps = \\[op_gen\\] + deps#deps = [op_gen] + deps + [clean_dep(\"//tensorflow/core/framework:kernel_shape_util\"), clean_dep(\"//tensorflow/core/framework:full_type_util\")]#' tensorflow/tensorflow.bzl",
34+
"sed -i '/name = \"kernel_shape_util\",/a \\ visibility = [\"//visibility:public\"],' tensorflow/core/framework/BUILD",
35+
"echo -e '\\nalias(name = \"tensorflow_libtensorflow_framework\", actual = \"//tensorflow/core:tensorflow\", visibility = [\"//visibility:public\"])' >> BUILD",
36+
"echo -e '\\nalias(name = \"tensorflow_tf_header_lib\", actual = \"//tensorflow/core:tensorflow\", visibility = [\"//visibility:public\"])' >> BUILD",
37+
],
3038
)
3139

3240
# Import all of TensorFlow Serving's external dependencies.
@@ -44,10 +52,10 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
4452

4553
http_archive(
4654
name = "bazel_skylib",
47-
sha256 = "74d544d96f4a5bb630d465ca8bbcfe231e3594e5aae57e1edbf17a6eb3ca2506",
55+
sha256 = "97e709db2e97b646263b5c5e83e3b00de48c1ae55b9e421e3b5e3f9467d02a3a",
4856
urls = [
49-
"https://storage.googleapis.com/mirror.tensorflow.org/github.com/bazelbuild/bazel-skylib/releases/download/1.3.0/bazel-skylib-1.3.0.tar.gz",
50-
"https://github.com/bazelbuild/bazel-skylib/releases/download/1.3.0/bazel-skylib-1.3.0.tar.gz",
57+
"https://storage.googleapis.com/mirror.tensorflow.org/github.com/bazelbuild/bazel-skylib/releases/download/1.8.0/bazel-skylib-1.8.0.tar.gz",
58+
"https://github.com/bazelbuild/bazel-skylib/releases/download/1.8.0/bazel-skylib-1.8.0.tar.gz",
5159
],
5260
)
5361

@@ -58,34 +66,54 @@ http_archive(
5866
url = "https://github.com/bazelbuild/rules_cc/releases/download/0.1.5/rules_cc-0.1.5.tar.gz",
5967
)
6068

61-
http_archive(
62-
name = "rules_python",
63-
sha256 = "84aec9e21cc56fbc7f1335035a71c850d1b9b5cc6ff497306f84cced9a769841",
64-
strip_prefix = "rules_python-0.23.1",
65-
url = "https://github.com/bazelbuild/rules_python/releases/download/0.23.1/rules_python-0.23.1.tar.gz",
69+
# Initialize hermetic Python
70+
load("@org_tensorflow//third_party/py:python_init_rules.bzl", "python_init_rules")
71+
python_init_rules()
72+
73+
load("@org_tensorflow//third_party/py:python_init_repositories.bzl", "python_init_repositories")
74+
python_init_repositories(
75+
default_python_version = "system",
76+
requirements = {
77+
"3.10": "@org_tensorflow//:requirements_lock_3_10.txt",
78+
"3.11": "@org_tensorflow//:requirements_lock_3_11.txt",
79+
"3.12": "@org_tensorflow//:requirements_lock_3_12.txt",
80+
"3.13": "@org_tensorflow//:requirements_lock_3_13.txt",
81+
"3.14": "@org_tensorflow//:requirements_lock_3_14.txt",
82+
},
6683
)
6784

68-
load("@rules_python//python:repositories.bzl", "python_register_toolchains")
85+
load("@org_tensorflow//third_party/py:python_init_toolchains.bzl", "python_init_toolchains")
86+
python_init_toolchains()
6987

70-
load(
71-
"@rules_python//python:repositories.bzl",
72-
"py_repositories",
73-
"python_register_toolchains",
88+
load("@org_tensorflow//third_party/py:python_init_pip.bzl", "python_init_pip")
89+
python_init_pip()
90+
91+
load("@pypi//:requirements.bzl", "install_deps")
92+
install_deps()
93+
94+
# Toolchains for ML projects hermetic builds.
95+
# Details: https://github.com/google-ml-infra/rules_ml_toolchain
96+
http_archive(
97+
name = "rules_ml_toolchain",
98+
sha256 = "de3b14418657eeacd8afc2aa89608be6ec8d66cd6a5de81c4f693e77bc41bee1",
99+
strip_prefix = "rules_ml_toolchain-5653e5a0ca87c1272069b4b24864e55ce7f129a1",
100+
urls = [
101+
"https://storage.googleapis.com/mirror.tensorflow.org/github.com/google-ml-infra/rules_ml_toolchain/archive/5653e5a0ca87c1272069b4b24864e55ce7f129a1.tar.gz",
102+
"https://github.com/google-ml-infra/rules_ml_toolchain/archive/5653e5a0ca87c1272069b4b24864e55ce7f129a1.tar.gz",
103+
],
74104
)
75-
py_repositories()
76105

77106
load(
78-
"@org_tensorflow//tensorflow/tools/toolchains/python:python_repo.bzl",
79-
"python_repository",
107+
"@rules_ml_toolchain//cc_toolchain/deps:cc_toolchain_deps.bzl",
108+
"cc_toolchain_deps",
80109
)
81-
python_repository(name = "python_version_repo")
82-
load("@python_version_repo//:py_version.bzl", "HERMETIC_PYTHON_VERSION")
83110

84-
python_register_toolchains(
85-
name = "python",
86-
ignore_root_user_error = True,
87-
python_version = HERMETIC_PYTHON_VERSION,
88-
)
111+
cc_toolchain_deps()
112+
113+
register_toolchains("@rules_ml_toolchain//cc_toolchain:lx64_lx64")
114+
register_toolchains("@rules_ml_toolchain//cc_toolchain:lx64_lx64_cuda")
115+
# register_toolchains("@rules_ml_toolchain//cc_toolchain:la64_la64")
116+
# register_toolchains("@rules_ml_toolchain//cc_toolchain:la64_la64_cuda")
89117

90118
# Initialize TensorFlow's external dependencies.
91119
load("@org_tensorflow//tensorflow:workspace3.bzl", "tf_workspace3")
@@ -101,10 +129,20 @@ tf_workspace0()
101129
load("@rules_pkg//:deps.bzl", "rules_pkg_dependencies")
102130
rules_pkg_dependencies()
103131

104-
load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies", "rules_proto_toolchains")
132+
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
133+
134+
http_archive(
135+
name = "rules_shell",
136+
sha256 = "0d0c56d01c3c40420bf7bf14d73113f8a92fbd9f5cd13205a3b89f72078f0321",
137+
strip_prefix = "rules_shell-0.1.1",
138+
urls = [
139+
"https://github.com/bazelbuild/rules_shell/releases/download/v0.1.1/rules_shell-v0.1.1.tar.gz",
140+
],
141+
)
142+
143+
load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies")
105144

106145
rules_proto_dependencies()
107-
rules_proto_toolchains()
108146

109147
load(
110148
"@local_xla//third_party/py:python_wheel.bzl",
@@ -114,7 +152,7 @@ load(
114152
python_wheel_version_suffix_repository(name = "tf_wheel_version_suffix")
115153

116154
load(
117-
"@local_xla//third_party/gpus/cuda/hermetic:cuda_json_init_repository.bzl",
155+
"@rules_ml_toolchain//third_party/gpus/cuda/hermetic:cuda_json_init_repository.bzl",
118156
"cuda_json_init_repository",
119157
)
120158

@@ -126,7 +164,7 @@ load(
126164
"CUDNN_REDISTRIBUTIONS",
127165
)
128166
load(
129-
"@local_xla//third_party/gpus/cuda/hermetic:cuda_redist_init_repositories.bzl",
167+
"@rules_ml_toolchain//third_party/gpus/cuda/hermetic:cuda_redist_init_repositories.bzl",
130168
"cuda_redist_init_repositories",
131169
"cudnn_redist_init_repository",
132170
)
@@ -140,23 +178,50 @@ cudnn_redist_init_repository(
140178
)
141179

142180
load(
143-
"@local_xla//third_party/gpus/cuda/hermetic:cuda_configure.bzl",
181+
"@rules_ml_toolchain//third_party/gpus/cuda/hermetic:cuda_configure.bzl",
144182
"cuda_configure",
145183
)
146184

147185
cuda_configure(name = "local_config_cuda")
148186

149187
load(
150-
"@local_xla//third_party/nccl/hermetic:nccl_redist_init_repository.bzl",
188+
"@rules_ml_toolchain//third_party/nccl/hermetic:nccl_redist_init_repository.bzl",
151189
"nccl_redist_init_repository",
152190
)
153191

154192
nccl_redist_init_repository()
155193

156194
load(
157-
"@local_xla//third_party/nccl/hermetic:nccl_configure.bzl",
195+
"@rules_ml_toolchain//third_party/nccl/hermetic:nccl_configure.bzl",
158196
"nccl_configure",
159197
)
160198

161199
nccl_configure(name = "local_config_nccl")
162200

201+
load(
202+
"@rules_ml_toolchain//third_party/nvshmem/hermetic:nvshmem_json_init_repository.bzl",
203+
"nvshmem_json_init_repository",
204+
)
205+
206+
nvshmem_json_init_repository()
207+
208+
load(
209+
"@nvshmem_redist_json//:distributions.bzl",
210+
"NVSHMEM_REDISTRIBUTIONS",
211+
)
212+
load(
213+
"@rules_ml_toolchain//third_party/nvshmem/hermetic:nvshmem_redist_init_repository.bzl",
214+
"nvshmem_redist_init_repository",
215+
)
216+
217+
nvshmem_redist_init_repository(
218+
nvshmem_redistributions = NVSHMEM_REDISTRIBUTIONS,
219+
)
220+
221+
load(
222+
"@rules_ml_toolchain//third_party/nvshmem/hermetic:nvshmem_configure.bzl",
223+
"nvshmem_configure",
224+
)
225+
226+
nvshmem_configure(name = "local_config_nvshmem")
227+

tensorflow_serving/apis/predict.proto

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,11 @@ message PredictRequest {
7272
// but will not return them in the response.
7373
repeated int64 return_stoptokens = 4;
7474

75+
// Only supported in disaggregated serving. When set, returns all stop
76+
// tokens in response if the model stops at them. Overrides
77+
// return_stoptokens.
78+
optional bool return_all_stoptokens = 9;
79+
7580
// When set and supported by servable, the model server will cache the
7681
// prefix of request up to this length.
7782
optional int64 max_cache_length = 6;
@@ -92,7 +97,6 @@ message PredictStreamedOptions {
9297
// CANCEL is used for early termination of a stream. It can be sent anytime to
9398
// cancel the stream.
9499
//
95-
//
96100
// SPLIT is used when multiple streamed requests are used to generate a
97101
// logical request. END_SPLIT should be called for the last split of the
98102
// multi-turn request to start the processing of the current turn. NONE can

tensorflow_serving/batching/BUILD

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ load("@rules_cc//cc:cc_test.bzl", "cc_test")
55

66
package(
77
default_visibility = ["//tensorflow_serving:internal"],
8-
features = ["-layering_check"],
8+
features = ["layering_check"],
99
)
1010

1111
licenses(["notice"])
@@ -44,6 +44,7 @@ cc_test(
4444
":streaming_batch_scheduler",
4545
"//tensorflow_serving/core/test_util:test_main",
4646
"@com_google_absl//absl/synchronization",
47+
"@com_google_googletest//:gtest",
4748
"@org_tensorflow//tensorflow/core:lib",
4849
"@org_tensorflow//tensorflow/core:protos_all_cc",
4950
"@org_tensorflow//tensorflow/core:test",
@@ -123,6 +124,7 @@ cc_test(
123124
"//tensorflow_serving/core/test_util:test_main",
124125
"//tensorflow_serving/servables/tensorflow:serving_session",
125126
"//tensorflow_serving/test_util",
127+
"@com_google_absl//absl/log:check",
126128
"@com_google_absl//absl/synchronization",
127129
"@com_google_googletest//:gtest",
128130
"@org_tensorflow//tensorflow/cc/saved_model:loader",
@@ -155,6 +157,7 @@ cc_test(
155157
":batch_scheduler_retrier",
156158
"//tensorflow_serving/core/test_util:test_main",
157159
"@com_google_absl//absl/synchronization",
160+
"@com_google_googletest//:gtest",
158161
"@org_tensorflow//tensorflow/core:lib",
159162
"@org_tensorflow//tensorflow/core:protos_all_cc",
160163
"@org_tensorflow//tensorflow/core:test",
@@ -182,9 +185,9 @@ cc_test(
182185
deps = [
183186
":batching_util",
184187
"//tensorflow_serving/core/test_util:test_main",
188+
"@com_google_googletest//:gtest",
185189
"@org_tensorflow//tensorflow/core:framework",
186190
"@org_tensorflow//tensorflow/core:lib",
187-
"@org_tensorflow//tensorflow/core:protos_all_cc",
188191
],
189192
)
190193

@@ -198,6 +201,7 @@ cc_test(
198201
"@com_google_absl//absl/time",
199202
"@org_tensorflow//tensorflow/core:lib",
200203
"@org_tensorflow//tensorflow/core:test",
204+
"@org_tensorflow//tensorflow/core/platform",
201205
],
202206
)
203207

@@ -241,6 +245,7 @@ cc_test(
241245
"//tensorflow_serving/core/test_util:test_main",
242246
"//tensorflow_serving/servables/tensorflow/test_util:mock_tfrt_saved_model",
243247
"@com_google_absl//absl/functional:bind_front",
248+
"@com_google_absl//absl/log:check",
244249
"@com_google_googletest//:gtest",
245250
"@org_tensorflow//tensorflow/core:lib",
246251
"@org_tensorflow//tensorflow/core:test",

0 commit comments

Comments
 (0)