-
Notifications
You must be signed in to change notification settings - Fork 747
Use sccache to accelerate android build #9587
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
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
0c2c7bc
[TEST] Try to see if sccache is in use
kirklandsign 3ff84b0
Update _android.yml
kirklandsign 9350bd3
Update pull.yml
kirklandsign 35c7080
Trigger sccache
kirklandsign e97df94
Update
kirklandsign 2041aa1
Use stub in docker
kirklandsign 35592ef
Update install_cache.sh
kirklandsign b14d160
Update install_cache.sh
kirklandsign 06727c3
Set in yml
kirklandsign File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What are your thoughts on exporting this in .ci/scripts/setup-linux.sh so we get it for all CI builds?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would rely on https://github.com/pytorch/executorch/blob/main/.ci/docker/common/install_cache.sh#L47 to trigger sccache for general linux.
Seems that if I put these in https://github.com/pytorch/executorch/blob/main/.ci/scripts/setup-linux.sh, it will be used not only on android, but generic, and I would avoid doing that to mess up with the set up above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally, I'm hoping we can find one place to change and export these variables instead of multiple places. If someone adds another android job, they do not get caching if they forget these lines
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO, you could try the simpler fix to install NDK before sccache in https://github.com/pytorch/executorch/blob/main/.ci/docker/ubuntu/Dockerfile#L57-L83. We install sccache as part of building Docker image and
/opt/cache/binis added to PATH in https://github.com/pytorch/executorch/blob/main/.ci/docker/common/install_cache.sh#L43. Atm, installing NDK happens after installing sccache, so I guess NDK path takes the priority?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry not sure if that's the situation here. Currently for android build, clang path is /opt/ndk/toolchains/llvm/prebuilt/...bin and we should not use /opt/cache/bin/clang (stub which points to the system clang)?
Basically for android, we need /opt/ndk/.../clang to point to a stub as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using a stub works transparently as part of the Docker image. Setting
CMAKE_CXX_COMPILER_LAUNCHERneeds to be done later, i.e. people need to remember to set that explicitly.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Honestly I feel like it's hard to do stub... In NDK we have so many variants of clang
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kirklandsign I think you can use $ANDROID_NDK/ndk-which clang to get the specific location
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jathu I can have a try - just use
clanginstead of these variants (which are basically forclang --target=x86_64-linux-android21stuff)I was just worried if somehow android NDK triggered
clangviax86_64-linux-android21-clangnotclangThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@huydhn @jathu I feel like for android it's still hard to get the stub working. See error like https://github.com/pytorch/executorch/actions/runs/14115338695/job/39544105035?pr=9587 for my version f2e12cb#diff-0a862d15a4e6dff44196719a594b983aece596c7dc38eba416d83e12a95206e6R92.