@@ -21,10 +21,12 @@ concurrency:
2121 cancel-in-progress : ${{ github.ref != 'refs/heads/main' }}
2222permissions : read-all
2323env :
24+ TRITON_BUILD_WITH_CCACHE : " true"
2425 TRITON_BUILD_WITH_CLANG_LLD : " TRUE"
2526 TRITON_USE_ASSERT_ENABLED_LLVM : " TRUE"
2627 TRITON_DISABLE_LINE_INFO : 1
2728 PROTON_SKIP_PC_SAMPLING_TEST : 1
29+ CCACHE_COMPRESS : " true"
2830jobs :
2931 Runner-Preparation :
3032 runs-on : ubuntu-latest
@@ -154,6 +156,8 @@ jobs:
154156 strategy :
155157 matrix :
156158 runner : ${{fromJson(needs.Runner-Preparation.outputs.matrix-CUDA)}}
159+ env :
160+ RUNNER_TYPE : ${{ matrix.runner[0] }}
157161 steps :
158162 - name : Checkout
159163 uses : actions/checkout@v4
@@ -199,22 +203,28 @@ jobs:
199203 # "restore" step. This is to prevent the caches from accumulating stale
200204 # files over time.
201205 name : Restore cache of ccache and Triton compilation artifacts
202- if : github.event_name != 'push'
206+ id : restore-build-cache
207+ if : github.ref != 'refs/heads/main'
203208 uses : actions/cache/restore@v4
204209 with :
205210 path : |
206211 ~/.triton/cache
207- ~/.cache/ ccache
212+ ~/.ccache
208213 # Restore the most recent cache entry.
209- restore-keys : triton-artifacts-${{ runner.os }}-${{ runner.arch }}-${{ runner.name }}-llvm-${{ steps.cache-key.outputs.llvm }}-
214+ restore-keys : |
215+ triton-artifacts-${{ runner.os }}-${{ runner.arch }}-${{ env.RUNNER_TYPE }}-llvm-${{ steps.cache-key.outputs.llvm }}-
216+ triton-artifacts-${{ runner.os }}-${{ runner.arch }}-${{ env.RUNNER_TYPE }}-
210217 # We expect this cache key never to hit and for us to fall back
211218 # unconditionally to the restore-key, so it doesn't actually matter
212219 # what we put here (so long as it doesn't hit an existing key).
213- key : triton-artifacts-${{ runner.os }}-${{ runner.arch }}-${{ runner.name }}-llvm-${{ steps.cache-key.outputs.llvm }}-${{ steps.cache-key.outputs.datetime }}
214- - name : Inspect cache directory
220+ key : triton-artifacts-${{ runner.os }}-${{ runner.arch }}-${{ env.RUNNER_TYPE }}-llvm-${{ steps.cache-key.outputs.llvm }}-${{ steps.cache-key.outputs.datetime }}
221+ - name : Inspect cache directories
215222 run : |
216223 mkdir -p ~/.triton
217- ls -alh ~/.triton
224+ du -h -d 1 ~/.triton
225+
226+ mkdir -p ~/.ccache
227+ du -h -d 1 ~/.ccache
218228 - name : Update PATH
219229 run : |
220230 echo "$HOME/.local/bin" >> $GITHUB_PATH
@@ -224,12 +234,14 @@ jobs:
224234 python3 -m pip install cython setuptools wheel cmake==3.24 ninja pytest-forked pytest-xdist lit
225235 - name : Install Triton
226236 env :
227- TRITON_BUILD_WITH_CCACHE : " true"
228237 CUDA_HOME : " /usr/local/cuda"
229238 run : |
230239 echo "PATH is '$PATH'"
231240 cd python
232- python3 -m pip install '.[tests]'
241+ ccache --zero-stats
242+ python3 -m pip install -v '.[tests]'
243+ - name : CCache Stats
244+ run : ccache --print-stats
233245 - name : Run lit tests
234246 run : |
235247 cd python
@@ -278,6 +290,13 @@ jobs:
278290 cd third_party/proton/test
279291 python3 -m pytest -s .
280292 cd ..
293+ - name : Inspect cache directories
294+ run : |
295+ mkdir -p ~/.triton
296+ du -h -d 1 ~/.triton
297+
298+ mkdir -p ~/.ccache
299+ du -h -d 1 ~/.ccache
281300 - # If we're on branch `main`, save the ccache Triton compilation artifacts
282301 # to the cache so they can be used by other (non-main) CI runs.
283302 #
@@ -287,22 +306,17 @@ jobs:
287306 if : github.ref == 'refs/heads/main'
288307 uses : actions/cache/save@v4
289308 with :
290- path : ~/.triton/cache ~/.cache/ccache
291- key : triton-artifacts-${{ runner.os }}-${{ runner.arch }}-${{ runner.name }}-llvm-${{ steps.cache-key.outputs.llvm }}-${{ steps.cache-key.outputs.datetime }}
292- - name : Inspect cache directories
293- run : |
294- mkdir -p ~/.triton
295- ls -alh ~/.triton
296- du -sh ~/.triton/**
297-
298- mkdir -p ~/.cache/ccache
299- ls -alh ~/.cache/ccache
300- du -sh ~/.cache/ccache
309+ path : |
310+ ~/.triton/cache
311+ ~/.ccache
312+ key : ${{ steps.restore-build-cache.outputs.cache-primary-key }}
301313 Integration-Tests-AMD :
302314 needs : Runner-Preparation
303315 if : needs.Runner-Preparation.outputs.matrix-HIP != ''
304316 runs-on : ${{ matrix.runner }}
305317 timeout-minutes : 30
318+ env :
319+ RUNNER_TYPE : ${{ matrix.runner[1] }}
306320 strategy :
307321 matrix :
308322 runner : ${{fromJson(needs.Runner-Preparation.outputs.matrix-HIP)}}
@@ -355,40 +369,53 @@ jobs:
355369 # "restore" step. This is to prevent the caches from accumulating stale
356370 # files over time.
357371 name : Restore cache of ccache and Triton compilation artifacts
358- if : github.event_name != 'push'
372+ id : restore-build-cache
373+ if : github.ref != 'refs/heads/main'
359374 uses : actions/cache/restore@v4
360375 with :
361376 path : |
362377 ~/.triton/cache
363- ~/.cache/ ccache
378+ ~/.ccache
364379 # Restore the most recent cache entry.
365- restore-keys : triton-artifacts-${{ runner.os }}-${{ runner.arch }}-${{ runner.name }}-llvm-${{ steps.cache-key.outputs.llvm }}-
380+ restore-keys : |
381+ triton-artifacts-${{ runner.os }}-${{ runner.arch }}-${{ env.RUNNER_TYPE }}-llvm-${{ steps.cache-key.outputs.llvm }}-
382+ triton-artifacts-${{ runner.os }}-${{ runner.arch }}-${{ env.RUNNER_TYPE }}-
366383 # We expect this cache key never to hit and for us to fall back
367384 # unconditionally to the restore-key, so it doesn't actually matter
368385 # what we put here (so long as it doesn't hit an existing key).
369- key : triton-artifacts-${{ runner.os }}-${{ runner.arch }}-${{ runner.name }}-llvm-${{ steps.cache-key.outputs.llvm }}-${{ steps.cache-key.outputs.datetime }}
370- - name : Inspect cache directory
386+ key : triton-artifacts-${{ runner.os }}-${{ runner.arch }}-${{ env.RUNNER_TYPE }}-llvm-${{ steps.cache-key.outputs.llvm }}-${{ steps.cache-key.outputs.datetime }}
387+ - name : Inspect cache directories
371388 run : |
372389 mkdir -p ~/.triton
373- ls -alh ~/.triton
390+ du -h -d 1 ~/.triton
391+
392+ mkdir -p ~/.ccache
393+ du -h -d 1 ~/.ccache
374394 - name : Update PATH
375395 run : |
376396 echo "/opt/rocm/llvm/bin" >> $GITHUB_PATH
377397 - name : Install pip dependencies
378398 run : |
379399 python3 -m pip install --upgrade pip
380400 python3 -m pip install lit
401+ - name : Install apt dependencies
402+ run : |
403+ apt update
404+ apt install ccache
381405 - name : Install Triton
382406 id : amd-install-triton
383407 run : |
384408 echo "PATH is '$PATH'"
385409 pip uninstall -y triton
386410 cd python
411+ ccache --zero-stats
387412 pip install -v -e '.[tests]'
388413 - name : Clean up after an unsuccessful build
389414 if : ${{ !success() && steps.amd-install-triton.outcome != 'success' }}
390415 run : |
391416 rm -rf ~/.triton
417+ - name : CCache Stats
418+ run : ccache --print-stats
392419 - name : Run lit tests
393420 run : |
394421 cd python
@@ -431,6 +458,13 @@ jobs:
431458 cd python
432459 cd "build/$(ls build | grep -i cmake)"
433460 ctest -j32
461+ - name : Inspect cache directories
462+ run : |
463+ mkdir -p ~/.triton
464+ du -h -d 1 ~/.triton
465+
466+ mkdir -p ~/.ccache
467+ du -h -d 1 ~/.ccache
434468 - # If we're on branch `main`, save the ccache Triton compilation artifacts
435469 # to the cache so they can be used by other (non-main) CI runs.
436470 #
@@ -440,17 +474,10 @@ jobs:
440474 if : github.ref == 'refs/heads/main'
441475 uses : actions/cache/save@v4
442476 with :
443- path : ~/.triton/cache ~/.cache/ccache
444- key : triton-artifacts-${{ runner.os }}-${{ runner.arch }}-${{ runner.name }}-llvm-${{ steps.cache-key.outputs.llvm }}-${{ steps.cache-key.outputs.datetime }}
445- - name : Inspect cache directories
446- run : |
447- mkdir -p ~/.triton
448- ls -alh ~/.triton
449- du -sh ~/.triton/**
450-
451- mkdir -p ~/.cache/ccache
452- ls -alh ~/.cache/ccache
453- du -sh ~/.cache/ccache
477+ path : |
478+ ~/.triton/cache
479+ ~/.ccache
480+ key : ${{ steps.restore-build-cache.outputs.cache-primary-key }}
454481 - name : Clean up caches
455482 run : |
456483 rm -rf ~/.triton/cache
@@ -462,6 +489,8 @@ jobs:
462489 strategy :
463490 matrix :
464491 runner : ${{fromJson(needs.Runner-Preparation.outputs.matrix-MACOS)}}
492+ env :
493+ RUNNER_TYPE : ${{ matrix.runner[0] }}
465494 steps :
466495 - name : Checkout
467496 uses : actions/checkout@v4
@@ -470,7 +499,7 @@ jobs:
470499 - name : Install brew dependencies
471500 run : |
472501 brew update
473- brew install ccache llvm@19 lld
502+ brew install ccache llvm@19 lld coreutils
474503 - name : Compute cache keys
475504 id : cache-key
476505 run : |
@@ -511,22 +540,28 @@ jobs:
511540 # "restore" step. This is to prevent the caches from accumulating stale
512541 # files over time.
513542 name : Restore cache of ccache and Triton compilation artifacts
514- if : github.event_name != 'push'
543+ id : restore-build-cache
544+ if : github.ref != 'refs/heads/main'
515545 uses : actions/cache/restore@v4
516546 with :
517547 path : |
518548 ~/.triton/cache
519- ~/.cache/ ccache
549+ ~/.ccache
520550 # Restore the most recent cache entry.
521- restore-keys : triton-artifacts-${{ runner.os }}-${{ runner.arch }}-${{ runner.name }}-llvm-${{ steps.cache-key.outputs.llvm }}-
551+ restore-keys : |
552+ triton-artifacts-${{ runner.os }}-${{ runner.arch }}-${{ env.RUNNER_TYPE }}-llvm-${{ steps.cache-key.outputs.llvm }}-
553+ triton-artifacts-${{ runner.os }}-${{ runner.arch }}-${{ env.RUNNER_TYPE }}-
522554 # We expect this cache key never to hit and for us to fall back
523555 # unconditionally to the restore-key, so it doesn't actually matter
524556 # what we put here (so long as it doesn't hit an existing key).
525- key : triton-artifacts-${{ runner.os }}-${{ runner.arch }}-${{ runner.name }}-llvm-${{ steps.cache-key.outputs.llvm }}-${{ steps.cache-key.outputs.datetime }}
526- - name : Inspect cache directory
557+ key : triton-artifacts-${{ runner.os }}-${{ runner.arch }}-${{ env.RUNNER_TYPE }}-llvm-${{ steps.cache-key.outputs.llvm }}-${{ steps.cache-key.outputs.datetime }}
558+ - name : Inspect cache directories
527559 run : |
528560 mkdir -p ~/.triton
529- ls -alh ~/.triton
561+ du -h -d 1 ~/.triton
562+
563+ mkdir -p ~/.ccache
564+ du -h -d 1 ~/.ccache
530565 - name : Update PATH
531566 run : |
532567 echo "$HOME/.local/bin" >> $GITHUB_PATH
@@ -539,7 +574,6 @@ jobs:
539574 python3 -m pip install cython setuptools wheel cmake==3.24 ninja pytest-xdist lit pybind11
540575 - name : Install Triton
541576 env :
542- TRITON_BUILD_WITH_CCACHE : " true"
543577 TRITON_BUILD_WITH_O1 : " true"
544578 # macos-latest has 3 vcpus and 7GB DRAM, to save memory we limit the number of jobs to 3
545579 # https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners#standard-github-hosted-runners-for-public-repositories
@@ -548,7 +582,17 @@ jobs:
548582 source ~/.venv/bin/activate
549583 echo "PATH is '$PATH'"
550584 cd python
551- python3 -m pip install --no-build-isolation .
585+ ccache --zero-stats
586+ python3 -m pip install -v --no-build-isolation .
587+ - name : CCache Stats
588+ run : ccache --print-stats
589+ - name : Inspect cache directories
590+ run : |
591+ mkdir -p ~/.triton
592+ du -h -d 1 ~/.triton
593+
594+ mkdir -p ~/.ccache
595+ du -h -d 1 ~/.ccache
552596 - # If we're on branch `main`, save the ccache Triton compilation artifacts
553597 # to the cache so they can be used by other (non-main) CI runs.
554598 #
@@ -558,14 +602,7 @@ jobs:
558602 if : github.ref == 'refs/heads/main'
559603 uses : actions/cache/save@v4
560604 with :
561- path : ~/.triton/cache ~/.cache/ccache
562- key : triton-artifacts-${{ runner.os }}-${{ runner.arch }}-${{ runner.name }}-llvm-${{ steps.cache-key.outputs.llvm }}-${{ steps.cache-key.outputs.datetime }}
563- - name : Inspect cache directories
564- run : |
565- mkdir -p ~/.triton
566- ls -alh ~/.triton
567- du -sh ~/.triton/**
568-
569- mkdir -p ~/.cache/ccache
570- ls -alh ~/.cache/ccache
571- du -sh ~/.cache/ccache
605+ path : |
606+ ~/.triton/cache
607+ ~/.ccache
608+ key : ${{ steps.restore-build-cache.outputs.cache-primary-key }}
0 commit comments