Mark functions with an easy rule as enzyme_easy_rule - #3731
Merged
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3731 +/- ##
===========================================
+ Coverage 46.45% 80.10% +33.65%
===========================================
Files 58 71 +13
Lines 22740 24172 +1432
===========================================
+ Hits 10563 19363 +8800
+ Misses 12177 4809 -7368 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
EnzymeAD/Enzyme#3352 stops Enzyme's DetectReadonlyOrThrow from inferring writeonly or readnone on the pointer parameters of a function whose derivative comes from a custom rule, since the rule may read a parameter the body never reads, unless the function is marked enzyme_custom_full_attributes to state that its rule accesses no more than the body does. A rule written with @easy_rule only combines the inputs the way the body does, so set that attribute next to the enzyme_LocalReadOnlyOrThrow such functions already get. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01G84mmXoaait2MBqCH5BKNb
wsmoses
force-pushed
the
wm/easy-rule-attr
branch
from
October 1, 2026 02:42
e683953 to
f5a4ee7
Compare
Contributor
Benchmark Results
Benchmark PlotsA plot of the benchmark results has been uploaded as an artifact at https://github.com/EnzymeAD/Enzyme.jl/actions/runs/36807131134/artifacts/11137629444. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Companion to EnzymeAD/Enzyme#3352, which stops
DetectReadonlyOrThrowfrom inferringwriteonlyorreadnoneon the pointer parameters of a function whose derivative comes from a custom rule (enzyme_math=enzyme_custom): the rule may read a parameter the body never reads.A rule written with
@easy_ruleonly combines the inputs the way the body does, so those functions can keep that inference. This adds anenzyme_easy_rulefunction attribute at the two places that already addenzyme_LocalReadOnlyOrThrowforcached_has_easy_rule, and the core change exempts functions carrying it (tested there inreadonlyorthrow_custom_rule.ll).Checked with the core branch built for Julia 1.11:
rules/internal_rules/bigfloat,rules/easyrulesandrules/rrulespass (116 tests). Harmless with a libEnzyme that predates #3352, which ignores the attribute.🤖 Generated with Claude Code
https://claude.ai/code/session_01G84mmXoaait2MBqCH5BKNb