Be able to compile in offline mode #7305
Merged
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.
Summary
Currently, during compilation via cmake, we can't do it in offline environments (e.g., doing development in airplane) for instance.
There are two things we can do:
Currently, we are downloading buck2 from the internet. This is fine, but we're downloading every time we
rm -rf cmake-outfile. Let's just download once and save insideexecutorch/buck2-bin/folder directly instead ofexecutorch/cmake-out/buck2-bin/. That way, you will most likely have the necessary buck2 binary downloaded/cached and rarely deleted. There's little reason to delete this directory.FXDiv is getting downloaded if it is not defined. https://github.com/google/XNNPACK/blob/effe4ca0631f3fb0dac9551dab6f1d8a2eaabba2/CMakeLists.txt#L355. However, this is an oversight, since we actually have it already (https://github.com/pytorch/executorch/blob/main/.gitmodules#L19), just haven't set the environment variable appropriately.
Test plan
(mkdir cmake-out && cd cmake-out && cmake ..)