Commit Graph

568 Commits

Author SHA1 Message Date
Yulia Baturina
bcc803eeb6 Remove usage of mirrored tar files from CI because hermetic xz tool helps to unpack tar.xz faster.
PiperOrigin-RevId: 822773874
2025-10-22 16:08:18 -07:00
Yun Peng
2a5f830ee8 Use common instead of build in .bazelrc file.
This change makes most Bazel options apply to all commands (e.g., `build`, `test`, `query`, `mod`) rather than just the `build` command, which prevents external repo being refetched accidentally when switching between commands (e.g `build` vs `query`).

PiperOrigin-RevId: 812842964
2025-09-29 10:30:09 -07:00
A. Unique TensorFlower
fdcc8a6888 Replace RBE Docker container image: use Docker image without pre-installed CUDA packages.
Enable CUDA forward-compatibility mode in all RBE jobs by default.

Forward compatibility mode in hermetic CUDA allows the linker to use the user-mode driver from Bazel cache, so there is no need to install UMD in the RBE Docker image.

UMD on RBE machines is rarely updated, thus RBE jobs need forward compatibility mode to enable the most recent CUDA features usage in the tests.

The non-RBE job runners are updated more often, hence we can update the drivers on those machines and not rely on forward compatibility mode.

PiperOrigin-RevId: 810595379
2025-09-23 15:16:44 -07:00
A. Unique TensorFlower
3eae65361b Update rules_python to v1.6 in XLA and TensorFlow projects.
`com_google_protobuf` and `rules_cc` initialization was moved to `python_init_rules` macros.

