-
Notifications
You must be signed in to change notification settings - Fork 1
Enable RBE for builds and test #151
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
charleshofer
wants to merge
7
commits into
master
Choose a base branch
from
add-rbe-configs
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
5ab921a
Enable RBE for builds
charleshofer 42f15cc
Run Bazel tests with RBE
charleshofer 65e3983
Split JAX build and test images
charleshofer 6766cb4
Disable build caching
charleshofer 4b36d04
Fix PR testing
charleshofer 7f12b40
Add patches for JAX tests
charleshofer 793a9bd
Add wheel download
charleshofer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| #!/bin/bash | ||
|
|
||
| set -ex | ||
|
|
||
| # Fail gracefully if there's no ./jax directory | ||
| if [ ! -d ./jax ]; then | ||
| echo "ERROR: ./jax directory does not exist" | ||
| fi | ||
|
|
||
| # (charleshofer) This might create a dependency we don't want, but we can | ||
| # remove this once platform information is stored in the XLA project. | ||
| # Give platform information to JAX | ||
| cp -r jax_rocm_plugin/platform jax/ | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| #!/bin/bash | ||
|
|
||
| set -ex | ||
|
|
||
| args=("$@") | ||
| JAX_VERSION="${args[0]}" | ||
| PYTHON="${args[1]}" | ||
|
|
||
| ROCM_JAX_DIR=$(realpath ".") | ||
| JAX_DIR=$(realpath "./jax") | ||
| WHEELHOUSE=$(realpath "./wheelhouse") | ||
|
|
||
|
|
||
| pushd "${ROCM_JAX_DIR}" || exit | ||
|
|
||
| if [ ! -d "${JAX_DIR}" ]; then | ||
| git clone -b "release/${JAX_VERSION}" --depth 1 "${JAX_DIR}" | ||
| fi | ||
|
|
||
| pushd "${JAX_DIR}" || exit | ||
|
|
||
| # If we haven't stuck the plugin requirements in the requirements.in file yet, put them in | ||
| if ! grep -q jax_rocm7 build/requirements.in; then | ||
| { | ||
| echo "jaxlib==${JAX_VERSION}" | ||
| echo "${WHEELHOUSE}/jax_rocm7_pjrt-${JAX_VERSION}-py3-none-manylinux_2_28_x86_64.whl" | ||
| echo "${WHEELHOUSE}/jax_rocm7_plugin-${JAX_VERSION}-cp${PYTHON//.}-cp${PYTHON//.}-manylinux_2_28_x86_64.whl" | ||
| } >> build/requirements.in | ||
| fi | ||
|
|
||
| python3 build/build.py requirements_update --python="${PYTHON}" | ||
| python3 build/build.py build --wheels=jax-rocm-plugin --configure_only --python_version="${PYTHON}" | ||
|
|
||
| ./bazel-7.4.1-linux-x86_64 \ | ||
| --bazelrc=.bazelrc \ | ||
| --bazelrc=../jax_rocm_plugin/rbe.bazelrc \ | ||
| test \ | ||
| --config=rocm \ | ||
| --config=rocm_rbe \ | ||
| --noremote_accept_cached \ | ||
| --//jax:build_jaxlib=false \ | ||
| --action_env=TF_ROCM_AMDGPU_TARGETS="gfx906,gfx908,gfx90a,gfx942,gfx950,gfx1030,gfx1100,gfx1101,gfx1200,gfx1201" \ | ||
| --test_verbose_timeout_warnings \ | ||
| --test_output=errors \ | ||
| //tests:core_test_gpu \ | ||
| //tests:linalg_test_gpu | ||
|
|
83 changes: 83 additions & 0 deletions
83
ci/patches/0001-Enable-testing-with-ROCm-plugin-wheels.patch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,83 @@ | ||
| From 5e6d27b98b054bd110efb24e4fad34454f513a94 Mon Sep 17 00:00:00 2001 | ||
| From: Charles Hofer <[email protected]> | ||
| Date: Wed, 5 Nov 2025 01:25:50 +0000 | ||
| Subject: [PATCH] Enable testing with ROCm plugin wheels | ||
|
|
||
| --- | ||
| WORKSPACE | 2 ++ | ||
| jaxlib/jax.bzl | 8 +++++--- | ||
| jaxlib/tools/BUILD.bazel | 19 +++++++++++++++++++ | ||
| 3 files changed, 26 insertions(+), 3 deletions(-) | ||
|
|
||
| diff --git a/WORKSPACE b/WORKSPACE | ||
| index 9061b65ab..c42aa005e 100644 | ||
| --- a/WORKSPACE | ||
| +++ b/WORKSPACE | ||
| @@ -31,6 +31,8 @@ python_init_repositories( | ||
| "jaxlib*", | ||
| "jax_cuda*", | ||
| "jax-cuda*", | ||
| + "jax_rocm*", | ||
| + "jax-rocm*", | ||
| ], | ||
| local_wheel_workspaces = ["//jaxlib:jax.bzl"], | ||
| requirements = { | ||
| diff --git a/jaxlib/jax.bzl b/jaxlib/jax.bzl | ||
| index dfa7657e6..1d5b5f4cf 100644 | ||
| --- a/jaxlib/jax.bzl | ||
| +++ b/jaxlib/jax.bzl | ||
| @@ -192,8 +192,10 @@ def _gpu_test_deps(): | ||
| "//jax_plugins:gpu_plugin_only_test_deps", | ||
| ], | ||
| "//jax:config_build_jaxlib_false": [ | ||
| - "//jaxlib/tools:pypi_jax_cuda_plugin_with_cuda_deps", | ||
| - "//jaxlib/tools:pypi_jax_cuda_pjrt_with_cuda_deps", | ||
| + "//jaxlib/tools:rocm_plugin_kernels_wheel", | ||
| + "//jaxlib/tools:rocm_plugin_pjrt_wheel", | ||
| + #"//jaxlib/tools:pypi_jax_cuda_plugin_with_cuda_deps", | ||
| + #"//jaxlib/tools:pypi_jax_cuda_pjrt_with_cuda_deps", | ||
| ], | ||
| "//jax:config_build_jaxlib_wheel": [ | ||
| "//jaxlib/tools:jax_cuda_plugin_py_import", | ||
| @@ -300,7 +302,7 @@ def jax_multiplatform_test( | ||
| shard_count = test_shards, | ||
| tags = test_tags, | ||
| main = main, | ||
| - exec_properties = tf_exec_properties({"tags": test_tags}), | ||
| + exec_properties = {} #tf_exec_properties({"tags": test_tags}), | ||
| ) | ||
|
|
||
| def jax_generate_backend_suites(backends = []): | ||
| diff --git a/jaxlib/tools/BUILD.bazel b/jaxlib/tools/BUILD.bazel | ||
| index 58fbfd734..57cbd4252 100644 | ||
| --- a/jaxlib/tools/BUILD.bazel | ||
| +++ b/jaxlib/tools/BUILD.bazel | ||
| @@ -564,6 +564,25 @@ py_import( | ||
| wheel_deps = if_pypi_cuda_wheel_deps([":nvidia_wheel_deps"]), | ||
| ) | ||
|
|
||
| +filegroup( | ||
| + name = "rocm_wheel_deps", | ||
| + srcs = [ | ||
| + ], | ||
| +) | ||
| + | ||
| +# Targets for importing ROCm plugin wheels | ||
| +py_import( | ||
| + name = "rocm_plugin_kernels_wheel", | ||
| + wheel = "@pypi_jax_rocm7_plugin//:whl", | ||
| + wheel_deps = [":rocm_wheel_deps"], | ||
| +) | ||
| + | ||
| +py_import( | ||
| + name = "rocm_plugin_pjrt_wheel", | ||
| + wheel = "@pypi_jax_rocm7_pjrt//:whl", | ||
| + wheel_deps = [":rocm_wheel_deps"], | ||
| +) | ||
| + | ||
| # Mosaic GPU | ||
|
|
||
| py_binary( | ||
| -- | ||
| 2.34.1 | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldnt this be done automatically by bazel ? Why do we need to do this manually ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because these get applied to the rocm/jax that we use for test cases, not the jax-ml/jax we use for wheel builds. Maybe it'd be better to carry this as a change in the rocm/jax repo itself rather than a patch? I'd really rather not carry anything in that repo though, and it's unfortunate that we have to keep jaxlib changes in there right now.