Skip to content

Commit 8db4e38

Browse files
authored
Enable ccache for PJRT pkgci workflow (#19944)
Follow the comment in #19369 (https://github.com/iree-org/iree/pull/19369/files#discussion_r1871777205), we can make the PJRT workflow faster by enabling ccache in build phase. Before, it took about 8min ~ 9min to complete the PJRT workflow (e.g. https://github.com/iree-org/iree/actions/runs/13242473906/job/36965747148). Now, this workflow can be completed in about 4 minutes: https://github.com/iree-org/iree/actions/runs/13244742479/job/36968861178?pr=19944 ci-exactly: build_packages, test_pjrt --------- Signed-off-by: PragmaTwice <[email protected]>
1 parent 0a5ea45 commit 8db4e38

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

.github/workflows/pkgci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,8 @@ jobs:
121121
needs: [setup, build_packages]
122122
if: contains(fromJson(needs.setup.outputs.enabled-jobs), 'test_pjrt')
123123
uses: ./.github/workflows/pkgci_test_pjrt.yml
124+
with:
125+
write-caches: ${{ needs.setup.outputs.write-caches }}
124126

125127
##############################################################################
126128

.github/workflows/pkgci_test_pjrt.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,17 @@ on:
1111
artifact_run_id:
1212
type: string
1313
default: ""
14+
write-caches:
15+
required: true
16+
type: string
1417
workflow_dispatch:
1518
inputs:
1619
artifact_run_id:
1720
type: string
1821
default: ""
22+
write-caches:
23+
required: true
24+
type: string
1925

2026
jobs:
2127
build_and_test:
@@ -55,10 +61,17 @@ jobs:
5561
./build_tools/pkgci/setup_venv.py ${VENV_DIR} \
5662
--artifact-path=${PACKAGE_DOWNLOAD_DIR} \
5763
--fetch-gh-workflow=${{ inputs.artifact_run_id }}
64+
- name: ccache
65+
uses: hendrikmuhs/ccache-action@a1209f81afb8c005c13b4296c32e363431bffea5 # v1.2.17
66+
with:
67+
key: ${{ github.job }}-${{ matrix.pjrt_platform }}
68+
save: ${{ inputs.write-caches == 1 }}
5869
- name: Build and install
5970
run: |
6071
# install editable into venv
6172
source ${VENV_DIR}/bin/activate
73+
export CMAKE_C_COMPILER_LAUNCHER=ccache
74+
export CMAKE_CXX_COMPILER_LAUNCHER=ccache
6275
python -m pip install -v --no-deps -e integrations/pjrt/python_packages/iree_${{ matrix.pjrt_platform }}_plugin
6376
# install
6477
python -m pip install jax==0.4.36

integrations/pjrt/python_packages/_setup_support/iree_pjrt_setup.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,9 @@ def build_configuration(self, cmake_build_dir, extra_cmake_args=()):
197197
cmake_args, "MACOSX_DEPLOYMENT_TARGET", "CMAKE_OSX_DEPLOYMENT_TARGET"
198198
)
199199

200+
add_env_cmake_setting(cmake_args, "CMAKE_C_COMPILER_LAUNCHER")
201+
add_env_cmake_setting(cmake_args, "CMAKE_CXX_COMPILER_LAUNCHER")
202+
200203
# Only do a from-scratch configure if not already configured.
201204
cmake_cache_file = os.path.join(cmake_build_dir, "CMakeCache.txt")
202205
if not os.path.exists(cmake_cache_file):

0 commit comments

Comments
 (0)