Enzyme.jl
Enzyme.jl copied to clipboard
Add `defer_within_autodiff` to EnzymeInterpreter
Together with Reactant pr: https://github.com/EnzymeAD/Reactant.jl/pull/490
Codecov Report
:x: Patch coverage is 33.33333% with 2 lines in your changes missing coverage. Please review.
:white_check_mark: Project coverage is 74.92%. Comparing base (4ba9b71) to head (f1e15c9).
:warning: Report is 1 commits behind head on main.
| Files with missing lines | Patch % | Lines |
|---|---|---|
| src/compiler/interpreter.jl | 33.33% | 2 Missing :warning: |
Additional details and impacted files
@@ Coverage Diff @@
## main #2254 +/- ##
==========================================
- Coverage 74.93% 74.92% -0.01%
==========================================
Files 56 56
Lines 17434 17436 +2
==========================================
Hits 13064 13064
- Misses 4370 4372 +2
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
@vchuravy can you give this a review before merge
Seems fine.
bump on this
Your PR requires formatting changes to meet the project's style guidelines.
Please consider running Runic (git runic main) to apply these changes.
Click here to view the suggested changes.
diff --git a/src/compiler/interpreter.jl b/src/compiler/interpreter.jl
index 77f0027..260c90b 100644
--- a/src/compiler/interpreter.jl
+++ b/src/compiler/interpreter.jl
@@ -173,7 +173,7 @@ function EnzymeInterpreter(
reverse_rules::Bool,
inactive_rules::Bool,
broadcast_rewrite::Bool = true,
- within_autodiff_rewrite::Bool = true,
+ within_autodiff_rewrite::Bool = true,
handler = nothing
)
@assert world <= Base.get_world_counter()
@@ -250,23 +250,27 @@ EnzymeInterpreter(
handler = nothing
) = EnzymeInterpreter(cache_or_token, mt, world, mode == API.DEM_ForwardMode, mode == API.DEM_ReverseModeCombined || mode == API.DEM_ReverseModePrimal || mode == API.DEM_ReverseModeGradient, inactive_rules, broadcast_rewrite, within_autodiff_rewrite, handler)
-function EnzymeInterpreter(interp::EnzymeInterpreter;
- cache_or_token = (@static if HAS_INTEGRATED_CACHE
- interp.token
- else
- interp.code_cache
- end),
- mt = interp.method_table,
- local_cache = interp.local_cache,
- world = interp.world,
- inf_params = interp.inf_params,
- opt_params = interp.opt_params,
- forward_rules = interp.forward_rules,
- reverse_rules = interp.reverse_rules,
- inactive_rules = interp.inactive_rules,
- broadcast_rewrite = interp.broadcast_rewrite,
- within_autodiff_rewrite = interp.within_autodiff_rewrite,
- handler = interp.handler)
+function EnzymeInterpreter(
+ interp::EnzymeInterpreter;
+ cache_or_token = (
+ @static if HAS_INTEGRATED_CACHE
+ interp.token
+ else
+ interp.code_cache
+ end
+ ),
+ mt = interp.method_table,
+ local_cache = interp.local_cache,
+ world = interp.world,
+ inf_params = interp.inf_params,
+ opt_params = interp.opt_params,
+ forward_rules = interp.forward_rules,
+ reverse_rules = interp.reverse_rules,
+ inactive_rules = interp.inactive_rules,
+ broadcast_rewrite = interp.broadcast_rewrite,
+ within_autodiff_rewrite = interp.within_autodiff_rewrite,
+ handler = interp.handler
+ )
return EnzymeInterpreter(
cache_or_token,
mt,