Skip to content

docs(pytorch): document the sccache compiler cache - #9560

Open
subodh-dubey-amd wants to merge 2 commits into
mainfrom
users/subodube/pytorch-cache-docs
Open

subodh-dubey-amd wants to merge 2 commits into
mainfrom
users/subodube/pytorch-cache-docs

Conversation

@subodh-dubey-amd

Copy link
Copy Markdown
Contributor

ISSUE ID : #9559

Motivation

Technical Details

  • Adds a "Compiler cache" section to external-builds/pytorch/README.md:
    • local builds: --use-sccache / --use-ccache and --sccache-no-wrap;
    • CI and release builds: S3 bucket, IAM role and key prefix per release type;
    • fork PRs build uncached (compute_pytorch_cache_type.py).
  • Once ci(jax): serve the JAX wheel build from the EngFlow Bazel cache #7912 merges, the PyTorch row of its cache table in ccache_troubleshooting.md can point here.

Test Plan

  • pre-commit run --files external-builds/pytorch/README.md.
  • Checked each statement against build_prod_wheels.py, setup_sccache_rocm.py, compute_pytorch_cache_type.py, the Linux and Windows PyTorch wheel workflows, and s3_buckets.md.

Test Result

  • pre-commit passes, and every link in the new section resolves.

Submission Checklist

@therock-pr-bot

therock-pr-bot Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

✅ All Checks Passed — Ready for Review

Check Status Details
📝 PR Description ✅ Pass —
⛔ Forbidden Files ✅ Pass —
🧪 Unit Test ✅ Pass PR does not contain code files — Unit Test auto-passed
🔎 pre-commit ✅ Pass —
🚫 Draft PR 🔜 To Be Enabled —
🚩 Feature Flag 🔜 To Be Enabled —
📊 Code Coverage 🔜 To Be Enabled —
🤖 therock-pr-bot ✅ Pass —

🎉 All checks passed! This PR is ready for review.

📖 Need help? See the Policy FAQ for details on every check and how to fix failures.

🙋 Wish to Override Policy?

@therock-pr-bot

Copy link
Copy Markdown

🎉 All checks passed! This PR is ready for review.

@subodh-dubey-amd
subodh-dubey-amd marked this pull request as ready for review October 28, 2026 15:49
Comment on lines +219 to +221
- `--use-sccache` sets the CMake C/C++ compiler launchers and, on Linux,
`HIP_CLANG_LAUNCHER`, so hipcc also routes HIP device compiles through
sccache.

Copy link
Copy Markdown
Member

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=ccache instead now, on both Linux and Windows. See #8824

We're missing out of a large number of potential cache hits with the current code here:

env = {
"CMAKE_C_COMPILER_LAUNCHER": str(sccache_path),
"CMAKE_CXX_COMPILER_LAUNCHER": str(sccache_path),
}
if hip_launcher and not is_windows:
env["HIP_CLANG_LAUNCHER"] = str(sccache_path)

See also the "Optimizing the PyTorch build" section on this recent comment of mine: #7346 (comment)

Copy link
Copy Markdown
Member

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.py for 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.

Comment on lines +229 to +239
### 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/` |

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The 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 sscache. Keeping the multiple options was an experiment, and the experiment is over now :)

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: TODO

Development

Successfully merging this pull request may close these issues.

2 participants