The JAX repository update will be done [in the next step](https://github.com/jax-ml/jax/pull/31709)

PiperOrigin-RevId: 808689003
2025-09-18 12:30:45 -07:00
TensorFlower Gardener
ba2d69c2a2 Merge pull request #93951 from Sqvid:tf-bump-3.7-fix
PiperOrigin-RevId: 798331790
2025-08-22 14:03:34 -07:00
TensorFlower Gardener
1a5f2369b4 Merge pull request #98786 from Intel-tensorflow:gz/tf_build_change_2
PiperOrigin-RevId: 794882526
2025-08-13 22:58:42 -07:00
A. Unique TensorFlower
be308cd0b2 Update rules_ml_toolchain to integrate mirrored_http_archive repo rule.
If the repository env var `USE_MIRRORED_TAR_ARCHIVE_FILES` is set to `1`, the `.tar` files are downloaded from the mirror instead of `.tar.xz`.

`USE_MIRRORED_TAR_ARCHIVE_FILES` is not set by default.

PiperOrigin-RevId: 794631542
2025-08-13 10:30:33 -07:00
guozhong.zhuang
08a492b3e5 [oneDNN] Change public TensorFlow wheel CPU build configuration 2025-08-12 09:07:16 -07:00
A. Unique TensorFlower
8b4e0f2d1c Use mirrored .tar files for NVIDIA and clang archives in CI and RBE jobs.
Comparison of LLVM Repository creation time for Linux x86_64:

 clang archive | Download operation | Extract operation | Total time
:-----------: | :------------: | :------------: | :------------:
clang.tar.xz  | 5s             | 132s           | 137s
clang.tar     | 37s            | 12s            | 49s

PiperOrigin-RevId: 792228821
2025-08-07 11:40:48 -07:00
A. Unique TensorFlower
f4ee7a188e Remove local_config_nvshmem repository from XLA and Tensorflow WORKSPACE files.
Upgrading manylinux compliancy tag in [JAX PR](https://github.com/jax-ml/jax/pull/29672) enabled building targets with linked `nvshmem` libraries.

PiperOrigin-RevId: 786533277
2025-07-23 20:39:56 -07:00
A. Unique TensorFlower
f7dfba3f74 Add Hermetic C++ Toolchains for Linux x86_64 builds.
Hermetic toolchains give us builds that are isolated from the host system, cutting down on unexpected dependencies and side effects.

With these changes, TensorFlow will build for Linux x86_64 architectures (both CPU and CUDA-enabled GPU) using self-contained C++ toolchains. If you need to use a non-hermetic toolchain, you can do so by adding the flag --config=clang_local. For remote builds with a non-hermetic toolchain, simply append _clang_local to your existing RBE flag. For example, if your hermetic RBE build uses --config=rbe_linux_cpu, the non-hermetic version would be --config=rbe_linux_cpu_clang_local.

    Example: Run CPU tests for Linux x86_64

    For hermetic tests, run following command (no env variables like CC, CXX, BAZEL_COMPILER, CLANG_COMPILER_PATH):
	bazel test \
		--config=avx_linux \
		--config=release_linux_base \
		--config=linux_cpu_pycpp_test_filters \
		--repo_env=HERMETIC_PYTHON_VERSION=3.11 \
		//tensorflow/... -- -//tensorflow/compiler/tf2tensorrt/... -//tensorflow/core/tpu/... -//tensorflow/lite/...  -//tensorflow/tools/toolchains/...

    For Linux x86_64 non-hermetic tests use commands with the flag "--config=clang_local" and env variables CC, CXX, BAZEL_COMPILER, CLANG_COMPILER_PATH, etc.:
	bazel test \
		--config=clang_local \
		--config=avx_linux \
		--config=release_linux_base \
		--config=linux_cpu_pycpp_test_filters \
		--repo_env=HERMETIC_PYTHON_VERSION=3.11 \
		--action_env=CLANG_COMPILER_PATH=/usr/lib/llvm-18/bin/clang \
		--host_action_env=CLANG_COMPILER_PATH=/usr/lib/llvm-18/bin/clang \
		--repo_env=CC=/usr/lib/llvm-18/bin/clang \
		--repo_env=CXX=/usr/lib/llvm-18/bin/clang++ \
		--repo_env=BAZEL_COMPILER=/usr/lib/llvm-18/bin/clang \
		//tensorflow/... -- -//tensorflow/compiler/tf2tensorrt/... -//tensorflow/core/tpu/... -//tensorflow/lite/...  -//tensorflow/tools/toolchains/...

PiperOrigin-RevId: 783911228
2025-07-16 15:21:17 -07:00
Siddhartha Menon
e9cd9ea7d5
build(aarch64): Update to oneDNN-3.7 + ACL-24.12 (fix)
Bumps the aarch64-compatible oneDNN version to 3.7 and the ACL version
to 24.12. This brings better performance, improved memory management,
and numerous bug fixes over the previous, long out-of-date versions.

The previous version of this patch caused failures in a couple of unit
tests which have now been fixed.

Co-authored-by: David Svantesson-Yeung <david.svantesson-yeung@arm.com>
Signed-off-by: Siddhartha Menon <siddhartha.menon@arm.com>
2025-07-04 11:22:20 +00:00
Ezekiel Calubaquib
e2ee8cf718 add no_oss_py313 tag to following max python test
PiperOrigin-RevId: 777703944
2025-06-30 14:20:07 -07:00
A. Unique TensorFlower
ac0a1bae1b Rollback integration of hermetic C++ toolchains in Tensorflow as they increase the wheel size and raise the value of manyLinux compliancy tag.
Reverts ac56b0e840

PiperOrigin-RevId: 776274067
2025-06-26 14:16:01 -07:00
A. Unique TensorFlower
0d2b08d354 Disable hermetic C++ for CUDA builds because the wheel size is too big.
`libtensorflow_framework.so.2` and `libtensorflow_cc.so.2` volumes are increased by 50 and 150MB with hermetic C++ toolchains.

PiperOrigin-RevId: 776186539
2025-06-26 10:23:47 -07:00
A. Unique TensorFlower
ac56b0e840 Integrate hermetic ML toolchains for TensorFlow.
Hermetic C++ toolchains and CUDA are enabled for Linux x86_64 platform by default. List of covered OSs will be extended in a few closest months. Developers still could use  non hermetic toolchains with help of --config=clang_local flag.

std::reduce replace with a traditional for loop. This is necessary because GCC 8 offers only partial support for C++17, and using std::reduce in this environment leads to "Undefined method" error.
PiperOrigin-RevId: 775771057
2025-06-25 11:43:53 -07:00
Ezekiel Calubaquib
4b1a3ff036 Exclude tests marked as not for Python 3.13 from wheel test config for rest of all wheel platform builds
PiperOrigin-RevId: 773744184
2025-06-20 10:16:34 -07:00
Vadym Matsishevskyi
724f36e009 Major deps update:
-Protobuf 5.28.3
-Grpc 1.68.2
-Abseil: LTS 20240116.3
-Plus some other transitive/related deps, riegeli and pybind11 in particular.
-rules_python & rules_cc will be updated in a subsequent CL as they are their own can of worms, plus there are a few pending changes in rules_python which were not pushed yet.

This also switches default protobuf implementation we rely on for bazel builds from cpp to upb, meaning all projects dependin on htis one must be built with build --action_env=PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=upb.

PiperOrigin-RevId: 773586210
2025-06-20 01:35:16 -07:00
Ezekiel Calubaquib
1254c8034d Disable multi_process_runner_test test for python 3.13. as its timing out
PiperOrigin-RevId: 772793395
2025-06-18 00:21:31 -07:00
Gerardo Carranza
f999b4767c Reverts 0acc54bd1b
PiperOrigin-RevId: 771154485
2025-06-13 11:30:55 -07:00
A. Unique TensorFlower
0acc54bd1b Replace outdated select() on --cpu in tensorflow/BUILD and related files with platform API equivalent.
PiperOrigin-RevId: 770982754
2025-06-13 01:18:17 -07:00
A. Unique TensorFlower
428f3034bb Use NVSHMEM tar files in RBE CUDA builds for XLA and Tensorflow.
PiperOrigin-RevId: 769761344
2025-06-10 13:17:05 -07:00
A. Unique TensorFlower
707048b1b9 Integrate hermetic nvshmem repository in XLA and TF projects.
TF wheel build rule implementation is also updated to exclude accidental dependencies on NVSHMEM libraries in the wheel content. If the wheel needs to be built with these dependencies, provide `--@local_config_nvshmem//:override_include_nvshmem_libs=True` in Bazel options.

`NVSHMEM` binaries are included in the dependencies if `CUDA` binary dependencies are added as well, e.g. `--@local_config_cuda//:enable_cuda`.

`NVSHMEM` libraries are included in the dependencies if `--@local_config_nvshmem//:include_nvshmem_libs=True` (the default flag value is `False`). Please note that this is a temporary solution, and it should be removed after GLIBC is updated on RBE runners. At the moment `libnvshmem.so` files can't be linked to the targets because they are built with GLIBC version higher then on RBE runners. In the future `--@local_config_cuda//cuda:include_cuda_libs=True` should be used.

The next change will contain adding `NVSHMEM` deps to individual Bazel targets via `select`.

PiperOrigin-RevId: 769344482
2025-06-09 16:48:48 -07:00
Richard Levasseur
4a8e5c4a6b Undo unintentional edits to oneDNN configs from cl/755989315
cl/755989315 should have only added the single flag to affect Python compiling,
but somehow it ended up reverting the edits from cl/755781948

Manually restore the edits made by cl/755781948

PiperOrigin-RevId: 761660001
2025-05-21 14:12:56 -07:00
Richard Levasseur
75e87d6df2 Force disable build time Python pyc generation.
When switching some remaining `native.py_` usages to the one
loaded from rules_python, some action conflicts occur. As
a short term solution, disable precompiling to avoid those
action conflicts.

PiperOrigin-RevId: 755989315
2025-05-07 14:26:34 -07:00
Penporn Koanantakool
63553134a6 Rollback of PR #84975
Rollback oneDNN v3.7 + ACL v24.12 update in aarch64 build.
https://github.com/tensorflow/tensorflow/pull/84975

Reason: Broke TensorFlow-oneDNN CI on aarch64.
```
bazel test //tensorflow/python/kernel_tests/nn_ops:conv_ops_test_cpu --test_env=TF_ENABLE_ONEDNN_OPTS=1
bazel test //tensorflow/tools/proto_splitter/cc:util_test --test_env=TF_ENABLE_ONEDNN_OPTS=1
```

Reverts affe0dde0e

PiperOrigin-RevId: 755781948
2025-05-07 04:17:55 -07:00
A. Unique TensorFlower
34956ee62b Enable usage of mirrored .tar redistributions in CUDA repository rules by providing --repo_env=USE_CUDA_TAR_ARCHIVE_FILES=1.
The extraction of `.tar` files is 10 times faster than the extraction of `.tar.xz` files. By enabling `.tar` files usage in RBE jobs we are going to save at least one min of execution time in all Bazel RBE GPU jobs.

PiperOrigin-RevId: 753278068
2025-04-30 13:02:48 -07:00
TensorFlower Gardener
33d445acc9 Merge pull request #86943 from Flamefire:remove-unused-vars
PiperOrigin-RevId: 753167228
2025-04-30 08:18:54 -07:00
TensorFlower Gardener
affe0dde0e Merge pull request #84975 from Sqvid:tf-bump-3.7
PiperOrigin-RevId: 752892334
2025-04-29 15:00:33 -07:00
A. Unique TensorFlower
0a9c336718 Reverts 0780ad3f24
PiperOrigin-RevId: 752804976
2025-04-29 11:41:35 -07:00
A. Unique TensorFlower
0780ad3f24 Add --platforms flags to .bazelrc for Macos release configs.
PiperOrigin-RevId: 752218243
2025-04-28 02:30:14 -07:00
A. Unique TensorFlower
86a96b1302 Add --platforms flags to .bazelrc for Android, iOS, Macos and elinux.
PiperOrigin-RevId: 751103199
2025-04-24 13:09:07 -07:00
Siddhartha Menon
a24a3a48f2
build(aarch64): Update to oneDNN-3.7 + ACL-24.12
Bumps the aarch64-compatible oneDNN version to 3.7 and the ACL version
to 24.12. This brings better performance, improved memory management,
and numerous bug fixes over the previous, long out-of-date versions.

Signed-off-by: Siddhartha Menon <siddhartha.menon@arm.com>
2025-04-04 14:37:55 +00:00
A. Unique TensorFlower
bd9452dcc2 Temporary disable USE_CUDA_REDISTRIBUTIONS because it increased CPU job time.
PiperOrigin-RevId: 743771227
2025-04-03 18:55:53 -07:00
A. Unique TensorFlower
fbe4b80b8f Enable loading CUDA redistributions in CPU Linux RBE configurations.
This change is made to prevent hermetic CUDA repositories cache invalidation between the builds with `--config=cuda` and without it.

It should speed up Github presubmit jobs. Currently CPU and GPU jobs use the machines in the same pool, and they share the RBE cache.

Previously the cache was invalidated every time when `TF_NEED_CUDA` value changed between CPU and GPU builds, hence loading CUDA redistributions for GPU jobs took several minutes (see [this job](https://github.com/openxla/xla/actions/runs/14114621736/job/39541688832) for example: all the test results are cached, but CUDA redistributions were still downloaded).

With adding `--repo_env USE_CUDA_REDISTRIBUTIONS=1` to RBE CPU linux job configurations, we load some CUDA redistributions once in RBE cache, and then reuse it between the jobs.

PiperOrigin-RevId: 743700713
2025-04-03 14:47:23 -07:00
Raviteja Gorijala
696e1ec4c8 Remove libtensorflow configs
PiperOrigin-RevId: 740651313
2025-03-26 00:19:28 -07:00
Vadym Matsishevskyi
198f9bc834 Fix and enable pywrap rules on Windows platform
To use new rules the project needs to be built with the following parameters (flags are already into TF's .bazelrc)
--repo_env=USE_PYWRAP_RULES=True
--@com_google_protobuf//:use_dlls=True
--@com_google_absl//absl:use_dlls

Note: if after this CL, in one of your changes you see linker errors complaining about symbols missing on windows, you most likely need to modify _pywrap_tensorflow.def file:
- remove symbols which got deleted in your CL from _pywrap_tensorflow.def if they are mentioned there
- add new symbols into _pywrap_tensorflow.def if they start getting used in one of pybind_extension modules

To make sense out of mangled windows symbol names you may use https://demangler.com/ or `undname` (on windows) or any other simillar tool.

Automatic generation of _pywrap_tensorflow.def is possible but may be potentially slow, if there is evidence that _pywrap_tensorflow.def  needs to get updated often, we'll add the automation.

PiperOrigin-RevId: 738203468
2025-03-18 17:58:54 -07:00
A. Unique TensorFlower
55f1ab5228 Enable import_api_packages_test on windows builds.
PiperOrigin-RevId: 734224078
2025-03-06 12:08:39 -08:00
A. Unique TensorFlower
d89654d859 Enable apple toolchain also for ios build
PiperOrigin-RevId: 734099483
2025-03-06 05:29:05 -08:00
David Dunleavy
869d6a70cb Update uses of @tsl//third_party to @xla//third_party after 933649f19e
PiperOrigin-RevId: 733816772
2025-03-05 12:09:38 -08:00
A. Unique TensorFlower
d9052b4f23 Exclude v1only tests and targets from windows_x86_cpu_2022_pycpp_test_filters.
PiperOrigin-RevId: 733778143
2025-03-05 10:28:17 -08:00
A. Unique TensorFlower
b4156d87ef Exclude v1only tests and targets from Windows 2022 CI jobs.
PiperOrigin-RevId: 733736013
2025-03-05 08:11:46 -08:00
David Dunleavy
40998f44c0 Move TSL's third_party to XLA, update users
Mostly updating `WORKSPACE` and related files from `@tsl//third_party` -> `@xla//third_party`. Please tag me if this change breaks you.

PiperOrigin-RevId: 733489153
2025-03-04 15:51:50 -08:00
A. Unique TensorFlower
805775fcb5 Refactor mechanisms of building TF wheel and storing TF project version.
This change introduces a uniform way of building the TF wheel and controlling the filename version suffixes.

A new repository rule `python_wheel_version_suffix_repository` provides information about project and wheel version suffixes. The final value depends on environment variables passed to Bazel command: `_ML_WHEEL_WHEEL_TYPE, _ML_WHEEL_BUILD_DATE, _ML_WHEEL_GIT_HASH, _ML_WHEEL_VERSION_SUFFIX`

`tf_version.bzl` defines the TF project version and loads the version suffix information calculated by `python_wheel_version_suffix_repository`.

The targets `//tensorflow/core/public:release_version, //tensorflow:tensorflow_bzl //tensorflow/tools/pip_package:setup_py` use the version chunks defined above.

The version of the wheel in the build rule output depends on the environment variables.

Environment variables combinations for creating wheels with different versions:
  * snapshot (default build rule behavior): `--repo_env=ML_WHEEL_TYPE=snapshot`
  * release: `--repo_env=ML_WHEEL_TYPE=release`
  * release candidate: `--repo_env=ML_WHEEL_TYPE=release --repo_env=ML_WHEEL_VERSION_SUFFIX=-rc1`
  * nightly build with date as version suffix: `--repo_env=ML_WHEEL_TYPE=nightly --repo_env=ML_WHEEL_BUILD_DATE=<YYYYmmdd>`
  * build with git data as version suffix: `--repo_env=ML_WHEEL_TYPE=custom --repo_env=ML_WHEEL_BUILD_DATE=$(git show -s --format=%as HEAD) --repo_env=ML_WHEEL_GIT_HASH=$(git rev-parse HEAD)`

PiperOrigin-RevId: 733444080
2025-03-04 14:39:12 -08:00
Francisco Unda
89bfad3cb6 Specify java runtime as mentioned in https://github.com/bazelbuild/bazel/releases/tag/7.0.0
PiperOrigin-RevId: 733418729
2025-03-04 13:16:24 -08:00
A. Unique TensorFlower
647e2e6db9 Remove uses of the --apple_bitcode flag, which is no longer supported with Bazel 7
See 37b8e1b37d

PiperOrigin-RevId: 733003646
2025-03-03 12:08:36 -08:00
A. Unique TensorFlower
9fbed41c9c Fix macOS builds
- Use cc toolchains from apple_support due to https://github.com/bazelbuild/bazel/pull/16619
- Upgrade pthreadspool to get https://github.com/google/pthreadpool/commit/b1aee199d54003fb557076a201bcac3398af580, which is needed for Bazel 7

PiperOrigin-RevId: 732195027
2025-02-28 11:45:13 -08:00
Francisco Unda
def1f53cbd Internal change only.
PiperOrigin-RevId: 731887324
2025-02-27 15:41:44 -08:00
A. Unique TensorFlower
0c3b9cceb1 Make Windows RBE build fast again
Due to 24ba4fa60c, --nobuild_runfile_links is no longer implied by --remote_download_minimal, which caused performance regression on Windows after upgrading Bazel to 7.4.1

PiperOrigin-RevId: 731694745
2025-02-27 06:06:25 -08:00
A. Unique TensorFlower
5c289f5ba2 Upgrade to Bazel 7.4.1 for TensorFlow
- Disabled Bzlmod for now before we start the migration
- Disabled cc toolchain resolution for now
- Fixed transition on `--modify_execution_info` due to https://github.com/bazelbuild/bazel/pull/16262
- Explicitly added `-Wl,-undefined,dynamic_lookup` as linkopt on macOS after https://github.com/bazelbuild/bazel/pull/16414
- Set `-force_no_whole_archive` for host features
- Addressed Windows linking issue by adding `@com_googlesource_code_re2//:__subpackages__` in `exports_filter` of `//tensorflow/python:pywrap_tensorflow_internal`
- Removed `license` attribute on cc_shared_library
- Fixed license checks

PiperOrigin-RevId: 731344894
2025-02-26 09:27:14 -08:00