119 Commits

Author SHA1 Message Date
GitHub Actions
a0edd3fbb2 Merge remote-tracking branch 'origin/rocm-main' into ci-upstream-sync-144_1 2025-03-12 16:57:18 +00:00
Kanglan Tang
4df691ec00 Remove unsupported mac x86 CI build options
PiperOrigin-RevId: 735885305
2025-03-11 14:12:51 -07:00
Charles Hofer
fb89a4b427 Merge branch 'rocm-main' into ci-upstream-sync-142_1 2025-03-11 16:33:59 +00:00
jax authors
1ae7dd7f76 Update .bazelrc with Apple CC toolchain changes.
PiperOrigin-RevId: 733784816
2025-03-05 10:31:16 -08:00
charleshofer
6791224233
Fix C++23 build errors (#257) 2025-03-05 11:54:22 -06:00
Kanglan Tang
d112c85e6d Internal config change
PiperOrigin-RevId: 733398579
2025-03-04 11:17:48 -08:00
Kanglan Tang
8bb3100019 Add -Wl,-undefined,dynamic_lookup as linkopt on macOS
This is needed to fix mac arm64 nightly failures after Bazel 7.4.1 upgrade: https://github.com/bazelbuild/bazel/pull/16414.

PiperOrigin-RevId: 731830060
2025-02-27 12:49:39 -08:00
Nitin Srinivasan
a65de52421 Enable resultstore logging
Tests logged with resulstore are much easier to read and debug

PiperOrigin-RevId: 731448196
2025-02-26 14:04:58 -08:00
jax authors
c9c7250dd4 Upgrade to Bazel 7.4.1
PiperOrigin-RevId: 731278247
2025-02-26 05:33:24 -08:00
jax authors
679f1a951e Use "common" instead of "build" for some flags in .bazelrc
Setting "build" options in the RC file prevents applying the flags to the query command. "common" works for both build and query commands.

Flags like `--experimental_cc_shared_library` changes the starlark semantics which forces re-fetching all repo rules when switching between commands.

Ideally, more flags should be common instead of build.

PiperOrigin-RevId: 728658294
2025-02-19 07:09:04 -08:00
Peter Hawkins
f6ca686641 Bump the minimum Mac OS X version for x86 builds to 11.0.
The x86 build stopped building completely due to a use of std::filesystem::path, which was added in 10.15.
We've dropped x86 support, but this is an easy enough fix to make and moves x86 to parity with ARM.
2025-02-10 08:51:32 -05:00
jax authors
727d0367a4 Update --config=cuda to add direct dependencies on CUDA libraries both for bazel build and bazel test phases.
With this configuration the same cache is used both for `bazel build` and `bazel test` commands (provided the same target is specified).

Add `--config=no_cuda_libs` for building targets with CUDA libraries from stubs.

PiperOrigin-RevId: 720334587
2025-01-27 15:46:17 -08:00
Nitin Srinivasan
89a9c6c244 Add new Bazel remote cache configs
An example run where the cache configs are used: https://github.com/jax-ml/jax/actions/runs/12940123731

PiperOrigin-RevId: 719627011
2025-01-25 05:32:42 -08:00
Peter Hawkins
3b772b619e Remove code that sets CUDA rpath option from .bazelrc.
This option does nothing any more.
2025-01-23 10:10:57 -05:00
Ruturaj4
435edf1f8c Add gfx12xx archs 2025-01-15 16:14:40 +00:00
Sunita Nadampalli
e370deee0f add mkldnn+acl build config for aarch64 platform 2024-12-09 16:03:14 +00:00
Peter Hawkins
fac1b1a780 Set -Werror=mismatched-tags on clang.
This means we see a helpful compiler error rather than a cryptic linker error if struct/class tags are mismatched.

PiperOrigin-RevId: 703491110
2024-12-06 07:17:35 -08:00
Nitin Srinivasan
6761512658 Re-factor build CLI to a subcommand based approach
This commit reworks the JAX build CLI to a subcommand based approach where CLI use cases are now defined as subcommands. Two subcommands are defined: build and requirements_update. "build" is to be used when wanting to build a JAX wheel package. "requirements_update" is to be used when wanting to update the requirements_lock.txt files. The new structure offers a clear and organized CLI that enables users to execute specific build tasks without having to navigate through a monolithic script.

Each subcommand has specific arguments that apply to its respective build process. In addition, arguments are separated into groups to achieve a cleaner separation and improves the readability when the CLI subcommands are run with `--help`. It also makes it clear as to which parts of the build they affect. E.g: CUDA arguments only apply to CUDA builds, ROCM arguments only apply to ROCM builds, etc. This reduces the complexity and the potential for errors during the build process. Segregating functionalities into distinct subcommands also simplifies the code which should help with the maintenance and future extensions.

There is also a transition from using `subprocess.check_output` to `asyncio.create_subprocess_shell` for executing the build commands which allows for streaming logs and helps in showing the build progress in real time.

Usage:
* Building `jaxlib`:
```
python build/build.py build --wheels=jaxlib --python_version=3.10
```
* Building `jax-cuda-plugin`:
```
python build/build.py build --wheels=jax-cuda-plugin --cuda_version=12.3.2 --cudnn_version=9.1.1 --python_version=3.10
```
* Building multiple packages:
```
python build/build.py build --wheels=jaxlib,jax-cuda-plugin,jax-cuda-pjrt --cuda_version=12.3.2 --cudnn_version=9.1.1 --python_version=3.10
```
* Building `jax-rocm-pjrt`:
```
python build/build.py build --wheels=jax-rocm-pjrt --rocm_version=60 --rocm_path=/path/to/rocm
```
* Using a local XLA path:
```
python build/build.py build --wheels=jaxlib --local_xla_path=/path/to/xla
```
* Updating requirements_lock.txt files:
```
python build/build.py requirements_update --python_version=3.10
```

For more details on each argument and to see available options, run:
```
python build/build.py build --help
```
or
```
python build/build.py requirements_update --help
```

PiperOrigin-RevId: 700075411
2024-11-25 13:03:04 -08:00
Andrey Portnoy
8c85f744ff
Add newline at the end of .bazelrc 2024-10-22 13:32:09 -04:00
Nitin Srinivasan
a2bc8c2e07 Remove temporary aliases from .bazelrc
These aliases were added to not break existing presubmit builds. Now that the presubmit builds have been updated, these aliases can be removed.

Also, corrects some comments.

PiperOrigin-RevId: 688096364
2024-10-21 05:20:13 -07:00
Ruturaj4
33bcd0cb7a [ROCm] Bring up clang support for JAX+XLA
* Add clang path

* bazelrc env fixes

* Fix wheelhouse installation and preserve wheels

* dockerfile changes

* Add target.lst

* Change target architectures

* Install bzip2 and sqlite packages
2024-10-10 16:31:26 -05:00
Nitin Srinivasan
5132a188f7 Refactor JAX's .bazelrc
This is the first step as part of the JAX CI rework project.

Changes:
* Adds new `ci_{os_name}_{arch}` configs that consolidates the different configs that we use in CI builds under a single config.
* Consolidates Python specific RBE Linux CPU and RBE Linux CUDA configs into Python agnostic `rbe_linux_x86_64` and `rbe_linux_x86_64_cuda`. These new RBE configs inherit the settings in the corresponding `ci_` config and pass in additional RBE specific flags such as platform details, remote execution backend, and authentication details. Hermetic Python version details will now be passed directly in the CI build scripts.
* Adds new RBE Windows configs.
* Removes JAVA flags from RBE configs. These are ignored from Bazel 5+. (See related TF PR: https://github.com/tensorflow/tensorflow/pull/54547)
* Renames some configs: `cuda_nvcc` is now `build_cuda_with_nvcc`, `cuda_clang` is now `build_cuda_with_clang`, `rbe_cross_compile_macos_x86` is now `rbe_cross_compile_darwin_x86_64`, `rbe_cross_compile_linux_arm64` is now `rbe_cross_compile_linux_aarch64`.
* Separates platform specific configs and feature specific configs into their own section.
* Removes unused `--define` configs
* Adds new test configs that will be used when running `bazel test`. `non_multiaccelerator` will be used in RBE Linux CUDA test builds, `non_multiaccelerator_local` and `multiaccelerator_local` will be used in Linux CUDA test builds which depend on local jaxlib and plugin wheels instead of building them along with the rest of the test targets.
* Replaces `--spawn_strategy=standalone` with `--spawn_strategy=local`. `standalone` has been [deprecated by Bazel](https://bazel.build/docs/user-manual#spawn-strategy).
PiperOrigin-RevId: 684532777
2024-10-10 12:16:49 -07:00
Peter Hawkins
e4790b634e Don't pass --nocheck_visibility to Bazel.
This no longer appears to be needed.
2024-09-27 11:19:42 -04:00
jax authors
ce99c18a74 Remove CC="/usr/lib/llvm-18/bin/clang" from clang config in .bazelrc
Restore `cuda_clang` config in .bazelrc

PiperOrigin-RevId: 678828039
2024-09-25 13:35:01 -07:00
jax authors
6e116491c1 Add --use_cuda_nvcc flag to enable or disable compilation of CUDA code using NVCC.
If `--use_cuda_nvcc` flag is set the NVCC compiler driver will be used to build the CUDA code (default behavior). Otherwise, if the flag `--nouse_cuda_nvcc` is set, only the clang compiler will be used to build the CUDA code (effectively disabling NVCC).

Mark `--use_clang` flag as deprecated.

Refactor `.bazelrc` configs to match the new flag and to cleanup all previous confusing names.

PiperOrigin-RevId: 678332548
2024-09-24 11:37:00 -07:00
jax authors
8bcdb12852 Add CI jobs for python 3.13.0rc2.
PiperOrigin-RevId: 675758096
2024-09-17 16:51:35 -07:00
jax authors
45dc05eaa6 Delete remote python repository rule calls from TF configs.
Remote configurations of python repositories are removed because hermetic Python repository rules install and configure python modules in Bazel cache on the host machine. The cache is shared across host and remote machines.

PiperOrigin-RevId: 671512134
2024-09-05 14:31:20 -07:00
jax authors
38184dda9a Remove CUDA and NCCL repository rules calls from RBE configs.
The CUDA and NCCL repositories are created on a host machine now and shared via Bazel cache between host and remote machines.

PiperOrigin-RevId: 671089856
2024-09-04 13:57:13 -07:00
jax authors
279977c61d Refactor hermetic CUDA flags and update --config=cuda to add CUDA dependencies both for bazel build and bazel test phases.
Add `--@local_config_cuda//cuda:override_include_cuda_libs` to override settings for TF wheel.

Forbid building TF wheel with `--@local_config_cuda//cuda:include_cuda_libs=true`

PiperOrigin-RevId: 666848518
2024-08-23 10:44:32 -07:00
jax authors
599c13aa09 Introduce hermetic CUDA in Google ML projects.
1) Hermetic CUDA rules allow building wheels with GPU support on a machine without GPUs, as well as running Bazel GPU tests on a machine with only GPUs and NVIDIA driver installed. When `--config=cuda` is provided in Bazel options, Bazel will download CUDA, CUDNN and NCCL redistributions in the cache, and use them during build and test phases.

    [Default location of CUNN redistributions](https://developer.download.nvidia.com/compute/cudnn/redist/)

    [Default location of CUDA redistributions](https://developer.download.nvidia.com/compute/cuda/redist/)

    [Default location of NCCL redistributions](https://pypi.org/project/nvidia-nccl-cu12/#history)

2) To include hermetic CUDA rules in your project, add the following in the WORKSPACE of the downstream project dependent on XLA.

   Note: use `@local_tsl` instead of `@tsl` in Tensorflow project.

   ```
   load(
      "@tsl//third_party/gpus/cuda/hermetic:cuda_json_init_repository.bzl",
      "cuda_json_init_repository",
   )

   cuda_json_init_repository()

   load(
      "@cuda_redist_json//:distributions.bzl",
      "CUDA_REDISTRIBUTIONS",
      "CUDNN_REDISTRIBUTIONS",
   )
   load(
      "@tsl//third_party/gpus/cuda/hermetic:cuda_redist_init_repositories.bzl",
      "cuda_redist_init_repositories",
      "cudnn_redist_init_repository",
   )

   cuda_redist_init_repositories(
      cuda_redistributions = CUDA_REDISTRIBUTIONS,
   )

   cudnn_redist_init_repository(
      cudnn_redistributions = CUDNN_REDISTRIBUTIONS,
   )

   load(
      "@tsl//third_party/gpus/cuda/hermetic:cuda_configure.bzl",
      "cuda_configure",
   )

   cuda_configure(name = "local_config_cuda")

   load(
      "@tsl//third_party/nccl/hermetic:nccl_redist_init_repository.bzl",
      "nccl_redist_init_repository",
   )

   nccl_redist_init_repository()

   load(
      "@tsl//third_party/nccl/hermetic:nccl_configure.bzl",
      "nccl_configure",
   )

   nccl_configure(name = "local_config_nccl")
   ```

PiperOrigin-RevId: 662981325
2024-08-14 10:58:43 -07:00
jax authors
9f6857620b Disable TensorRT in TF, XLA and JAX.
This is needed for hermetic CUDA integration in Google ML projects since tensorRT is not distributed in the same free way as other CUDA/CUDNN distributives.

PiperOrigin-RevId: 662601190
2024-08-13 11:58:31 -07:00
Jieying Luo
abe7982d65 Remove enable_gpu and xla_python_enable_gpu from jax .bazelrc.
The plugin is released and the flag is no longer needed.

Also set default value of enable_gpu to False. enable_gpu will be removed in the next change.

PiperOrigin-RevId: 660059432
2024-08-06 12:39:45 -07:00
Jieying Luo
bc0229a61f Rollback as it broke some tests.
Reverts ff17b76e3eec3e573788f64fafe23fabcfc09ce2

PiperOrigin-RevId: 658557091
2024-08-01 15:21:42 -07:00
Jieying Luo
ff17b76e3e Cleanup. Remove build:cuda_plugin and set enable_gpu and xla_python_enable_gpu to false in build:cuda.
JAX already migrated from jaxlib[cuda] to cuda plugin.

PiperOrigin-RevId: 658508037
2024-08-01 12:59:12 -07:00
Michael Hudgins
cddb8f2d88 Upgrade to support and default to clang 18 for the OSS compiler
PiperOrigin-RevId: 651080905
2024-07-10 10:56:47 -07:00
Peter Hawkins
945fde41e4 Update minimum Python version to 3.10. 2024-06-26 13:47:14 -04:00
Ruturaj4
99c2b7b4e9 [ROCm] Bring-up pjrt support 2024-06-17 16:49:22 +00:00
Adam Paszke
cfe64cd5ce [Mosaic GPU] Integrate the ExecutionEngine with the jaxlib GPU plugin
This lets us avoid bundling a whole another copy of LLVM with JAX packages
and so we can finally start building Mosaic GPU by default.

PiperOrigin-RevId: 638569750
2024-05-30 01:46:23 -07:00
Henning Becker
15a1985445 Update cuDNN to version 9.1.1 in JAX
PiperOrigin-RevId: 636956696
2024-05-24 10:10:21 -07:00
Nitin Srinivasan
0f4dff5580 Remove redundant commands from the RBE cross-compile build scripts
This removes commands that set up Python and JAX's build-time Python dependencies. These are now handled automatically by Bazel with hermetic Python.

We also no longer need to force Genrules to run locally to be able to set up `local_config_python` correctly.

This change should also resolve build failures in the cross-compile builds.

PiperOrigin-RevId: 636030000
2024-05-21 22:00:47 -07:00
Vadym Matsishevskyi
517e299a9d Use hermetic Python in JAX, see "Managing hermetic Python" in developer.md for details
PiperOrigin-RevId: 634146391
2024-05-15 18:20:56 -07:00
jax authors
fb65ba4adf Add a config for using Clang on Windows.
PiperOrigin-RevId: 631112031
2024-05-06 10:39:28 -07:00
Adam Paszke
8e3f5b1018 Initial commit for Mosaic GPU
Moving this to JAX to make it easier to explore Pallas integration.

PiperOrigin-RevId: 625982382
2024-04-18 04:04:10 -07:00
jax authors
0be07e6aec Remove support for CUDA 11.
Pin minimal required versions for CUDA to 12.1.

Reverts 910a31d7b7510e3375718ab1ea0d38df7bd2c0d5

PiperOrigin-RevId: 618911489
2024-03-25 11:46:39 -07:00
jax authors
910a31d7b7 Reverts bed4f65438a62777ed100ecec2b0eb3f7cf87a0e
PiperOrigin-RevId: 618249855
2024-03-22 12:10:53 -07:00
jax authors
bed4f65438 Remove support for CUDA 11.
Pin minimal required versions for CUDA to 12.1.

PiperOrigin-RevId: 618195554
2024-03-22 09:05:39 -07:00
Kanglan Tang
3f1330805c Add an experimental build-only continuous cross compile build for MacOS x86
PiperOrigin-RevId: 617611779
2024-03-20 13:43:45 -07:00
Kanglan Tang
f0afc1b43d Add an experimental build-only continuous cross compile build for Linux Aarch64
PiperOrigin-RevId: 613624879
2024-03-07 10:17:43 -08:00
David Dunleavy
6928465b87 Add --use_clang and --clang_path options to build.py
PiperOrigin-RevId: 603837975
2024-02-02 18:20:44 -08:00
Nitin Srinivasan
b58772cdb4 Enable Bazel remote cache in macOS continuous builds
PiperOrigin-RevId: 597100776
2024-01-09 18:30:31 -08:00