Skip to content

Fixes related to FunctionWrappers and wrapped number types#3293

Merged
wsmoses merged 2 commits into
EnzymeAD:mainfrom
oschulz:fixes
Jul 8, 2026
Merged

Fixes related to FunctionWrappers and wrapped number types#3293
wsmoses merged 2 commits into
EnzymeAD:mainfrom
oschulz:fixes

Conversation

@oschulz

@oschulz oschulz commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

While making a new attempt at EnzymeAD/Reactant.jl#2170 and (independently) making MGVI.jl Reactant-compatible, I needed these fixes.

The fixes are AI-generated (Claude Fable at max effort), but I reviewed them and tested them with Reactant (EnzymeAD/Reactant.jl#2170) and MGVI (in-flight improvements).

oschulz added 2 commits July 8, 2026 11:22
The FunctionWrapper type reaching abstract interpretation may be a
UnionAll when inference is imprecise, accessing .parameters on it threw
a FieldError and aborted compilation. Rewrite only fully determined
calls.

Created by generative AI.
Reactant's kind-split number types (TracedRFloat, ConcretePJRTFloat, ...)
subtype AbstractFloat and Integer, so active_reg_inner classified them as
raw scalars (ActiveState) before the is_wrapped_number check could see
them: Enzyme.gradient then annotated them Active instead of Duplicated.
Move the wrapped-number check ahead of the BigFloat/AbstractFloat fast
paths and extend the recognized names to the kind-split types.

Compare module names with nameof instead of string: identical for the
root modules being matched, allocation-free, and it makes the
classification testable with mock modules, without a Reactant dependency.

Created by generative AI.
@oschulz

oschulz commented Jul 8, 2026

Copy link
Copy Markdown
Contributor Author

@wsmoses EnzymeAD/Reactant.jl#2170 needs this to work.

@oschulz

oschulz commented Jul 8, 2026

Copy link
Copy Markdown
Contributor Author

Runic failure seems due to failed Runic installation.

Distributions integration test failure on Julia v.1.10 looks pre-existing?

@codecov

codecov Bot commented Jul 8, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 74.35%. Comparing base (e619385) to head (fb0ed5e).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3293      +/-   ##
==========================================
+ Coverage   74.28%   74.35%   +0.06%     
==========================================
  Files          66       66              
  Lines       22602    22601       -1     
==========================================
+ Hits        16791    16805      +14     
+ Misses       5811     5796      -15     

☔ View full report in Codecov by Harness.
📢 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.

@wsmoses wsmoses merged commit 93f5869 into EnzymeAD:main Jul 8, 2026
69 of 81 checks passed
@oschulz oschulz deleted the fixes branch July 8, 2026 20:58
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.

2 participants