← Back to Pull requests

CI: speed up wheel build with ccache #793

Closed
unknown closed this pull request without merging on Nov 24, 2026 15:27 UTC
View on GitHub
unknown unknown commented on Nov 05, 2026 12:32 UTC
Author

Description

Reduce the time of the build job in ROCm CI by caching compiler output across runs with ccache.

Wheel build step, gfx942 + gfx950 + gfx1250:

| | Time |
|---|---|
| Before (no cache) | 36.4 min |
| ccache, empty cache | 28.1 min |
| ccache, warm cache (116/116 hits) | 11.3 min |

With a warm cache, the C++/HIP compile takes under 2 min. Most of the remaining time is CMake configure, mostly the CK JIT step, which re-runs AITER codegen on every build and isn't covered by ccache. That step has taken 4–25 min on identical input, depending on the build node.

Type of change

  • Documentation change (change only to the documentation, either a fix or a new content)

  • Bug fix (non-breaking change which fixes an issue)

  • New feature (non-breaking change which adds functionality)

  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

  • Infra/Build change

  • Code refactoring
  • Changes

    build_tools/build_ext.py:

  • NVTE_USE_CCACHE=1 now also sets CMAKE_HIP_COMPILER_LAUNCHER. On ROCm the hipified .hip sources compile as the HIP language, so before this only .cpp files went through ccache. This also applies to local builds.
  • rocm-wheels-build.yml:

  • New rocm_arch input replaces the hardcoded NVTE_ROCM_ARCH. When empty, it falls back to gfx942,gfx950,gfx1250.

  • New use_ccache and save_ccache inputs, available on both workflow_call and workflow_dispatch. CI always turns ccache on (see rocm-ci.yml below). Both inputs default to off, so a manually started wheel build (e.g. for a release) builds from scratch unless ccache is selected. When enabled:

  • - ccache 4.14.2 (static musl build, sha256-pinned) is downloaded and mounted into the build container. The build image is unchanged.
    - The build sets NVTE_USE_CCACHE=1 and pins NVTE_CMAKE_BUILD_DIR to /TransformerEngine/build/cmake. The default build dir has a random name per run, which would make every lookup miss.
    - CCACHE_BASEDIR is set so absolute paths don't affect the hash, and CCACHE_COMPILERCHECK=content so a changed ROCm compiler invalidates the cache.
    - The cache is restored from and saved to the Actions cache. The key is the arch list plus a hash of the build Dockerfile.
    - Before saving, entries not used by the current build are evicted (ccache --evict-older-than <build duration>), so a saved cache only holds the current objects: 232 files, ~111 MB compressed for three archs. CCACHE_MAXSIZE is 1G as a safety cap.
    - ccache statistics are printed after the build.

    rocm-ci.yml:

  • ccache is enabled for every run. The cache is saved on pushes and manual runs, but not on pull requests: PRs restore the cache saved by dev without adding ~0.1 GB entries of their own to the repo's 10 GB cache.
  • Checklist:

  • I have read and followed the contributing guidelines

  • The functionality is complete

  • I have commented my code, particularly in hard-to-understand areas

  • I have made corresponding changes to the documentation

  • My changes generate no new warnings

  • I have added tests that prove my fix is effective or that my feature works

  • New and existing unit tests pass locally with my changes
  • Diff: 415 lines (+311 / -104) across 5 files Reviewer: VeeraRajasekhar Review duration: 27535m
    All Vouch review confidence checks passed
    Residual risk 0.18 = Change Risk (0.45) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.45 · 415 lines diff across 5 files
    0.45
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.361
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #793"
    general weight: 0.35
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 44.9% (MEDIUM) · Higher = larger blast radius
    44.9%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 17.8% · Safe to merge
    17.8%