Skip to content
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

Refactor JAX wheel build rules to control the wheel filename and maintain reproducible wheel content and filename results. #2949

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

copybara-service[bot]
Copy link

@copybara-service copybara-service bot commented Nov 26, 2024

Refactor JAX wheel build rules to control the wheel filename and maintain reproducible wheel content and filename results.

This change is a part of the initiative to test the JAX wheels in the presubmit properly.

The list of the changes:

  1. JAX wheel build rule verifies that --@local_config_cuda//cuda:include_cuda_libs=false during the wheel build. There is a way to pass the restriction by providing --@local_config_cuda//cuda:override_include_cuda_libs=true.

  2. The JAX version number (which is also used in the wheel filenames) is stored in _version variable in the file version.py. The custom repository rule jax_python_wheel_version_repository saves this value in wheel_version.bzl, so it becomes available in Bazel build phase.

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

    The version suffix chunks that are not reproducible shouldn’t be calculated as a part of the wheel binary: for example, the current date changes every day, thus the wheels built today and tomorrow on the same code version will be technically different. To maintain reproducible wheel content, we need to pass suffix chunks in a form of environment variables.

  4. Environment variables combinations for creating wheels with different versions:

  • 0.5.1.dev0+selfbuilt (local build, default build rule behavior): --repo_env=ML_WHEEL_TYPE=snapshot
  • 0.5.1 (release): --repo_env=ML_WHEEL_TYPE=release
  • 0.5.1rc1 (release candidate): --repo_env=ML_WHEEL_TYPE=release --repo_env=ML_WHEEL_VERSION_SUFFIX=rc1
  • 0.5.1.dev20250128+3e75e20c7 (nightly build): --repo_env=ML_WHEEL_TYPE=custom --repo_env=ML_WHEEL_BUILD_DATE=20250128 --repo_env=ML_WHEEL_GIT_HASH=$(git rev-parse HEAD)

@copybara-service copybara-service bot changed the title Test new approach. Refactor JAX build wheel rule and add py_import targets. Jan 17, 2025
@copybara-service copybara-service bot changed the title Refactor JAX build wheel rule and add py_import targets. Refactor JAX wheel build rules to control the wheel filename and maintain reproducible wheel content and filename results. Jan 17, 2025
@copybara-service copybara-service bot force-pushed the test_699315679 branch 5 times, most recently from aba4c62 to 7c3bd7b Compare January 27, 2025 22:19
@copybara-service copybara-service bot force-pushed the test_699315679 branch 2 times, most recently from 7269f55 to 7e7cb11 Compare January 29, 2025 02:01
…tain reproducible wheel content and filename results.

This change is a part of the initiative to test the JAX wheels in the presubmit properly.

The list of the changes:
1. JAX wheel build rule verifies that `--@local_config_cuda//cuda:include_cuda_libs=false` during the wheel build. There is a way to pass the restriction by providing `--@local_config_cuda//cuda:override_include_cuda_libs=true`.

2. The JAX version number (which is also used in the wheel filenames) is stored in `_version` variable in the file [version.py](https://github.com/jax-ml/jax/blob/main/jax/version.py). The custom repository rule `jax_python_wheel_version_repository` saves this value in `wheel_version.bzl`, so it becomes available in Bazel build phase.

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

   The version suffix chunks that are not reproducible shouldn’t be calculated as a part of the wheel binary: for example, the current date changes every day, thus the wheels built today and tomorrow on the same code version will be technically different. To maintain reproducible wheel content, we need to pass suffix chunks in a form of environment variables.

4. Environment variables combinations for creating wheels with different versions:
  * `0.5.1.dev0+selfbuilt` (local build, default build rule behavior): `--repo_env=ML_WHEEL_TYPE=snapshot`
  * `0.5.1` (release): `--repo_env=ML_WHEEL_TYPE=release`
  * `0.5.1rc1` (release candidate): `--repo_env=ML_WHEEL_TYPE=release --repo_env=ML_WHEEL_VERSION_SUFFIX=rc1`
  * `0.5.1.dev20250128+3e75e20c7` (nightly build): `--repo_env=ML_WHEEL_TYPE=custom --repo_env=ML_WHEEL_BUILD_DATE=20250128 --repo_env=ML_WHEEL_GIT_HASH=$(git rev-parse HEAD)`

PiperOrigin-RevId: 699315679
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant