Skip to content

Remove usage of external flatc in builds and scripts #9306

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

Merged
merged 1 commit into from
Mar 19, 2025

Conversation

jathu
Copy link
Contributor

@jathu jathu commented Mar 15, 2025

Summary

  • Remove the dependence of EXECUTORCH_BUILD_HOST_TARGETS since we always build flatc for the host now
  • Turn on EXECUTORCH_BUILD_FLATC if FLATC_EXECUTABLE is not set
  • Build flatc from source for Apple builds

Test Plan

Now macOS/Linux targeting macOS/Linux/iOS/Android should all build flatc from source:

$ rm -rf pip-out && ./install_executorch.sh
$ rm -rf cmake-out* && ./build/build_apple_frameworks.sh
$ rm -rf cmake-out* && ./build/build_android_library.sh

cc @larryliu0820 @lucylq

Copy link

pytorch-bot bot commented Mar 15, 2025

🔗 Helpful Links

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

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

✅ You can merge normally! (1 Unrelated Failure)

As of commit 3ec8bd8 with merge base 4c54bab (image):

UNSTABLE - The following job is marked as unstable, possibly due to flakiness on trunk:

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 15, 2025
@jathu jathu added module: build/install Issues related to the cmake and buck2 builds, and to installing ExecuTorch ciflow/trunk labels Mar 15, 2025
@github-project-automation github-project-automation bot moved this to To triage in ExecuTorch DevX Mar 15, 2025
@jathu jathu force-pushed the jathu/remove-flatc--build-apple branch 3 times, most recently from 8c9b1c8 to 609c745 Compare March 15, 2025 21:19
@jathu jathu changed the title Build flatc for Apple builds from source Remove usage of external flatc in builds and scripts Mar 15, 2025
@jathu jathu force-pushed the jathu/remove-flatc--build-apple branch 2 times, most recently from 31830f5 to 2a5d7d7 Compare March 16, 2025 18:12
@jathu jathu moved this from To triage to In progress in ExecuTorch DevX Mar 16, 2025
Copy link
Collaborator

@zingo zingo left a comment

Choose a reason for hiding this comment

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

Cheked/reviewed the Arm files, thanks for fixing this. I hope we can use the same solution for flatcc down the line if this work out good. Great work getting this annoyance fixed.

@jathu jathu marked this pull request as ready for review March 17, 2025 14:44
@jathu jathu force-pushed the jathu/remove-flatc--build-apple branch from 2a5d7d7 to ac6b9fd Compare March 17, 2025 14:45
@jathu jathu requested review from larryliu0820 and swolchok March 17, 2025 14:51
@mergennachin
Copy link
Contributor

@jathu are the CI failures related?

@jathu jathu force-pushed the jathu/remove-flatc--build-apple branch 2 times, most recently from 8acf205 to aa73a64 Compare March 17, 2025 22:20
@jathu jathu added the release notes: build Changes related to build, including dependency upgrades, build flags, optimizations, etc. label Mar 17, 2025
@jathu jathu force-pushed the jathu/remove-flatc--build-apple branch 2 times, most recently from 4943be0 to 4e3f774 Compare March 18, 2025 19:04
@jathu jathu marked this pull request as draft March 18, 2025 19:58
@jathu jathu force-pushed the jathu/remove-flatc--build-apple branch 2 times, most recently from bfb21f9 to e2c853d Compare March 18, 2025 21:44
@jathu jathu marked this pull request as ready for review March 18, 2025 23:04
@jathu jathu force-pushed the jathu/remove-flatc--build-apple branch from e2c853d to a40e1e4 Compare March 18, 2025 23:47
@jathu jathu force-pushed the jathu/remove-flatc--build-apple branch from a40e1e4 to 3ec8bd8 Compare March 19, 2025 15:31
@jathu
Copy link
Contributor Author

jathu commented Mar 19, 2025

@jathu are the CI failures related?

@mergennachin should be good now. The two failing arm tests are failing on main

@zingo
Copy link
Collaborator

zingo commented Mar 19, 2025

https://github.com/pytorch/executorch/actions/runs/13950476776/job/39048452046?pr=9306

