Skip to content

Add Enzyme testing as a separate CI action#950

Merged
penelopeysm merged 6 commits into
mainfrom
py/enzyme-in-ci
Jun 4, 2025
Merged

Add Enzyme testing as a separate CI action#950
penelopeysm merged 6 commits into
mainfrom
py/enzyme-in-ci

Conversation

@penelopeysm

@penelopeysm penelopeysm commented Jun 3, 2025

Copy link
Copy Markdown
Collaborator

Adds a separate CI workflow that loops over the demo models and tests Enzyme on them.

Closes #860

This gives us some guarantees that changes to DPPL retain compatibility with the current version of Enzyme, or at the very least tells us if it is broken. A lot of work on both sides has already gone into bringing it to this point and not testing it feels rather like a waste of that effort.

For example, accumulators broke Enzyme compatibility (#947) and I only found that out because I handled a merge commit wrongly, which broke ReverseDiff, which led me to check all other backends including Enzyme. I would really have appreciated being automatically informed about this, even if I wasn't going to go and fix it right away.

Rationale for adding it as a separate workflow rather than just adding AutoEnzyme into test/ad.jl (as was done in previous PRs like #813):

  • Enzyme compilation takes quite a long time and sticking it into the existing CI workflow would make it substantially longer (and also imbalanced, because the bulk of the time would be spent on ad.jl).
  • Adding Enzyme to the full test environment runs the risk of breaking prerelease CI (nb. Mooncake already did this to us, which I separately fixed in JET + Mooncake fixes for 1.12 #921).
  • As we've learnt over the past months, while we try our best to minimise Enzyme errors, we might not have all the time we want to do that. Thus, keeping it as a separate CI task means that we can isolate Enzyme errors to this specific failing workflow, rather than having all of the Group2 workflows fail, which may mask other, more urgent, errors.

@github-actions

github-actions Bot commented Jun 3, 2025

Copy link
Copy Markdown
Contributor

Benchmark Report for Commit 1f1e5e8

Computer Information

Julia Version 1.11.5
Commit 760b2e5b739 (2025-04-14 06:53 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 4 × AMD EPYC 7763 64-Core Processor
  WORD_SIZE: 64
  LLVM: libLLVM-16.0.6 (ORCJIT, znver3)
Threads: 1 default, 0 interactive, 1 GC (on 4 virtual cores)

Benchmark Results

|                 Model | Dimension |  AD Backend |      VarInfo Type | Linked | Eval Time / Ref Time | AD Time / Eval Time |
|-----------------------|-----------|-------------|-------------------|--------|----------------------|---------------------|
| Simple assume observe |         1 | forwarddiff |             typed |  false |                  9.7 |                 1.6 |
|           Smorgasbord |       201 | forwarddiff |             typed |  false |                785.9 |                34.0 |
|           Smorgasbord |       201 | forwarddiff | simple_namedtuple |   true |                328.8 |                62.1 |
|           Smorgasbord |       201 | forwarddiff |           untyped |   true |               1259.5 |                27.8 |
|           Smorgasbord |       201 | forwarddiff |       simple_dict |   true |               3781.0 |                21.3 |
|           Smorgasbord |       201 | reversediff |             typed |   true |               1497.3 |                29.9 |
|           Smorgasbord |       201 |    mooncake |             typed |   true |                989.2 |                 5.2 |
|    Loop univariate 1k |      1000 |    mooncake |             typed |   true |               5628.6 |                 4.1 |
|       Multivariate 1k |      1000 |    mooncake |             typed |   true |               1058.7 |                 8.7 |
|   Loop univariate 10k |     10000 |    mooncake |             typed |   true |              63493.2 |                 3.6 |
|      Multivariate 10k |     10000 |    mooncake |             typed |   true |               9125.8 |                10.0 |
|               Dynamic |        10 |    mooncake |             typed |   true |                136.4 |                12.8 |
|              Submodel |         1 |    mooncake |             typed |   true |                 13.9 |                 6.1 |
|                   LDA |        12 | reversediff |             typed |   true |                460.5 |                 6.4 |

@codecov

codecov Bot commented Jun 3, 2025

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 82.92%. Comparing base (a4ad5e2) to head (1f1e5e8).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #950   +/-   ##
=======================================
  Coverage   82.92%   82.92%           
=======================================
  Files          36       36           
  Lines        3964     3964           
=======================================
  Hits         3287     3287           
  Misses        677      677           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions

github-actions Bot commented Jun 3, 2025

Copy link
Copy Markdown
Contributor

DynamicPPL.jl documentation for PR #950 is available at:
https://TuringLang.github.io/DynamicPPL.jl/previews/PR950/

@penelopeysm penelopeysm requested review from mhauru and yebai June 3, 2025 15:30
@yebai

yebai commented Jun 3, 2025

Copy link
Copy Markdown
Member

Thanks @penelopeysm -- good work. I'd separate the Enzyme test block into a script and put it under the test folder.

Would you do the same for Bijectors and AdvancedVI, please?

@penelopeysm

Copy link
Copy Markdown
Collaborator Author

I'd love to do it for Bijectors! I know we talked about it a few times now, it's just never been at the top of my priority list 😬 But I figured we should get it right the first time here.
Happy to take a look at AdvancedVI too when I get the time.

@penelopeysm

Copy link
Copy Markdown
Collaborator Author

I can probably stick the script in the integration test folder. Will do so, though will also wait for anything Markus wants to add on.

@yebai

yebai commented Jun 3, 2025

Copy link
Copy Markdown
Member

EnzymeAD/Enzyme.jl#1813 should be merged together with this PR for mutual compatibility.

@mhauru mhauru 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.

I like the idea of having it as script so I can run it locally too. Nothing else to add though, looks great to me.

@penelopeysm

Copy link
Copy Markdown
Collaborator Author

Okay, should now be locally runnable with:

cd test/enzyme
julia -project=.

pkg> instantiate
julia> include("main.jl")

@penelopeysm penelopeysm requested a review from mhauru June 3, 2025 18:05
Comment thread test/enzyme/Project.toml
@coveralls

coveralls commented Jun 3, 2025

Copy link
Copy Markdown

Pull Request Test Coverage Report for Build 15427231062

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 83.089%

Totals Coverage Status
Change from base Build 15422479988: 0.0%
Covered Lines: 3287
Relevant Lines: 3956

💛 - Coveralls

@penelopeysm penelopeysm added this pull request to the merge queue Jun 4, 2025
Merged via the queue into main with commit 3e54c2d Jun 4, 2025
21 checks passed
@penelopeysm penelopeysm deleted the py/enzyme-in-ci branch June 4, 2025 09:25
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.

Add Enzyme tests

4 participants