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

Add integration tests for Bijectors #2037

Merged
merged 8 commits into from
Nov 7, 2024

Conversation

mhauru
Copy link
Contributor

@mhauru mhauru commented Oct 31, 2024

There have been some regressions that cause various crashes and errors with Bijectors.jl and Enzyme v0.13. To guard against this in the future, I think it would be useful to introduce some integration tests for Bijectors, like we are doing in #1813 and #1819 for Turing.jl and Distributions.jl.

I've added a basic check of running forward and reverse mode on all bijector types with at least one argument, plus some extra ones that have caused trouble in the past. I've marked all failing ones, and reported them as separate issues. Here's a list:

cc @yebai

@codecov-commenter
Copy link

codecov-commenter commented Oct 31, 2024

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 69.92%. Comparing base (037dfed) to head (3595ad0).
Report is 213 commits behind head on main.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2037      +/-   ##
==========================================
+ Coverage   67.50%   69.92%   +2.41%     
==========================================
  Files          31       44      +13     
  Lines       12668    15660    +2992     
==========================================
+ Hits         8552    10950    +2398     
- Misses       4116     4710     +594     

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

@yebai
Copy link

yebai commented Nov 1, 2024

It is surprising to see so many broken tests, given that:

  1. Enzyme passes all Bijectors tests previously
  2. Bijectors is a stable library and barely changed during the period

It's good to have this integration test in Enzyme.

However, more comprehensive Enzyme unit tests should have caught the issues (even without the Bijectors integration test in this PR) so the community could have confidence in Enzyme.

@wsmoses
Copy link
Member

wsmoses commented Nov 1, 2024

Sure happy to have this, but the linked errors need to be reduced to more minimal examples first

@yebai
Copy link

yebai commented Nov 1, 2024

@wsmoses I'd suggest merging these integration tests (this PR, + #1813 and #1819) to improve the infrastructure first.

The discovered failed tests (already marked as broken in integration tests) can be fixed later. However, I don't think @mhauru has enough bandwidth to minimise them soon.

@mhauru
Copy link
Contributor Author

mhauru commented Nov 1, 2024

Had to mark one more test as broken, CI now passes. As Hong said, I won't have time to minimise the issues I opened in the near future. Would you be happy to merge as is? Should be better than nothing, and we can add in more tests as we close the individual issues.

@wsmoses
Copy link
Member

wsmoses commented Nov 3, 2024

I think the segfaults need further reductions at least, lest we not be able to mark them as broken

@mhauru
Copy link
Contributor Author

mhauru commented Nov 5, 2024

I added back in a bunch of tests that were unblocked by the recent fixes. Now the only one marked with skip=Reverse is the one that hangs.

@mhauru
Copy link
Contributor Author

mhauru commented Nov 5, 2024

There's now a new seg fault I'm unable to reproduce locally. @wsmoses (or anyone else), would you have a Linux machine to try it on? I'm on Mac, CI runs on Ubuntu 22.04.

(3, 3),
),
# TODO(mhauru) Both modes broken because of
# https://github.com/EnzymeAD/Enzyme.jl/issues/2035
Copy link
Member

Choose a reason for hiding this comment

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

So this issue is essentially due to Enzyme 0.13 not being supported by the custom rule on bijectors on all uses of roots.jl to define rules.

x/ref: TuringLang/Bijectors.jl#339

I think this needs to be fixed in bijectors.jl before we can take this in here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I would propose merging this as is while we fix this, to get the vast majority of the tests in this PR into CI. Bijectors is pinned to a specific version, so once the necessary changes have been made in Bijectors we can release a new version of IT, and then make a PR that marks this unbroken as it bumps the Bijectors version of these tests.

@mhauru
Copy link
Contributor Author

mhauru commented Nov 6, 2024

Tests pass and nothing is marked as skipped any more. Happy to merge @wsmoses?

@wsmoses wsmoses merged commit 1c09430 into EnzymeAD:main Nov 7, 2024
16 of 28 checks passed
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.

4 participants