Skip to content

fix(CI): Set ccache as HIP_COMPILER_LAUNCHER - #8824

Merged
litvaOo merged 3 commits into
mainfrom
amd/dev/dlytovch/add-ccache-hip-compiler
Oct 8, 2026
Merged

litvaOo merged 3 commits into
mainfrom
amd/dev/dlytovch/add-ccache-hip-compiler

Conversation

@litvaOo

@litvaOo litvaOo commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Motivation

Currently no workflows use caching for the HIP language compilation. This PR is based on #8783 to use the corresponding parameter in all subprojects

Technical Details

Adds -DCMAKE_HIP_COMPILER_LAUNCHER=ccache to both .github/workflows/multi_arch_build_portable_linux_artifacts.yml and .github/workflows/multi_arch_build_windows_artifacts.yml

Test Plan

  1. Tests execution logic should not be impacted.
  2. HIP language compilation (hip-tests, CV libs, etc.) should demonstrate notable reduction in the compilation time.

Test Result

  1. PSDB passes without any changes.
  2. Compilation on multiple jobs is passing multiple times faster.

Examples:

  1. runtime-tests stage passes in 24m 16s with empty cache: https://github.com/ROCm/TheRock/actions/runs/37745546095/job/113209162193?pr=8824 versus 2m 25s after a single build https://github.com/ROCm/TheRock/actions/runs/37745546095/job/113229356315?pr=8824
  2. CV libs compilation goes from 23m 57s https://github.com/ROCm/TheRock/actions/runs/37745546095/job/113209162399?pr=8824 to 5m 25s https://github.com/ROCm/TheRock/actions/runs/37745546095/job/113229356537?pr=8824

Submission Checklist

@litvaOo
litvaOo force-pushed the amd/dev/dlytovch/add-ccache-hip-compiler branch from fe582a6 to a804d4a Compare October 7, 2026 13:05
@therock-pr-bot

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

Copy link
Copy Markdown

❌ PR Check — Action Required

