Refactor do_build in build_prod_wheels.py for reviewability#3389
Refactor do_build in build_prod_wheels.py for reviewability#3389subodh-dubey-amd wants to merge 2 commits intomainfrom
do_build in build_prod_wheels.py for reviewability#3389Conversation
do_build in build_prod_wheels.py for reviewability**do_build in build_prod_wheels.py for reviewability
| "PYTORCH_ROCM_ARCH": pytorch_rocm_arch, | ||
| "USE_KINETO": os.environ.get("USE_KINETO", "ON" if not is_windows else "OFF"), |
There was a problem hiding this comment.
FYI, I don't see either of these variables referenced in https://github.com/pytorch/vision/ or https://github.com/pytorch/audio/, but including them in the env used for all builds is probably harmless.
We could try moving some of these env vars out of "common" and into do_build_pytorch around here:
TheRock/external-builds/pytorch/build_prod_wheels.py
Lines 742 to 747 in 0c6d06a
(fine to keep this PR as a pure code move, without changing behavior, then attempt that later)
There was a problem hiding this comment.
Agreed — both are pytorch-only but PYTORCH_ROCM_ARCH is read from env in do_build_pytorch() for flash attention checks, so moving it needs a param change. Keeping as-is for pure code move; tracked in #3425.
| env: dict[str, str] = { | ||
| "PYTHONUTF8": "1", # Some build files use utf8 characters, force IO encoding | ||
| "CMAKE_PREFIX_PATH": str(cmake_prefix), | ||
| "ROCM_HOME": str(rocm_dir), | ||
| "ROCM_PATH": str(rocm_dir), |
There was a problem hiding this comment.
The line is pretty blurry here for what env setup goes in do_build() or _do_build_wheels_core(). Maybe we could add a dedicated setup_common_build_env() function that would contain all of this code?
TheRock/external-builds/pytorch/build_prod_wheels.py
Lines 392 to 478 in 0c6d06a
There was a problem hiding this comment.
Updated. Extracted all env construction into a dedicated _setup_common_build_env() function.
…able configuration for wheel builds.
|
Code changes seem fine but I want to wait until #3432 clears and we get a clean CI run before approving. See failures at https://github.com/ROCm/TheRock/actions/runs/22062019834/job/63760343692?pr=3389. |
Motivation
Preparatory refactor for sccache integration (PR #3171). Addresses reviewer feedback on
build_prod_wheels.pybeing hard to review due to a single largedo_build()function.Technical Details
do_build()into new_do_build_wheels_core()helper.do_build()now handles only setup/orchestration and delegates to the helper.get_rocm_path("root")calls with therocm_dirparameter.Test Result
No functional changes — refactored code follows the same execution path as before.
After dedicated
_setup_common_build_env()function:Submission Checklist