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

Remove usage of environment variables in wheel building #9583

Merged
merged 5 commits into from
Mar 25, 2025

Conversation

jathu
Copy link
Contributor

@jathu jathu commented Mar 25, 2025

Summary

We seem to be using a combination of CMAKE_ARGS and environment variables when creating wheels. Ultimately, CMake only uses the cmake args, however we redefine some of these flags as env vars to help setup.py determine if a certain feature is turned on. Specifically, it looks for pybinding vars to bundle pybindings.

Let's remove this redundancy and just use the CMAKE_ARGS as the single source of truth. For more details and other considerations, see #9494 (abandoned).

Note that even in the wheel building jobs, we use cmake args instead of environment variables to control features:

CMAKE_ARGS="${CMAKE_ARGS} -DEXECUTORCH_BUILD_XNNPACK=ON"

CMAKE_ARGS="${CMAKE_ARGS} -DEXECUTORCH_BUILD_COREML=ON"
CMAKE_ARGS="${CMAKE_ARGS} -DEXECUTORCH_BUILD_MPS=ON"

Test plan

build + check CMakeCache.txt to ensure flags are set

# Expected: EXECUTORCH_BUILD_PYBIND=OFF EXECUTORCH_BUILD_XNNPACK=OFF EXECUTORCH_BUILD_COREML=OFF
$ rm -rf pip-out dist && ./install_executorch.sh --pybind off

# Expected: EXECUTORCH_BUILD_PYBIND=ON EXECUTORCH_BUILD_XNNPACK=ON EXECUTORCH_BUILD_COREML=OFF
$ rm -rf pip-out dist && ./install_executorch.sh

# Expected: EXECUTORCH_BUILD_PYBIND=ON EXECUTORCH_BUILD_XNNPACK=OFF EXECUTORCH_BUILD_COREML=ON
$ rm -rf pip-out dist && ./install_executorch.sh --pybind coreml

# Expected: EXECUTORCH_BUILD_PYBIND=ON EXECUTORCH_BUILD_XNNPACK=ON EXECUTORCH_BUILD_COREML=ON
$ rm -rf pip-out dist && ./install_executorch.sh --pybind xnnpack coreml

# Throws an error
$ rm -rf pip-out dist && ./install_executorch.sh --pybind coreml off

cc @larryliu0820 @lucylq

@jathu jathu added module: build/install Issues related to the cmake and buck2 builds, and to installing ExecuTorch ciflow/trunk labels Mar 25, 2025
Copy link

pytorch-bot bot commented Mar 25, 2025

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/9583

Note: Links to docs will display an error until the docs builds have been completed.

❌ 2 New Failures, 2 Pending, 2 Unrelated Failures

As of commit 69a5ba4 with merge base 7248b19 (image):

NEW FAILURES - The following jobs have failed:

BROKEN TRUNK - The following jobs failed but were present on the merge base:

👉 Rebase onto the `viable/strict` branch to avoid these failures

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Mar 25, 2025
@jathu jathu force-pushed the jathu/use-cmake-args branch 3 times, most recently from d1a3972 to 578e720 Compare March 25, 2025 17:10
@jathu jathu force-pushed the jathu/use-cmake-args branch from 578e720 to 4c96f33 Compare March 25, 2025 17:28
@jathu jathu force-pushed the jathu/use-cmake-args branch from 4c96f33 to 93f6112 Compare March 25, 2025 17:54
@jathu jathu marked this pull request as ready for review March 25, 2025 17:55
Copy link
Contributor

@mergennachin mergennachin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See inline comment

@jathu jathu force-pushed the jathu/use-cmake-args branch from 6949e35 to 5501b06 Compare March 25, 2025 18:39
@jathu jathu requested a review from mergennachin March 25, 2025 18:40
@jathu jathu force-pushed the jathu/use-cmake-args branch from b989433 to 36ae47e Compare March 25, 2025 18:51
@jathu jathu force-pushed the jathu/use-cmake-args branch from 63c33b8 to a5e6fcf Compare March 25, 2025 19:35
@jathu jathu force-pushed the jathu/use-cmake-args branch from a5e6fcf to 69a5ba4 Compare March 25, 2025 20:49
@jathu jathu merged commit be3c1ec into main Mar 25, 2025
265 of 269 checks passed
@jathu jathu deleted the jathu/use-cmake-args branch March 25, 2025 22:10
@jathu jathu mentioned this pull request Mar 31, 2025
jathu added a commit that referenced this pull request Mar 31, 2025
### Summary
After #9583 and
#9611, we don't rely on
environment variables to turn on pybindings.

### Test plan

Read + run example commands.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ciflow/binaries ciflow/trunk CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. module: build/install Issues related to the cmake and buck2 builds, and to installing ExecuTorch topic: not user facing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants