Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cache Triton compilation artifacts during CI. #3680

Merged
merged 5 commits into from
Apr 18, 2024
Merged

Conversation

jlebar
Copy link
Collaborator

@jlebar jlebar commented Apr 16, 2024

The vast majority of CI time is spent compiling Triton kernels. This caches
those, so if the compiler doesn't change, we should be able to reuse the cached
kernels. OTOH if the compiler does change, Triton will not (or, should not)
use stale compilation artifacts, because the Triton source code is effectively
part of the cache key.

Because the Triton C++ compiled code is part of the cache key, this will only
work if the Triton C++ build is deterministic. We should be able to see if
caching is working by comparing the names of the compilation artifacts between
two nop commits to main.

While we're here, we also run pre-commit on changes in the main branch.
Previously we only ran it on pull requests. The reason for this is that if we
don't run it on main, the pip caching won't work on non-main branches (because
the cache action only pulls from the current branch or main).

Also while we're here, rewrite the AMD workflow definition to reference the
nvidia workflow definition where they match -- it was getting hard to keep the
two workflows in sync. Because github actions don't support YAML references, I
had to add a preprocessing step to pre-commit. But it's not too bad.

@jlebar jlebar force-pushed the cache-triton-artifacts branch 4 times, most recently from 294f7d1 to a17e207 Compare April 17, 2024 02:20
@jlebar jlebar requested a review from antiagainst April 17, 2024 02:29
@jlebar jlebar marked this pull request as ready for review April 17, 2024 02:29
@jlebar jlebar requested a review from ptillet as a code owner April 17, 2024 02:29
Copy link
Collaborator

@antiagainst antiagainst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! LGTM; just a few nits. Sorry I said I'd look into this but gotten distracted by other tasks..

jlebar added 4 commits April 17, 2024 22:22
The vast majority of CI time is spent compiling Triton kernels.  This caches
those, so if the compiler doesn't change, we should be able to reuse the cached
kernels.  OTOH if the compiler does change, Triton will not (or, should not)
use stale compilation artifacts, because the Triton source code is effectively
part of the cache key.

Because the Triton C++ compiled code is part of the cache key, this will only
work if the Triton C++ build is deterministic.  We should be able to see if
caching is working by comparing the names of the compilation artifacts between
two nop commits to `main`.

While we're here, we also run pre-commit on changes in the main branch.
Previously we only ran it on pull requests.  The reason for this is that if we
don't run it on main, the pip caching won't work on non-main branches (because
the cache action only pulls from the current branch or main).

Also while we're here, rewrite the AMD workflow definition to reference the
nvidia workflow definition where they match -- it was getting hard to keep the
two workflows in sync.  Because github actions don't support YAML references, I
had to add a preprocessing step to pre-commit.  But it's not too bad.
@jlebar jlebar force-pushed the cache-triton-artifacts branch 4 times, most recently from 335075b to 5ea8de6 Compare April 18, 2024 02:44
@jlebar jlebar force-pushed the cache-triton-artifacts branch from 5ea8de6 to 52b1708 Compare April 18, 2024 02:49
@jlebar jlebar enabled auto-merge (squash) April 18, 2024 02:49
@jlebar jlebar merged commit 4303eab into main Apr 18, 2024
5 checks passed
@jlebar jlebar deleted the cache-triton-artifacts branch April 18, 2024 02:58
@jlebar
Copy link
Collaborator Author

jlebar commented Apr 18, 2024

Thank you for the reviews! Let's see how this goes on main.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants