mirror of
https://github.com/google-ai-edge/LiteRT.git
synced 2026-01-09 06:21:22 +08:00
579 lines
24 KiB
Plaintext
579 lines
24 KiB
Plaintext
# LiteRT Bazel configuration file.
|
|
# This file tries to group and simplify build options for LiteRT
|
|
#
|
|
# ----CONFIG OPTIONS----
|
|
# Android options:
|
|
# android:
|
|
# android_arm:
|
|
# android_arm64:
|
|
# android_x86:
|
|
# android_x86_64:
|
|
#
|
|
# iOS options:
|
|
# ios:
|
|
# ios_armv7:
|
|
# ios_arm64:
|
|
# ios_x86_64:
|
|
# ios_fat:
|
|
#
|
|
# Macosx options
|
|
# darwin_arm64:
|
|
#
|
|
# Compiler options:
|
|
# avx_linux: Build with avx instruction set on linux.
|
|
# avx_win: Build with avx instruction set on windows
|
|
#
|
|
# Other build options:
|
|
# short_logs: Only log errors during build, skip warnings.
|
|
# verbose_logs: Show all compiler warnings during build.
|
|
# monolithic: Build all TF C++ code into a single shared object.
|
|
# dynamic_kernels: Try to link all kernels dynamically (experimental).
|
|
# dbg: Build with debug info
|
|
#
|
|
# TF version options;
|
|
# v2: Build TF v2
|
|
#
|
|
# Embedded Linux options (experimental and only tested with TFLite build yet)
|
|
# elinux: General Embedded Linux options shared by all flavors.
|
|
# elinux_aarch64: Embedded Linux options for aarch64 (ARM64) CPU support.
|
|
# elinux_armhf: Embedded Linux options for armhf (ARMv7) CPU support.
|
|
#
|
|
# Default build options. These are applied first and unconditionally.
|
|
|
|
build --incompatible_enable_cc_toolchain_resolution
|
|
build --repo_env USE_HERMETIC_CC_TOOLCHAIN=1
|
|
|
|
# TODO: Migrate for https://github.com/bazelbuild/bazel/issues/7260
|
|
build:clang_local --noincompatible_enable_cc_toolchain_resolution
|
|
build:clang_local --noincompatible_enable_android_toolchain_resolution
|
|
build:clang_local --repo_env USE_HERMETIC_CC_TOOLCHAIN=1
|
|
|
|
build --repo_env=USE_PYWRAP_RULES=True
|
|
build --copt=-DGRPC_BAZEL_BUILD
|
|
build --cxxopt=-std=gnu++17
|
|
build --cxxopt=-fpermissive
|
|
build --host_copt=-DGRPC_BAZEL_BUILD
|
|
build --host_cxxopt=-fpermissive
|
|
build --action_env=GRPC_BAZEL_RUNTIME=1
|
|
build --repo_env=PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=upb
|
|
build --action_env=PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=upb
|
|
|
|
# Some targets have the same py source file, but use different
|
|
# configurations via `requires-` tags. This results in an action
|
|
# conflict when precompiling. Disable to avoid that problem.
|
|
# See https://github.com/bazel-contrib/rules_python/issues/2445
|
|
build --@rules_python//python/config_settings:precompile=force_disabled
|
|
|
|
# Do not do this. This is how gRPC builds itself by default, but we don't want
|
|
# that as it would link protobuf into its own set of dynamic libraries, which
|
|
# would conflict with our protobuf linkage.
|
|
#build --define=use_fast_cpp_protos=true
|
|
|
|
# For projects which use TensorFlow as part of a Bazel build process, putting
|
|
# nothing in a bazelrc will default to a monolithic build. The following line
|
|
# opts in to modular op registration support by default.
|
|
build --define framework_shared_object=true
|
|
build --define tsl_protobuf_header_only=true
|
|
|
|
build --define=allow_oversize_protos=true
|
|
|
|
build --spawn_strategy=standalone
|
|
build -c opt
|
|
|
|
# Make Bazel print out all options from rc files.
|
|
build --announce_rc
|
|
|
|
# TODO(mihaimaruseac): Document this option or remove if no longer needed
|
|
build --define=grpc_no_ares=true
|
|
|
|
# See https://github.com/bazelbuild/bazel/issues/7362 for information on what
|
|
# --incompatible_remove_legacy_whole_archive flag does.
|
|
# This flag is set to true in Bazel 1.0 and newer versions. We tried to migrate
|
|
# Tensorflow to the default, however test coverage wasn't enough to catch the
|
|
# errors.
|
|
# There is ongoing work on Bazel team's side to provide support for transitive
|
|
# shared libraries. As part of migrating to transitive shared libraries, we
|
|
# hope to provide a better mechanism for control over symbol exporting, and
|
|
# then tackle this issue again.
|
|
#
|
|
# TODO: Remove the following two lines once TF doesn't depend on Bazel wrapping
|
|
# all library archives in -whole_archive -no_whole_archive.
|
|
build --noincompatible_remove_legacy_whole_archive
|
|
build --features=-force_no_whole_archive
|
|
build --host_features=-force_no_whole_archive
|
|
|
|
# TODO(mihaimaruseac): Document this option or remove if no longer needed
|
|
build --enable_platform_specific_config
|
|
|
|
# Enable XLA support by default.
|
|
build --define=with_xla_support=true
|
|
|
|
# TODO(mihaimaruseac): Document this option or remove if no longer needed
|
|
build --config=short_logs
|
|
|
|
# TF now has `cc_shared_library` targets, so it needs the experimental flag
|
|
# TODO(rostam): Remove when `cc_shared_library` is enabled by default
|
|
build --experimental_cc_shared_library
|
|
|
|
# cc_shared_library ensures no library is linked statically more than once.
|
|
build --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 --incompatible_enforce_config_setting_visibility
|
|
# TODO: also enable this flag after fixing the visibility violations
|
|
# build --incompatible_config_setting_private_default_visibility
|
|
|
|
# Compiler MLIR Builds
|
|
common --copt=-DMLIR_PYTHON_PACKAGE_PREFIX=ai_edge_litert.mlir.
|
|
common --copt=-DNB_DOMAIN=litert
|
|
|
|
# Use GitHub mirror for BCR to work around bcr.bazel.build outages
|
|
common --registry=https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/
|
|
|
|
# Default options should come above this line.
|
|
|
|
# Android configs. Bazel needs to have --cpu and --fat_apk_cpu both set to the
|
|
# target CPU to build transient dependencies correctly. See
|
|
# https://docs.bazel.build/versions/master/user-manual.html#flag--fat_apk_cpu
|
|
build:android --config=clang_local
|
|
build:android --crosstool_top=//external:android/crosstool
|
|
build:android --host_crosstool_top=@bazel_tools//tools/cpp:toolchain
|
|
build:android_arm --config=android
|
|
build:android_arm --cpu=armeabi-v7a
|
|
build:android_arm --fat_apk_cpu=armeabi-v7a
|
|
build:android_arm --platforms=@org_tensorflow//tensorflow/tools/toolchains/android:armeabi-v7a
|
|
build:android_arm64 --config=android
|
|
build:android_arm64 --cpu=arm64-v8a
|
|
build:android_arm64 --fat_apk_cpu=arm64-v8a
|
|
build:android_arm64 --platforms=@org_tensorflow//tensorflow/tools/toolchains/android:arm64-v8a
|
|
build:android_x86 --config=android
|
|
build:android_x86 --cpu=x86
|
|
build:android_x86 --fat_apk_cpu=x86
|
|
build:android_x86 --platforms=@org_tensorflow//tensorflow/tools/toolchains/android:x86
|
|
build:android_x86_64 --config=android
|
|
build:android_x86_64 --cpu=x86_64
|
|
build:android_x86_64 --fat_apk_cpu=x86_64
|
|
build:android_x86_64 --platforms=@org_tensorflow//tensorflow/tools/toolchains/android:x86_64
|
|
|
|
# Build everything statically for Android since all static libs are later
|
|
# bundled together into a single .so for deployment.
|
|
build:android --dynamic_mode=off
|
|
# TODO(belitskiy): Remove once on Clang 20.
|
|
build:android --define=xnn_enable_avxvnniint8=false
|
|
|
|
# Sets the default Apple platform to macOS.
|
|
build:macos --apple_platform_type=macos
|
|
|
|
# gRPC on MacOS requires this #define
|
|
build:macos --copt=-DGRPC_BAZEL_BUILD
|
|
|
|
# Avoid hitting command line argument limit
|
|
build:macos --features=archive_param_file
|
|
|
|
# Bazel 7.0.0 no longer supports dynamic symbol lookup on macOS. To resolve
|
|
# undefined symbol errors in macOS arm64 builds, explicitly add the necessary
|
|
# linker flags until dependencies are well defined. See
|
|
# https://github.com/bazelbuild/bazel/issues/19730.
|
|
build:macos --linkopt=-Wl,-undefined,dynamic_lookup
|
|
build:macos --host_linkopt=-Wl,-undefined,dynamic_lookup
|
|
|
|
# Use the Apple toolchain for MacOS builds.
|
|
build:macos --config=apple-toolchain
|
|
|
|
# Use cc toolchains from apple_support for Apple builds (ios, macos, etc).
|
|
# https://github.com/bazelbuild/apple_support/tree/master?tab=readme-ov-file#bazel-6-setup
|
|
build:apple-toolchain --config=clang_local
|
|
build:apple-toolchain --apple_crosstool_top=@local_config_apple_cc//:toolchain
|
|
build:apple-toolchain --crosstool_top=@local_config_apple_cc//:toolchain
|
|
build:apple-toolchain --host_crosstool_top=@local_config_apple_cc//:toolchain
|
|
|
|
# Wheel builds need the LiteRT runtime dylib linked into python extensions.
|
|
# This config overrides the macos default above.
|
|
build:macos_wheel --config=macos
|
|
build:macos_wheel --define=resolve_symbols_in_exec=false
|
|
build:macos_wheel --define=litert_macos_wheel_use_so=true
|
|
|
|
# Settings for MacOS on ARM CPUs.
|
|
build:macos_arm64 --config=macos
|
|
build:macos_arm64 --cpu=darwin_arm64
|
|
build:macos_arm64 --cxxopt=-std=gnu++17
|
|
build:macos_arm64 --macos_minimum_os=11.0
|
|
build:macos_arm64 --platforms=@build_bazel_apple_support//configs/platforms:darwin_arm64
|
|
|
|
# iOS configs for each architecture and the fat binary builds.
|
|
build:ios --apple_platform_type=ios
|
|
build:ios --copt=-fembed-bitcode
|
|
build:ios --copt=-Wno-c++11-narrowing
|
|
build:ios --config=apple-toolchain
|
|
build:ios_armv7 --config=ios
|
|
build:ios_armv7 --cpu=ios_armv7
|
|
build:ios_armv7 --platforms=@org_tensorflow//tensorflow/tools/toolchains/ios:ios_armv7
|
|
build:ios_arm64 --config=ios
|
|
build:ios_arm64 --cpu=ios_arm64
|
|
build:ios_arm64 --platforms=@build_bazel_apple_support//configs/platforms:ios_arm64
|
|
build:ios_arm64e --config=ios
|
|
build:ios_arm64e --cpu=ios_arm64e
|
|
build:ios_arm64e --platforms=@build_bazel_apple_support//configs/platforms:ios_arm64e
|
|
build:ios_sim_arm64 --config=ios
|
|
build:ios_sim_arm64 --cpu=ios_sim_arm64
|
|
build:ios_sim_arm64 --platforms=@build_bazel_apple_support//configs/platforms:ios_sim_arm64
|
|
build:ios_x86_64 --config=ios
|
|
build:ios_x86_64 --cpu=ios_x86_64
|
|
build:ios_x86_64 --platforms=@build_bazel_apple_support//configs/platforms:ios_x86_64
|
|
build:ios_fat --config=ios
|
|
build:ios_fat --ios_multi_cpus=armv7,arm64,i386,x86_64
|
|
|
|
# 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
|
|
build:monolithic --experimental_link_static_libraries_once=false # b/229868128
|
|
|
|
# Debug config
|
|
build:dbg -c dbg
|
|
# Only include debug info for files under tensorflow/, excluding kernels, to
|
|
# reduce the size of the debug info in the binary. This is because if the debug
|
|
# sections in the ELF binary are too large, errors can occur. See
|
|
# https://github.com/tensorflow/tensorflow/issues/48919.
|
|
# Users can still include debug info for a specific kernel, e.g. with:
|
|
# --config=dbg --per_file_copt=+tensorflow/core/kernels/identity_op.*@-g
|
|
# Since this .bazelrc file is synced between the tensorflow/tensorflow repo and
|
|
# the openxla/xla repo, also include debug info for files under xla/.
|
|
build:dbg --per_file_copt=+.*,-tensorflow.*,-xla.*@-g0
|
|
build:dbg --per_file_copt=+tensorflow/core/kernels.*@-g0
|
|
# for now, disable arm_neon. see: https://github.com/tensorflow/tensorflow/issues/33360
|
|
build:dbg --cxxopt -DTF_LITE_DISABLE_X86_NEON
|
|
# AWS SDK must be compiled in release mode. see: https://github.com/tensorflow/tensorflow/issues/37498
|
|
build:dbg --copt -DDEBUG_BUILD
|
|
|
|
# Options to disable default on features
|
|
build:nogcp --define=no_gcp_support=true
|
|
build:nonccl --define=no_nccl_support=true
|
|
|
|
# Modular TF build options
|
|
build:dynamic_kernels --define=dynamic_loaded_kernels=true
|
|
build:dynamic_kernels --copt=-DAUTOLOAD_DYNAMIC_KERNELS
|
|
|
|
# Don't trigger --config=<host platform> when cross-compiling.
|
|
build:android --noenable_platform_specific_config
|
|
build:ios --noenable_platform_specific_config
|
|
|
|
# Suppress all C++ compiler warnings, otherwise build logs become 10s of MBs.
|
|
build:android --copt=-w
|
|
build:ios --copt=-w
|
|
build:linux --host_copt=-w
|
|
build:macos --copt=-w
|
|
# Suppress all C++ compiler warnings on Windows
|
|
build:windows --copt=/W0
|
|
build:windows --host_copt=/W0
|
|
|
|
# Suppress most C++ compiler warnings to reduce log size but allow
|
|
# for specific warnings to still be present.
|
|
build:linux --copt="-Wno-all"
|
|
build:linux --copt="-Wno-extra"
|
|
build:linux --copt="-Wno-deprecated"
|
|
build:linux --copt="-Wno-deprecated-declarations"
|
|
build:linux --copt="-Wno-ignored-attributes"
|
|
build:linux --copt="-Wno-array-bounds"
|
|
|
|
# Windows-specific Python configuration
|
|
build:windows --repo_env=HERMETIC_PYTHON_VERSION=3.11
|
|
build:windows --action_env=PYTHON_BIN_PATH="C:/Program Files/Python311/python.exe"
|
|
build:windows --python_path="C:/Program Files/Python311/python.exe"
|
|
|
|
# Add unused-result as an error on Linux.
|
|
build:linux --copt="-Wunused-result"
|
|
build:linux --copt="-Werror=unused-result"
|
|
# Add switch as an error on Linux.
|
|
build:linux --copt="-Wswitch"
|
|
build:linux --copt="-Werror=switch"
|
|
# This was added in clang-16 by https://reviews.llvm.org/D133574.
|
|
# Can be removed once upb is updated, since a type definition is used within
|
|
# offset of in the current version of ubp.
|
|
# See https://github.com/protocolbuffers/upb/blob/9effcbcb27f0a665f9f345030188c0b291e32482/upb/upb.c#L183.
|
|
build:linux --copt=-Wno-gnu-offsetof-extensions
|
|
|
|
|
|
# Toolchain and CUDA options for Linux CPU builds
|
|
# TODO: Below config is not needed please don't use it and remove it.
|
|
build:release_cpu_linux --incompatible_enable_cc_toolchain_resolution
|
|
#build:release_cpu_linux --config=clang_local
|
|
#build:release_cpu_linux --crosstool_top="@local_config_cuda//crosstool:toolchain"
|
|
#build:release_cpu_linux --repo_env=TF_SYSROOT="/dt9"
|
|
|
|
# Linux ARM64 specific options
|
|
build:linux_arm64 --copt="-mtune=generic" --copt="-march=armv8-a" --copt="-O3"
|
|
|
|
# Windows pthreadpool configuration
|
|
# On Windows, set /std:c11 and /experimental:c11atomics for pthreadpool.
|
|
build:windows --conlyopt=/std:c11
|
|
build:windows --host_conlyopt=/std:c11
|
|
build:windows --copt=/experimental:c11atomics
|
|
build:windows --conlyopt=/experimental:c11atomics
|
|
build:windows --host_conlyopt=/experimental:c11atomics
|
|
build:windows --per_file_copt=external/pthreadpool/.*@-std=c11
|
|
build:windows --per_file_copt=external/pthreadpool/_*@/D_CRT_SECURE_NO_WARNINGS
|
|
|
|
# Force include MSVC compatibility header for litert files
|
|
build:windows --per_file_copt=external/litert/.*@/FI"C:/BuildTools/LiteRT-LM/msvc_compat.h"
|
|
|
|
|
|
# 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
|
|
|
|
# Before VS 2017 15.8, the member "type" would non-conformingly have an
|
|
# alignment of only alignof(max_align_t). VS 2017 15.8 was fixed to handle this
|
|
# correctly, but the fix inherently changes layout and breaks binary
|
|
# compatibility (*only* for uses of aligned_storage with extended alignments).
|
|
build:windows --copt=-D_ENABLE_EXTENDED_ALIGNED_STORAGE
|
|
build:windows --host_copt=-D_ENABLE_EXTENDED_ALIGNED_STORAGE
|
|
|
|
# Enable the runfiles symlink tree on Windows. This makes it possible to build
|
|
# the pip package on Windows without an intermediate data-file archive, as the
|
|
# build_pip_package script in its current form (as of Aug 2023) uses the
|
|
# runfiles symlink tree to decide what to put into the Python wheel.
|
|
startup --windows_enable_symlinks
|
|
build:windows --enable_runfiles
|
|
|
|
# Default paths for TF_SYSTEM_LIBS
|
|
build:linux --define=PREFIX=/usr
|
|
build:linux --define=LIBDIR=$(PREFIX)/lib
|
|
build:linux --define=INCLUDEDIR=$(PREFIX)/include
|
|
build:linux --define=PROTOBUF_INCLUDE_PATH=$(PREFIX)/include
|
|
build:macos --define=PREFIX=/usr
|
|
build:macos --define=LIBDIR=$(PREFIX)/lib
|
|
build:macos --define=INCLUDEDIR=$(PREFIX)/include
|
|
build:macos --define=PROTOBUF_INCLUDE_PATH=$(PREFIX)/include
|
|
# TF_SYSTEM_LIBS do not work on windows.
|
|
|
|
# By default, build TF in C++ 17 mode.
|
|
build:android --cxxopt=-std=c++17
|
|
build:android --host_cxxopt=-std=c++17
|
|
build:ios --cxxopt=-std=c++17
|
|
build:ios --host_cxxopt=-std=c++17
|
|
build:linux --cxxopt=-std=c++17
|
|
build:linux --host_cxxopt=-std=c++17
|
|
build:macos --cxxopt=-std=c++17
|
|
build:macos --host_cxxopt=-std=c++17
|
|
build:macos_arm64 --cxxopt=-std=c++17
|
|
build:macos_arm64 --host_cxxopt=-std=c++17
|
|
build:windows --cxxopt=/std:c++20
|
|
build:windows --host_cxxopt=/std:c++20
|
|
|
|
# On windows, we still link everything into a single DLL.
|
|
build:windows --config=monolithic
|
|
|
|
# On linux, we dynamically link small amount of kernels
|
|
build:linux --config=dynamic_kernels
|
|
|
|
# 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
|
|
|
|
# Force local execution for genrules on Windows
|
|
build:windows --strategy=Genrule=local
|
|
build:windows --genrule_strategy=local
|
|
build:windows --spawn_strategy=local
|
|
|
|
# Use Git Bash for genrules
|
|
build:windows --shell_executable="C:/Program Files/Git/bin/bash.exe"
|
|
|
|
# Verbose failure logs when something goes wrong
|
|
build:windows --verbose_failures
|
|
|
|
# Work around potential issues with large command lines on windows.
|
|
# See: https://github.com/bazelbuild/bazel/issues/5163
|
|
build:windows --features=compiler_param_file
|
|
|
|
# Disable problematic features on Windows
|
|
build:windows --define=tflite_with_xnnpack=false
|
|
|
|
# Minimal build configuration
|
|
build:windows --define=build_with_mkl=false
|
|
build:windows --define=build_with_openmp=false
|
|
|
|
# Do not risk cache corruption. See:
|
|
# https://github.com/bazelbuild/bazel/issues/3360
|
|
build:linux --experimental_guard_against_concurrent_changes
|
|
|
|
# Configure short or long logs
|
|
build:short_logs --output_filter=DONT_MATCH_ANYTHING
|
|
build:verbose_logs --output_filter=
|
|
|
|
# Instruction set optimizations
|
|
# TODO(gunan): Create a feature in toolchains for avx/avx2 to
|
|
# avoid having to define linux/win separately.
|
|
build:avx_linux --copt=-mavx
|
|
build:avx_linux --host_copt=-mavx
|
|
build:avx_win --copt=/arch:AVX
|
|
|
|
# Enable all targets in XLA
|
|
build:cpu_cross --define=with_cross_compiler_support=true
|
|
|
|
# Disable XLA on mobile.
|
|
build:xla --define=with_xla_support=true # TODO: remove, it's on by default.
|
|
build:android --define=with_xla_support=false
|
|
build:ios --define=with_xla_support=false
|
|
|
|
# Flag to enable remote config
|
|
common --experimental_repo_remote_exec
|
|
|
|
# TFLite build configs for generic embedded Linux
|
|
build:elinux --config=clang_local
|
|
build:elinux --crosstool_top=@local_config_embedded_arm//:toolchain
|
|
build:elinux --host_crosstool_top=@bazel_tools//tools/cpp:toolchain
|
|
build:elinux_aarch64 --config=elinux
|
|
build:elinux_aarch64 --cpu=aarch64
|
|
build:elinux_aarch64 --platforms=@org_tensorflow//tensorflow/tools/toolchains/linux:linux_aarch64
|
|
build:elinux_armhf --config=elinux
|
|
build:elinux_armhf --cpu=armhf
|
|
build:elinux_armhf --platforms=@org_tensorflow//tensorflow/tools/toolchains/linux:linux_armhf
|
|
build:elinux_armhf --copt -mfp16-format=ieee
|
|
|
|
# Config-specific options should come above this line.
|
|
|
|
# Load rc file written by ./configure.
|
|
# Fail on missing litert configure. It must exist for clang to be properly configured.
|
|
try-import %workspace%/.litert_configure.bazelrc
|
|
try-import %workspace%/xla_configure.bazelrc
|
|
|
|
# Load rc file with user-specific options.
|
|
try-import %workspace%/.bazelrc.user
|
|
|
|
# Try to load the XLA warnings config if available
|
|
try-import %workspace%/warnings.bazelrc
|
|
|
|
# Options to build TensorFlow 1.x or 2.x.
|
|
build:v2 --define=tf_api_version=2 --action_env=TF2_BEHAVIOR=1
|
|
build --config=v2
|
|
|
|
# Options to filter filepath prefixes when generating python api's
|
|
build:litert_prefixes --define=litert_prefixes="external/org_tensorflow/"
|
|
build --config=litert_prefixes
|
|
|
|
# Disables generating api v2 under the submodule tensorflow/lite/python.
|
|
build --define=disable_tf_lite_py=true
|
|
|
|
# Config to use a gcs bucket as remote cache.
|
|
build:public_cache --remote_cache="https://storage.googleapis.com/litert-bazel-artifacts" --remote_upload_local_results=false
|
|
|
|
# Cache pushes are limited to CI system.
|
|
# WARNING: THIS OPTION WONT WORK IF YOU DO NOT HAVE PROPER AUTHENTICATION AND PERMISSIONS
|
|
build:public_cache_push --config=public_cache --remote_upload_local_results=true --google_default_credentials
|
|
|
|
# BEGIN LITERT REMOTE BUILD EXECUTION OPTIONS
|
|
# WARNING: THESE OPTIONS WONT WORK IF YOU DO NOT HAVE PROPER AUTHENTICATION AND PERMISSIONS
|
|
|
|
# Allow creation of resultstore URLs for any bazel invocation
|
|
build:resultstore --google_default_credentials
|
|
build:resultstore --bes_backend=buildeventservice.googleapis.com
|
|
build:resultstore --bes_instance_name="tensorflow-testing"
|
|
build:resultstore --bes_results_url="https://source.cloud.google.com/results/invocations"
|
|
build:resultstore --bes_timeout=600s
|
|
|
|
# Flag to enable remote config
|
|
common --experimental_repo_remote_exec
|
|
|
|
# Make Bazel not try to probe the host system for a C++ toolchain.
|
|
build:rbe_base --config=resultstore
|
|
build:rbe_base --repo_env=BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1
|
|
build:rbe_base --define=EXECUTOR=remote
|
|
build:rbe_base --jobs=200
|
|
build:rbe_base --remote_executor=grpcs://remotebuildexecution.googleapis.com
|
|
build:rbe_base --remote_timeout=3600
|
|
build:rbe_base --spawn_strategy=remote,worker,standalone,local
|
|
|
|
# Attempt to minimize the amount of data transfer between bazel and the remote
|
|
# workers:
|
|
build:rbe_base --remote_download_toplevel
|
|
test:rbe_base --test_env=USER=anon
|
|
|
|
build:rbe_linux --config=rbe_base
|
|
build:rbe_linux --action_env=PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/go/bin"
|
|
# Non-rbe settings we should include because we do not run configure
|
|
build:rbe_linux --config=avx_linux
|
|
build:rbe_linux --linkopt=-lrt
|
|
build:rbe_linux --host_linkopt=-lrt
|
|
build:rbe_linux --linkopt=-lm
|
|
build:rbe_linux --host_linkopt=-lm
|
|
|
|
build:rbe_linux_cpu --config=rbe_linux
|
|
# Linux cpu and cuda builds share the same toolchain now.
|
|
build:rbe_linux_cpu --extra_execution_platforms="@ml_build_config_platform//:platform"
|
|
build:rbe_linux_cpu --host_platform="@ml_build_config_platform//:platform"
|
|
build:rbe_linux_cpu --platforms="@ml_build_config_platform//:platform"
|
|
# This is needed for all Clang17 builds but must not be present in GCC builds.
|
|
build:rbe_linux_cpu --copt=-Wno-error=unused-command-line-argument
|
|
# These you may need to change for your own GCP project.
|
|
common:rbe_linux_cpu --remote_instance_name=projects/tensorflow-testing/instances/default_instance
|
|
# END LITERT REMOTE BUILD EXECUTION OPTIONS
|
|
|
|
build:rbe_linux_cpu_clang_local --config=rbe_linux_cpu
|
|
build:rbe_linux_cpu_clang_local --config=clang_local
|
|
build:rbe_linux_cpu_clang_local --host_crosstool_top="@local_config_cuda//crosstool:toolchain"
|
|
build:rbe_linux_cpu_clang_local --crosstool_top="@local_config_cuda//crosstool:toolchain"
|
|
build:rbe_linux_cpu_clang_local --extra_toolchains="@local_config_cuda//crosstool:toolchain-linux-x86_64"
|
|
build:rbe_linux_cpu_clang_local --repo_env=CC="/usr/lib/llvm-18/bin/clang"
|
|
|
|
# Filters used when building in bulk in cpu.
|
|
build:bulk_build_cpu --build_tag_filters=-no_oss,-oss_serial,-gpu,-tpu,-v1only
|
|
build:bulk_test_cpu --show_timestamps
|
|
build:bulk_test_cpu --experimental_ui_max_stdouterr_bytes=3145728
|
|
|
|
# Filters used when testing in bulk in cpu.
|
|
test:bulk_test_cpu --config=bulk_build_cpu
|
|
test:bulk_test_cpu --test_tag_filters=-no_oss,-oss_serial,-gpu,-tpu,-v1only,-benchmark-test
|
|
test:bulk_test_cpu --test_summary=short
|
|
test:bulk_test_cpu --test_output=errors
|
|
test:bulk_test_cpu --verbose_failures=true
|
|
test:bulk_test_cpu --flaky_test_attempts=3
|
|
test:bulk_test_cpu --build_tests_only
|
|
|
|
# TODO: b/397625618 Enable bzlmod
|
|
common --noenable_bzlmod
|
|
|
|
# BEGIN-INTERNAL
|
|
# Flags for tensorflow source rules to use local_repository rather than http_archive.
|
|
# NOTE: due to bazel caching, when switching from http_archive to local_repository,
|
|
# do a bazel clean --expunge --async before building or use the
|
|
# flag --override_repository=org_tensorflow=$TF_LOCAL_SOURCE_PATH
|
|
build:use_local_tf --action_env=USE_LOCAL_TF=true
|
|
build:use_local_tf --action_env=TF_LOCAL_SOURCE_PATH
|
|
test:use_local_tf --action_env=USE_LOCAL_TF=true
|
|
test:use_local_tf --action_env=TF_LOCAL_SOURCE_PATH
|
|
# END-INTERNAL |