Has not even run at all (or logs are missing?) there seem to be some major flakeness just running the arm test e.g. the CI seem to not start them as expected :(

The other job run but had a strange error, I retriggered both

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.

Shall we delete EXECUTORCH_BUILD_HOST_TARGETS option altogether from the repo?

There are still some remaining references un CmakeLists.txt and Utils.cmake

@jathu
Copy link
Contributor Author

jathu commented Mar 19, 2025

@mergennachin yes, #9404

@jathu jathu merged commit bcea345 into main Mar 19, 2025
257 of 259 checks passed
@jathu jathu deleted the jathu/remove-flatc--build-apple branch March 19, 2025 18:26
@github-project-automation github-project-automation bot moved this from In progress to Done in ExecuTorch DevX Mar 19, 2025
oscarandersson8218 pushed a commit to oscarandersson8218/executorch that referenced this pull request Mar 21, 2025
### Summary

* Remove the dependence of `EXECUTORCH_BUILD_HOST_TARGETS` since we
always build flatc for the host now
* Turn on `EXECUTORCH_BUILD_FLATC` if  `FLATC_EXECUTABLE` is not set
* Build flatc from source for Apple builds

### Test Plan

Now macOS/Linux targeting macOS/Linux/iOS/Android should all build flatc
from source:

```
$ rm -rf pip-out && ./install_executorch.sh
$ rm -rf cmake-out* && ./build/build_apple_frameworks.sh
$ rm -rf cmake-out* && ./build/build_android_library.sh
```

cc @larryliu0820 @lucylq
DannyYuyang-quic pushed a commit to CodeLinaro/executorch that referenced this pull request Apr 2, 2025
### Summary

* Remove the dependence of `EXECUTORCH_BUILD_HOST_TARGETS` since we
always build flatc for the host now
* Turn on `EXECUTORCH_BUILD_FLATC` if  `FLATC_EXECUTABLE` is not set
* Build flatc from source for Apple builds

### Test Plan

Now macOS/Linux targeting macOS/Linux/iOS/Android should all build flatc
from source:

```
$ rm -rf pip-out && ./install_executorch.sh
$ rm -rf cmake-out* && ./build/build_apple_frameworks.sh
$ rm -rf cmake-out* && ./build/build_android_library.sh
```

cc @larryliu0820 @lucylq
jathu pushed a commit that referenced this pull request Apr 24, 2025
### Summary
Removes EXECUTORCH_BUILD_HOST_TARGETS per @mergennachin
[comment](#9306 (review)).
Fixes #9404

### Test plan
Ensure executorch and cadence builds successfully:
```
./install_executorch.sh
mkdir cmake-out
cmake -DCMAKE_TOOLCHAIN_FILE=backends/cadence/cadence.cmake \
    -DCMAKE_INSTALL_PREFIX=cmake-out \
    -DCMAKE_BUILD_TYPE=Debug \
    -DPYTHON_EXECUTABLE=python3 \
    -DEXECUTORCH_BUILD_EXTENSION_RUNNER_UTIL=ON \
    -DEXECUTORCH_BUILD_HOST_TARGETS=ON \
    -DEXECUTORCH_BUILD_EXECUTOR_RUNNER=OFF \
    -DEXECUTORCH_BUILD_PTHREADPOOL=OFF \
    -DEXECUTORCH_BUILD_CPUINFO=OFF \
    -Bcmake-out .
cmake --build cmake-out -j8 --target install --config Debug
cmake -DCMAKE_BUILD_TYPE=Debug \
    -DCMAKE_TOOLCHAIN_FILE=examples/backends/cadence.cmake \
    -DCMAKE_PREFIX_PATH=cmake-out \
    -DMODEL_PATH=add.pte \
    -DNXP_SDK_ROOT_DIR=/home/user_name/nxp-sdk \
    -DNN_LIB_BASE_DIR=/home/user_name/nnlib-hifi4 \
    -Bcmake-out/examples/cadence \
    examples/cadence
cmake --build cmake-out/examples/cadence -j8 -t cadence_executorch_example
ls cmake-xt/*.bin
```
* Test plan assumes nxp-sdk and nnlib-hifir are in user's home directory
and Xtensa compiler is available (env vars set). See [cadence
docs](https://github.com/pytorch/executorch/blob/main/docs/source/backends-cadence.md)
* Since these are modifications to the build system, I leave it to
discretion if CI builds provide enough risk protection to merge.
* Happy to write tests if needed - I'll need a little direction here if
needed. #9306 ran `./install_executorch.sh`, `build_apple_frameworks.sh`
and `build_android_library.sh`.

---------

Co-authored-by: Mergen Nachin <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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 release notes: build Changes related to build, including dependency upgrades, build flags, optimizations, etc.
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants