-
Notifications
You must be signed in to change notification settings - Fork 5
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
Fix bug where integral fails when Enzyme ext not loaded #160
Conversation
Benchmark Results
Benchmark PlotsA plot of the benchmark results have been uploaded as an artifact to the workflow run for this PR. |
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@JoshuaLampert I'm a little puzzled that the current code here is failing these tests, but I'm not an expert in package extensions. In my mind, the catch-all line Line 25 in 017ecfe
should always be used when the Enzyme extension isn't loaded, then when loaded the new methods MeshIntegrals.jl/ext/MeshIntegralsEnzymeExt.jl Lines 21 to 25 in 017ecfe
should be loaded. Am I missing something? |
In principle it works. I just tried: julia> using Meshes, MeshIntegrals
julia> MeshIntegrals._default_diff_method(Meshes.Sphere, Float64)
FiniteDifference{Float64}(1.0e-6)
julia> import Enzyme
julia> MeshIntegrals._default_diff_method(Meshes.Sphere, Float64)
AutoEnzyme() but the test doesn't seem to recognize that the extension is not loaded. Maybe if we load the extension in another |
Now that I'm seeing the latest CI results...
|
I agree. The first issue should be resolved by the comment I made above. The second is trickier, I think. |
…me support flag in testing
Maybe revert 47193a2? I liked the automatically generated |
My concern with the prior arrangement is mostly that we're using the codebase itself as the source of truth against which we're attempting to verify behavior. So, if somehow |
We could explicitly test |
I restored a I'm thinking more about the supports.autoenzyme = MeshIntegrals.supports_autoenzyme(geometry)
@test MeshIntegrals.supports_autoenzyme(geometry) == supports.autoenzyme Maybe we could, inside the constructor, use something like autoenzyme = typeof(geometry) \notin Union{BezierCurve, ...} |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #160 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 18 18
Lines 184 181 -3
=========================================
- Hits 184 181 -3 ☔ View full report in Codecov by Sentry. |
I removed the problematic |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
I discovered a bug where a clean install of Meshes without Enzyme will still default to using
AutoEnzyme
but won’t have the appropriate method defined.I’m currently trying to fix this by signaling whether the extension is loaded via multiple dispatch. I created a
supports_autoenzyme(::Any) = false
method and moved the rest into the extension itself. That way, without the extension loaded, all calls will return false. When the extension is loaded, the methods with more specific argument types will take over.