Check Status Details
📝 PR Description ❌ Fail Error: PR description must reference a JIRA ID, ISSUE ID, or a GitHub closing keyword.
Expected: include a JIRA ID / ISSUE ID line (separator : or -, or omitted; value may be a JIRA key, a number with/without #, or a link), OR a closing keyword + issue reference. Accepted examples:
• JIRA ID : TESTAUTO-6039
• JIRA ID - #330
• JIRA ID #330
• JIRA ID (on separate line)
ROCM-25757
• ISSUE ID : TESTUTO-3334
• ISSUE ID #3334
• ISSUE ID - TESTAUTO-3433
• ISSUE ID (on separate line)
AIRUNTIME-2352
• ISSUE ID : https://github.com/<org_name>/<repo_name>/issues/1234
• Closes #10
• Fixes octo-org/octo-repo#100
• Resolves: #123
• #123
• https://github.com/<org_name>/<repo_name>/issues/123
Current: no valid JIRA/ISSUE/closing-keyword reference found
⛔ 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 —

⚠️ 1 policy check(s) failed. Please address the issues above before this PR can be Reviewed.

🚫 Please fix the failed policies

  • ❌ PR Description

The Not ready to Review label was added to this PR. Once all policies pass, the label is removed automatically.

📖 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 added the Not ready to Review PR has unresolved policy failures — reviews blocked label Oct 7, 2026
@therock-pr-bot

therock-pr-bot Bot commented Oct 7, 2026

Copy link
Copy Markdown

🚫 Please fix the failed policies before requesting reviews.

The following policy checks failed:

  • ❌ PR Description

The Not ready to Review label has been added to this PR.
Once all policies pass, the label will be removed automatically.

@litvaOo
litvaOo force-pushed the amd/dev/dlytovch/add-ccache-hip-compiler branch from a804d4a to 44c0db7 Compare October 8, 2026 07:46
@litvaOo
litvaOo marked this pull request as ready for review October 8, 2026 14:15
@litvaOo
litvaOo force-pushed the amd/dev/dlytovch/add-ccache-hip-compiler branch from 44c0db7 to 4725ce8 Compare October 8, 2026 14:15
@litvaOo
litvaOo requested a review from ScottTodd October 8, 2026 14:16

@ScottTodd ScottTodd left a 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.

Wonderful, thanks!

I found a few other spots we can update too. These can be separate PRs as part of future cleanup though.

  • pytorch ccache support (we have code for both ccache and sccache, might prune to just sccache though, cc @subodh-dubey-amd):
    env["CMAKE_C_COMPILER_LAUNCHER"] = "ccache"
    env["CMAKE_CXX_COMPILER_LAUNCHER"] = "ccache"
  • user docs:

    TheRock/README.md

    Lines 287 to 345 in d8b5763

    #### CCache usage on Linux
    To build with the [ccache](https://ccache.dev/) compiler cache:
    - You must have a recent ccache (>= 4.11 at the time of writing) that supports
    proper caching with the `--offload-compress` option used for compressing
    AMDGPU device code.
    - `export CCACHE_SLOPPINESS=include_file_ctime` to support hard-linking
    - Proper setup of the `compiler_check` directive to do safe caching in the
    presence of compiler bootstrapping
    - Set the C/CXX compiler launcher options to cmake appropriately.
    Since these options are very fiddly and prone to change over time, we recommend
    using the `./build_tools/setup_ccache.py` script to create a `.ccache` directory
    in the repository root with hard coded configuration suitable for the project.
    Example:
    ```bash
    # Any shell used to build must eval setup_ccache.py to set environment
    # variables.
    eval "$(./build_tools/setup_ccache.py)"
    cmake -B build -GNinja -DTHEROCK_AMDGPU_FAMILIES=gfx110X-all \
    -DCMAKE_C_COMPILER_LAUNCHER=ccache \
    -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
    .
    cmake --build build
    ```
    #### CCache usage on Windows
    - You must have a recent ccache (>= 4.13.3 at the time of writing) that contains
    bug fixes for MSVC and supports proper caching with the `--offload-compress`
    option used for compressing AMDGPU device code.
    - `export CCACHE_SLOPPINESS=include_file_ctime,pch_defines,time_macros` to
    support hard-linking and precompiled headers (amd-llvm is built with PCH).
    - Proper setup of the `compiler_check` directive to do safe caching in the
    presence of compiler bootstrapping.
    - Set the C/CXX compiler launcher options to cmake appropriately.
    Since these options are very fiddly and prone to change over time, we recommend
    using the `./build_tools/setup_ccache.py` script to create a `.ccache` directory
    in the repository root with hard coded configuration suitable for the project.
    Example (In Command Prompt):
    ```bat
    # Any command prompt used to build must eval setup_ccache.py to set environment
    # variables.
    for /f "delims=" %i in ('python build_tools/setup_ccache.py') do @%i
    cmake -B build -GNinja -DTHEROCK_AMDGPU_FAMILIES=gfx110X-all \
    -DCMAKE_C_COMPILER_LAUNCHER=ccache ^
    -DCMAKE_CXX_COMPILER_LAUNCHER=ccache ^
    .
    cmake --build build
    ```
  • agent docs (which we could trim to point at the user docs):

    TheRock/AGENTS.md

    Lines 84 to 104 in d8b5763

    **Faster rebuilds with ccache:**
    On Linux:
    ```bash
    # Any shell used to build must eval setup_ccache.py to set environment variables.
    eval "$(./build_tools/setup_ccache.py)"
    cmake -B build -GNinja \
    -DCMAKE_C_COMPILER_LAUNCHER=ccache \
    -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
    -DTHEROCK_AMDGPU_FAMILIES=gfx1100 .
    ```
    On Windows (Command Prompt):
    ```bat
    for /f "delims=" %i in ('python build_tools/setup_ccache.py') do @%i
    cmake -B build -GNinja -DTHEROCK_AMDGPU_FAMILIES=gfx1100 ^
    -DCMAKE_C_COMPILER_LAUNCHER=ccache ^
    -DCMAKE_CXX_COMPILER_LAUNCHER=ccache .
    ```

Then a few other scripts too, but some of those are legacy and due to be deleted.

@litvaOo

litvaOo commented Oct 8, 2026

Copy link
Copy Markdown
Contributor Author

@ScottTodd thanks for the review
Added README.md and AGENTS.md changes in-place, as they do not impact any logic, agree on updating additional scripts in later PRs.

@litvaOo
litvaOo merged commit e3d5da8 into main Oct 8, 2026
25 of 26 checks passed
@litvaOo
litvaOo deleted the amd/dev/dlytovch/add-ccache-hip-compiler branch October 8, 2026 15:28
@ScottTodd

Copy link
Copy Markdown
Member

I found a few other spots we can update too. These can be separate PRs as part of future cleanup though.

I have -DCMAKE_HIP_COMPILER_LAUNCHER=ccache working for pytorch now too, fyi. Preparing a PR.

@ScottTodd

Copy link
Copy Markdown
Member

PyTorch PR is #9744. Nice speedups there too :)

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

Labels

Not ready to Review PR has unresolved policy failures — reviews blocked

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants