-
Notifications
You must be signed in to change notification settings - Fork 225
Test Enzyme and reexport ADTypes.AutoEnzyme
#1887
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Conversation
Pull Request Test Coverage Report for Build 13975938687Details
💛 - Coveralls |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1887 +/- ##
==========================================
- Coverage 86.03% 76.85% -9.18%
==========================================
Files 21 21
Lines 1454 1452 -2
==========================================
- Hits 1251 1116 -135
- Misses 203 336 +133 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Also if you want to disable the warnings you can set it like so (https://github.com/EnzymeAD/Enzyme.jl/blob/c29e6119c7963ddb22f1363726f762455748e193/src/api.jl#L414
|
You also may want to set the version to 0.11.2 since your CI currently is running at 0.11.0 ( |
@devmotion this PR (EnzymeAD/Enzyme.jl#914) should fix the immediate issues you see on CI if you want to try. |
I don't know what happened precisely -- some changes were made to the TuringLang repos permissions to make CI work more robustly. |
I'd try to help, but I don't have permission to edit things or rerun CI xD |
It should resolve with Mooncake 0.4.54 as that allows for DPPL=0.31.0. Don't know why CI isn't picking up the new version. └─Mooncake [da2b9cff] log:
├─possible versions are: 0.3.0 - 0.4.53 or uninstalled 0.4.54 should have been available a few hours ago. |
The registry issue is sorted, now merrily running with the latest Enzyme. |
Check ADType: Error During Test at /home/runner/work/Turing.jl/Turing.jl/test/mcmc/hmc.jl:334
Got exception outside of a @test
ArgumentError: Unsupported ADType: ADTypes.AutoEnzyme{Nothing, Nothing}
Stacktrace:
[1] Main.ADUtils.ADTypeCheckContext(adbackend::ADTypes.AutoEnzyme{Nothing, Nothing}, child::DynamicPPL.DefaultContext)
@ Main.ADUtils ~/work/Turing.jl/Turing.jl/test/test_utils/ad_utils.jl:102
[2] macro expansion
@ ~/work/Turing.jl/Turing.jl/test/mcmc/hmc.jl:336 [inlined]
[3] macro expansion
@ /opt/hostedtoolcache/julia/1.11.2/x86/share/julia/stdlib/v1.11/Test/src/Test.jl:1704 [inlined]
[4] macro expansion
@ ~/work/Turing.jl/Turing.jl/test/mcmc/hmc.jl:335 [inlined]
[5] macro expansion
@ /opt/hostedtoolcache/julia/1.11.2/x86/share/julia/stdlib/v1.11/Test/src/Test.jl:1793 [inlined]
[6] top-level scope
@ ~/work/Turing.jl/Turing.jl/test/mcmc/hmc.jl:22
[7] include(fname::String)
@ Main ./sysimg.jl:38
[8] macro expansion
@ ~/.julia/packages/TimerOutputs/6KVfH/src/TimerOutput.jl:237 [inlined]
[9] macro expansion
@ ~/work/Turing.jl/Turing.jl/test/runtests.jl:26 [inlined]
[10] macro expansion
@ /opt/hostedtoolcache/julia/1.11.2/x86/share/julia/stdlib/v1.11/Test/src/Test.jl:1704 [inlined]
[11] macro expansion
@ ~/work/Turing.jl/Turing.jl/test/runtests.jl:56 [inlined]
[12] macro expansion
@ ~/.julia/packages/TimerOutputs/6KVfH/src/TimerOutput.jl:237 [inlined]
[13] macro expansion
@ ~/work/Turing.jl/Turing.jl/test/runtests.jl:54 [inlined]
[14] macro expansion
@ /opt/hostedtoolcache/julia/1.11.2/x86/share/julia/stdlib/v1.11/Test/src/Test.jl:1704 [inlined]
[15] top-level scope
@ ~/work/Turing.jl/Turing.jl/test/runtests.jl:34
[16] include(fname::String)
@ Main ./sysimg.jl:38
[17] top-level scope
@ none:6
[18] eval
@ ./boot.jl:430 [inlined]
[19] exec_options(opts::Base.JLOptions)
@ Base ./client.jl:296
[20] _start()
@ Base ./client.jl:531 Looks like something in turing needs to be updated? |
Fixed the above issue that @wsmoses pointed out. We are seeing a lot of illegal type analysis errors, which I suspect are all instances of EnzymeAD/Enzyme.jl#2169. |
So this is indicative of a union (which isn't presently fully supported, at least without setting Enzyme.API.strictAliasing!(false) which may permit it). Something around here https://github.com/TuringLang/DynamicPPL.jl/blob/2252a9b6012da8e2ac56353770a0f848f6874357/src/abstract_varinfo.jl#L791 is sometimes an int and other times a double. I think this will need to be fixed on the turing side. |
If @model function gdemo_copy()
s ~ InverseGamma(2, 3)
end fails, and it does, then I assume most Turing models are affected, since they don't really get simpler than that. We could look into trying to chase down that
@wsmoses has something in Enzyme gotten stricter so that these illegal type analysis errors come up more often nowadays? Some of the errors are from tests that already passed at an earlier point. |
Ideally, a proper fix should be added to Enzyme instead of requiring packages like Turing.jl / DynamicPPL.jl to work around it. One good reason is that Turing allows arbitrary Julia code inside the |
Sure, but that's doable after this merges so we can at least confirm and test the thigns that currently are expected to work do work. Not all AD tools support all code (at least at any given time). Zygote historically and currently didn't support mutation (and that's fine here). Enzyme historically (but not presently) didn't like type unstable code. Mooncake presently fails on this PR/CI (see below). Can we just mark whatever isn't working now as test_broken, open issues, and at least track where things are at? That seems to be the case with all other ADs here.
|
This seems like an easy fix you need on the turing side?
|
Closed in favour of https://github.com/TuringLang/ADTests Please note that this PR doesn't add any functionality to Turing but only adds Enzyme to the Turing test suite. Such tests will now be included in https://github.com/TuringLang/ADTests |
Note: This does not work yet
I opened this PR to make it easier to debug (and possibly fix) issues with Enzyme.
Currently, the following example does
notwork (note that the snippet does not require the PR which solely reexportsAutoEnzyme
at this point):With Enzyme#main my Julia (1.8.1) segfaults. An incomplete (it filled my whole terminal) output: https://gist.github.com/devmotion/1352197f2354c6fecddd7b778ec4bcf7#file-log-txtThe example works (latest releases of Turing, Enzyme, and ADTypes on Julia 1.10.0) but the following warnings show up: