Refactor JAX wheel build rules to control the wheel filename and maintain reproducible wheel content and filename results. #2949
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.
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:
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
.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 rulejax_python_wheel_version_repository
saves this value inwheel_version.bzl
, so it becomes available in Bazel build phase.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.
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)