-
Notifications
You must be signed in to change notification settings - Fork 214
/
Copy path.bazelrc
262 lines (215 loc) · 12.4 KB
/
.bazelrc
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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
#
# Copyright (c) 2020 Intel Corporation
#
# 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.
#
# Optimizations used for TF Serving release builds.
build:release --copt=-mavx
build:release --copt=-msse4.2
# Options used to build with CUDA.
build:cuda --crosstool_top=@local_config_cuda//crosstool:toolchain
build:cuda --define=using_cuda=true --define=using_cuda_nvcc=true
# Please note that MKL on MacOS or windows is still not supported.
# If you would like to use a local MKL instead of downloading, please set the
# environment variable "TF_MKL_ROOT" every time before build.
build:mkl --define=build_with_mkl=true --define=enable_mkl=true
build:mkl --define=tensorflow_mkldnn_contraction_kernel=0
# This config option is used to enable MKL-DNN open source library only,
# without depending on MKL binary version.
build:mkl_open_source_only --define=build_with_mkl_dnn_only=true
build:mkl_open_source_only --define=build_with_mkl=true --define=enable_mkl=true
build:mkl_open_source_only --define=tensorflow_mkldnn_contraction_kernel=0
# Processor native optimizations (depends on build host capabilities).
build:nativeopt --copt=-march=native
build:nativeopt --host_copt=-march=native
build:nativeopt --copt=-O3
# those below are required for XNNPACK build with gcc <12 (ubuntu 22 default is 11)
build --define=xnn_enable_avxvnniint8=false
build --define=xnn_enable_avx512fp16=false
build --define=xnn_enable_avx512amx=false
build --define xnn_enable_avxvnni=false
# TODO to check
build --define=no_cuda=1
build --spawn_strategy=standalone
build --genrule_strategy=standalone
build --define=grpc_no_ares=true
# Default select settings
build --define=MEDIAPIPE_DISABLE_GPU=1
build --define=MEDIAPIPE_DISABLE=0
build --define=CLOUD_DISABLE=0
build --define=PYTHON_DISABLE=0
# Sets the default Apple platform to macOS.
build --apple_platform_type=macos
build -c opt
# fixing debug builds with ignore warnings
build --copt=-O2
build --copt=-DGRPC_BAZEL_BUILD
# Adding "--cxxopt=-D_GLIBCXX_USE_CXX11_ABI=0" creates parity with TF
# compilation options. It also addresses memory use due to
# copy-on-write semantics of std::strings of the older ABI.
build --cxxopt=-D_GLIBCXX_USE_CXX11_ABI=1
build --enable_platform_specific_config
build --experimental_repo_remote_exec
build --experimental_cc_shared_library
build --check_visibility=true
# Disable leaking LD_LIBRARY_PATH & PATH into build resulting in cache misses
# and frequent rebuilds
build --incompatible_strict_action_env
build --cxxopt=-DOVMS_DUMP_TO_FILE=0
build --remote_upload_local_results=true
build:avx_win --copt=/arch=AVX
build:avx2_win --copt=/arch=AVX2
# Linux settings #######################################################################################################
# LLVM, MLIR and TF require C++14, we use C++17 in project
build:linux --cxxopt=-std=c++17
build:linux --host_cxxopt=-std=c++17
# For Tensorflow building only
build:linux --action_env PYTHON_BIN_PATH="/usr/bin/python3"
build:linux --define PYTHON_BIN_PATH=/usr/bin/python3
# Security options ######################################################################################################
# TODO: Add equivalent windows flag
build:linux --cxxopt=-fno-strict-overflow
build:linux --cxxopt=-fno-delete-null-pointer-checks
build:linux --cxxopt=-fwrapv
build:linux --cxxopt=-fstack-protector
build:linux --cxxopt=-fstack-clash-protection
build:linux --cxxopt=-Wformat
build:linux --cxxopt=-Wformat-security
build:linux --cxxopt=-Werror=format-security
# TODO: Add equivalent windows flag
build:linux --force_pic
build:mp_on_py_on --config=linux
build:mp_on_py_on --define=MEDIAPIPE_DISABLE=0
build:mp_on_py_on --define=PYTHON_DISABLE=0
build:mp_on_py_on --disk_cache=/root/.cache/bazel_mp_on_py_on
build:mp_on_py_off --config=linux
build:mp_on_py_off --define=MEDIAPIPE_DISABLE=0
build:mp_on_py_off --define=PYTHON_DISABLE=1
build:mp_on_py_off --disk_cache=/root/.cache/bazel_mp_on_py_off
build:mp_off_py_off --config=linux
build:mp_off_py_off --define=MEDIAPIPE_DISABLE=1
build:mp_off_py_off --define=PYTHON_DISABLE=1
build:mp_off_py_off --disk_cache=/root/.cache/bazel_mp_off_py_off
#build --remote_header=x-build-event-log=DEBUG
# Coverity needs remote and disk cache disabled
build:coverity --config=mp_on_py_on
build:coverity --disk_cache=
# Windows settings ######################################################################################################
# Configure short or long logs
build:short_logs --output_filter=DONT_MATCH_ANYTHING
build:verbose_logs --output_filter=
# Options to build TensorFlow 1.x or 2.x.
build:v1 --define=tf_api_version=1 --action_env=TF2_BEHAVIOR=0
build:v2 --define=tf_api_version=2 --action_env=TF2_BEHAVIOR=1
build:windows --host_cxxopt=/std:c++17
build:windows --cxxopt=/std:c++17
# TODO Windows: may impact python nodes execution
build:windows --noenable_bzlmod
# TF bazelrc settings
# TensorFlow Bazel configuration file.
build:windows --define=use_fast_cpp_protos=true
build:windows --define=allow_oversize_protos=true
# Make Bazel print out all options from rc files.
build:windows --announce_rc
build:windows --noincompatible_remove_legacy_whole_archive
build:windows --features=-force_no_whole_archive
# Enable XLA support by default.
build:windows --define=with_xla_support=true
# TODO(mihaimaruseac): Document this option or remove if no longer needed
build:windows --config=short_logs
# TODO(mihaimaruseac): Document this option or remove if no longer needed
build:windows --config=v2
# Disable AWS/HDFS support by default
build:windows --define=no_aws_support=true
build:windows --define=no_hdfs_support=true
# cc_shared_library ensures no library is linked statically more than once.
build:windows --experimental_link_static_libraries_once=false
# Prevent regressions on those two incompatible changes
# TODO: remove those flags when they are flipped in the default Bazel version TF uses.
build:windows --incompatible_enforce_config_setting_visibility
# Config to use a mostly-static build and disable modular op registration
# support (this will revert to loading TensorFlow with RTLD_GLOBAL in Python).
# By default, TensorFlow will build with a dependence on
# //tensorflow:libtensorflow_framework.so.
build:monolithic --define framework_shared_object=false
build:monolithic --define tsl_protobuf_header_only=false
# On windows, we still link everything into a single DLL - required by TF
build:windows --config=monolithic
build:windows --copt=/W0
build:windows --host_copt=/W0
# On Windows, `__cplusplus` is wrongly defined without this switch
# See https://devblogs.microsoft.com/cppblog/msvc-now-correctly-reports-__cplusplus/
build:windows --copt=/Zc:__cplusplus
build:windows --host_copt=/Zc:__cplusplus
# Tensorflow uses M_* math constants that only get defined by MSVC headers if
# _USE_MATH_DEFINES is defined.
build:windows --copt=/D_USE_MATH_DEFINES
build:windows --host_copt=/D_USE_MATH_DEFINES
# Windows has a relatively short command line limit, which TF has begun to hit.
# See https://docs.bazel.build/versions/main/windows.html
build:windows --features=compiler_param_file
build:windows --features=archive_param_file
# Speed Windows compile times. Available in VS 16.4 (we are on 16.11). See
# https://groups.google.com/a/tensorflow.org/d/topic/build/SsW98Eo7l3o/discussion
build:windows --copt=/d2ReducedOptimizeHugeFunctions
build:windows --host_copt=/d2ReducedOptimizeHugeFunctions
# Make sure to include as little of windows.h as possible
build:windows --copt=-DWIN32_LEAN_AND_MEAN
build:windows --host_copt=-DWIN32_LEAN_AND_MEAN
build:windows --copt=-DNOGDI
build:windows --host_copt=-DNOGDI
# MSVC (Windows): Standards-conformant preprocessor mode
# See https://docs.microsoft.com/en-us/cpp/preprocessor/preprocessor-experimental-overview
build:windows --copt=/Zc:preprocessor
build:windows --host_copt=/Zc:preprocessor
# Misc build options we need for windows.
build:windows --linkopt=/DEBUG
build:windows --host_linkopt=/DEBUG
build:windows --linkopt=/OPT:REF
build:windows --host_linkopt=/OPT:REF
build:windows --linkopt=/OPT:ICF
build:windows --host_linkopt=/OPT:ICF
build:windows --action_env PYTHON_BIN_PATH="C:/opt/Python311/python.exe"
build:windows --action_env PYTHON_LIB_PATH="C:/opt/Python311/lib/site-packages"
build:windows --repo_env PYTHON_BIN_PATH=C:/opt/Python311/python.exe
build:windows --python_path="C:/opt/Python311/python.exe"
build:windows:opt --copt=/arch:AVX
build:windows:opt --host_copt=/arch:AVX
build:windows --define=override_eigen_strong_inline=true
# Disable TFRT integration for now unless --config=tfrt is specified.
build:windows --deleted_packages=tensorflow/core/tfrt/stubs,tensorflow/compiler/mlir/tfrt,tensorflow/compiler/mlir/tfrt/benchmarks,tensorflow/compiler/mlir/tfrt/ir,tensorflow/compiler/mlir/tfrt/ir/mlrt,tensorflow/compiler/mlir/tfrt/jit/python_binding,tensorflow/compiler/mlir/tfrt/jit/transforms,tensorflow/compiler/mlir/tfrt/python_tests,tensorflow/compiler/mlir/tfrt/tests,tensorflow/compiler/mlir/tfrt/tests/mlrt,tensorflow/compiler/mlir/tfrt/tests/ir,tensorflow/compiler/mlir/tfrt/tests/analysis,tensorflow/compiler/mlir/tfrt/tests/jit,tensorflow/compiler/mlir/tfrt/tests/lhlo_to_tfrt,tensorflow/compiler/mlir/tfrt/tests/lhlo_to_jitrt,tensorflow/compiler/mlir/tfrt/tests/tf_to_corert,tensorflow/compiler/mlir/tfrt/tests/tf_to_tfrt_data,tensorflow/compiler/mlir/tfrt/tests/saved_model,tensorflow/compiler/mlir/tfrt/transforms/lhlo_gpu_to_tfrt_gpu,tensorflow/compiler/mlir/tfrt/transforms/mlrt,tensorflow/core/runtime_fallback,tensorflow/core/runtime_fallback/conversion,tensorflow/core/runtime_fallback/kernel,tensorflow/core/runtime_fallback/opdefs,tensorflow/core/runtime_fallback/runtime,tensorflow/core/runtime_fallback/util,tensorflow/core/tfrt/mlrt,tensorflow/core/tfrt/mlrt/attribute,tensorflow/core/tfrt/mlrt/kernel,tensorflow/core/tfrt/mlrt/bytecode,tensorflow/core/tfrt/mlrt/interpreter,tensorflow/compiler/mlir/tfrt/translate/mlrt,tensorflow/compiler/mlir/tfrt/translate/mlrt/testdata,tensorflow/core/tfrt/gpu,tensorflow/core/tfrt/run_handler_thread_pool,tensorflow/core/tfrt/runtime,tensorflow/core/tfrt/saved_model,tensorflow/core/tfrt/graph_executor,tensorflow/core/tfrt/saved_model/tests,tensorflow/core/tfrt/tpu,tensorflow/core/tfrt/utils,tensorflow/core/tfrt/utils/debug,tensorflow/core/tfrt/saved_model/python,tensorflow/core/tfrt/graph_executor/python
# Windows build ssl headers for GRPC workaround
build:windows --override_repository="boringssl=C:\\opt\\boringSSL-SwiftPM"
#Add this parameter for windows local builds, its added on jenkins via windows_build.bat. Must be short path on C:\ for mediapipe to compile
#startup --output_user_root=C:/b_tmp
# Windows config default flags
build:windows --define=CLOUD_DISABLE=1
build:windows --define=PYTHON_DISABLE=0
build:windows --define=MEDIAPIPE_DISABLE=0
# Change this path alongside WORKSPACE:"windows_openvino" path for model_api cmake compilation.
build:windows --action_env OpenVINO_DIR="c:/opt/openvino/runtime/cmake"
build:windows --action_env OpenCV_DIR="c:/opt/opencv"
build:windows --repo_env=HERMETIC_PYTHON_VERSION=3.11
build:windows --define=USE_DROGON=1
# Tests settings ############################################################################################################################
# sometimes failed logs exceed this threshold
test --experimental_ui_max_stdouterr_bytes=104857600
# envs below are required to succesfully run binaries in bazel as bazel is very strict in sandboxing
test:linux --test_env LD_LIBRARY_PATH=/opt/opencv/lib/:/opt/intel/openvino/runtime/lib/intel64/:/opt/intel/openvino/runtime/3rdparty/tbb/lib/
# genai hardcodes path during build time so without this so is not visible
test:linux --test_env OPENVINO_TOKENIZERS_PATH_GENAI=/opt/intel/openvino/runtime/lib/intel64/libopenvino_tokenizers.so
test:linux --test_env PYTHONPATH=/opt/intel/openvino/python:/ovms/bazel-bin/src/python/binding
# Bazelrc imports ############################################################################################################################
# file below should contain sth like
# build --remote_cache=http://IP:PORT
try-import %workspace%/.user.bazelrc