Skip to content

[torch] Streamline sccache setup and enable for HIP on Windows - #9744

Open
ScottTodd wants to merge 1 commit into
mainfrom
users/scotttodd/torch-sccache-cleanup
Open

ScottTodd wants to merge 1 commit into
mainfrom
users/scotttodd/torch-sccache-cleanup

Conversation

@ScottTodd

@ScottTodd ScottTodd commented Nov 4, 2026 •

Copy link
Copy Markdown
Member

Motivation

We were setting:

CMAKE_C_COMPILER_LAUNCHER=sccache
CMAKE_CXX_COMPILER_LAUNCHER=sccache
# Linux-only
HIP_CLANG_LAUNCHER=sccache

We can now just set these options for both platforms:

CMAKE_C_COMPILER_LAUNCHER=sccache
CMAKE_CXX_COMPILER_LAUNCHER=sccache
CMAKE_HIP_COMPILER_LAUNCHER=sccache

This will improve build performance (especially on Windows) and allows us to remove layers of indirection in build_tools/setup_sccache_rocm.py.

See also:

Technical Details

The remote cache server we use is still configured directly in workflow .yml files such as

# TODO: Move the sccache bucket and IAM role mapping into a shared script.
SCCACHE_BUCKET: >-
${{
inputs.release_type == 'dev-bkc' && 'therock-pytorch-sccache-dev'
|| inputs.release_type == 'nightly-bkc' && 'therock-pytorch-sccache-nightly'
|| format('therock-pytorch-sccache-{0}', inputs.release_type)
}}
SCCACHE_REGION: us-east-1
SCCACHE_S3_KEY_PREFIX: "linux/multiarch/v1/"
SCCACHE_S3_USE_SSL: "true"
SCCACHE_S3_SERVER_SIDE_ENCRYPTION: "true"
SCCACHE_IDLE_TIMEOUT: "0" # never idle-out; keeps stats accurate on long builds
SCCACHE_LOG: warn

This PR deletes build_tools/setup_sccache_rocm.py as it reduced down to 3 lines of code, but we could add it back or merge with build_tools/github_actions/compute_pytorch_cache_type.py in the style of build_tools/setup_ccache.py - having the script write the configuration (server to use, other settings).

Test Plan

Local testing on Windows

Expand for repro commands

rustup update stable
cargo install sccache --locked
sccache --version
# sccache 0.19.0

cd external-builds\pytorch\
python -m venv .venv && .venv\Scripts\activate.bat
pip install --index-url https://nightly.repo.amd.com/rocm/whl-next/ rocm[libraries,devel,device-gfx1100]
pip install -r packaging

python pytorch_torch_repo.py checkout ^
    --gitrepo-origin https://github.com/ROCm/pytorch.git ^
    --repo-hashtag release/2.14 ^
    --checkout-dir D:/b/pytorch

# three times
#    1. cold cache
#    2. cache with CMAKE_HIP_COMPILER_LAUNCHER
#    3. cache without CMAKE_HIP_COMPILER_LAUNCHER
python build_prod_wheels.py build ^
    --pytorch-dir D:/b/pytorch ^
    --no-build-pytorch-audio --no-build-pytorch-vision ^
    --pytorch-rocm-arch=gfx1100 ^
    --output-dir %HOME%/.therock/pytorch ^
    --use-sccache

Cache status Build time C/C++ cache hit rate HIP cache hit rate
Cold cache 24 minutes 0.00% 0.00%
Warm cache without CMAKE_HIP_COMPILER_LAUNCHER 11 minutes 72.30% 0.00%
Warm cache with CMAKE_HIP_COMPILER_LAUNCHER 6 minutes 72.30% 100.00%

CI testing on Linux and Windows

I re-ran CI jobs to check cache behavior:

Submission Checklist

@therock-pr-bot

therock-pr-bot Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

✅ All Policy Checks Passed

Check Status Details
📝 PR Description ✅ Pass —
⛔ Forbidden Files ✅ Pass —
🧪 Unit Test ⚠️ Warning Error: Source/code files changed without an accompanying unit test.
Expected: add at least one test file named like test_<name>.py / test_<name>.cpp (or <name>_test.*).
Current: code file(s) changed: external-builds/pytorch/build_prod_wheels.py; no test file found
🚫 Draft PR 🔜 To Be Enabled —
🚩 Feature Flag 🔜 To Be Enabled —
📊 Code Coverage 🔜 To Be Enabled —

🎉 All policy checks passed!

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

🙋 Wish to Override Policy?

@therock-pr-bot

therock-pr-bot Bot commented Nov 4, 2026

Copy link
Copy Markdown

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

@ScottTodd ScottTodd added ci:skip-rocm Skip ROCm builds and tests; use published ROCm packages for frameworks ci:skip-jax Skip JAX package builds labels Nov 4, 2026
@ScottTodd
ScottTodd marked this pull request as ready for review November 4, 2026 22:09
@ScottTodd
ScottTodd requested a review from ethanwee1 as a code owner November 4, 2026 22:09

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

ci:skip-jax Skip JAX package builds ci:skip-rocm Skip ROCm builds and tests; use published ROCm packages for frameworks

Projects

Status: TODO

Development

Successfully merging this pull request may close these issues.

1 participant