Repository navigation
docs(pytorch): document the sccache compiler cache #9560
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
Open
subodh-dubey-amd
wants to merge
2
commits into
main
Choose a base branch
from
users/subodube/pytorch-cache-docs
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,6 +10,7 @@ Table of contents: | |
|
|
||
| - [Support status](#support-status) | ||
| - [Build instructions](#build-instructions) | ||
| - [Compiler cache](#compiler-cache) | ||
| - [Running/testing PyTorch](#runningtesting-pytorch) | ||
| - [Advanced build instructions](#advanced-build-instructions) | ||
| - [Development instructions](#development-instructions) | ||
|
|
@@ -204,6 +205,46 @@ mix/match build steps. | |
| --output-dir %HOME%/tmp/pyout | ||
| ``` | ||
|
|
||
| ## Compiler cache | ||
|
|
||
| PyTorch wheel builds cache compiles with | ||
| [sccache](https://github.com/mozilla/sccache), not the ccache setup that covers | ||
| TheRock's CMake stages (see | ||
| [CCache Troubleshooting](/docs/development/ccache_troubleshooting.md)). | ||
|
|
||
| ### Local builds | ||
|
|
||
| Pass `--use-sccache` or `--use-ccache` (not both) to `build_prod_wheels.py build`: | ||
|
|
||
| - `--use-sccache` sets the CMake C/C++ compiler launchers and, on Linux, | ||
| `HIP_CLANG_LAUNCHER`, so hipcc also routes HIP device compiles through | ||
| sccache. | ||
| - `--sccache-no-wrap` skips `HIP_CLANG_LAUNCHER` and caches host C/C++ only, | ||
| for hipcc from ROCm older than 7.13. | ||
|
|
||
| sccache must be installed, and it uses its own configuration (a local disk | ||
| cache unless you point it elsewhere). See | ||
| [`setup_sccache_rocm.py`](/build_tools/setup_sccache_rocm.py). | ||
|
|
||
| ### CI and release builds | ||
|
|
||
| The Linux and Windows wheel workflows default to `cache_type: sccache` | ||
| (`ccache` and `none` are also accepted) and store entries in S3, with a bucket | ||
| and an OIDC-assumed IAM role per release type (see | ||
| [cache buckets](/docs/development/s3_buckets.md#cache-buckets)): | ||
|
|
||
| | Builds | Bucket | Key prefix | | ||
| | ------- | ---------------------------------------- | ------------------------------------------------------ | | ||
| | CI | `therock-pytorch-sccache-ci` | `linux/<artifact_group>/`, `windows/<artifact_group>/` | | ||
| | Release | `therock-pytorch-sccache-<release_type>` | `linux/multiarch/v1/`, `windows/multiarch/v1/` | | ||
|
Comment on lines
+229
to
+239
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok to document what exists, but we should complete the work and limit to always |
||
|
|
||
| `dev-bkc` and `nightly-bkc` release builds use the `dev` and `nightly` buckets. | ||
|
|
||
| Fork pull requests, and runs outside `ROCm/TheRock`, cannot assume the role, so | ||
| [`compute_pytorch_cache_type.py`](/build_tools/github_actions/compute_pytorch_cache_type.py) | ||
| switches the CI workflows to `cache_type=none` for them and they build | ||
| uncached. Each workflow prints `sccache --show-stats` after the build. | ||
|
|
||
| ## Running/testing PyTorch | ||
|
|
||
| ### Prerequisites | ||
|
|
||
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.
Ok to document what currently exists, but we should set
-DCMAKE_HIP_COMPILER_LAUNCHER=ccacheinstead now, on both Linux and Windows. See #8824We're missing out of a large number of potential cache hits with the current code here:
TheRock/build_tools/setup_sccache_rocm.py
Lines 93 to 98 in b690ead
See also the "Optimizing the PyTorch build" section on this recent comment of mine: #7346 (comment)
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 have a fix for this ready, preparing a PR now.
We'll just set all three compiler launchers on both platforms, as that works now. I'll also delete
build_tools/setup_sccache_rocm.pyfor now since there's no meaningful logic left in the file now, but we can add it back later if we want to configure the remote cache server based on release type, job triggers, etc. in there.