Skip to content

Add tests for custom rules that read arguments their function does not - #3736

Open
vchuravy wants to merge 1 commit into
mainfrom
vc/custom-rule-regression-tests
Open

vchuravy wants to merge 1 commit into
mainfrom
vc/custom-rule-regression-tests

Conversation

@vchuravy

@vchuravy vchuravy commented Oct 1, 2026

Copy link
Copy Markdown
Member

Stacked on #3732, which is stacked on #3734 (Enzyme_jll 0.0.300).

A custom rule may read an argument that the body of its function never reads. Attribute inference on the primal body used to mark such an argument readnone, which broke the rule in two ways. Since EnzymeAD/Enzyme#3352 and #3353, which are in Enzyme_jll 0.0.300, nothing infers readnone or writeonly on the parameters of a function with a custom rule. This PR adds the regression tests from #3610, without its code changes:

  • test/rules/unread_const_arg.jl (Custom forward rule argument becomes jl_nothing across a @noinline helper (SIGSEGV) #3570): a Const argument read only by the rule, behind a @noinline function. Covers forward, combined reverse and split reverse mode, and a constant callee that calls a function with a rule.
  • test/rules/custom_rule_inline_roots.jl: an aggregate with inline roots whose data half is read only by the rule. The DSEPass of middle_optimize! used to delete the caller's store into it.

Run locally with Enzyme.jl main (no #3610 code changes):

0.0.299, 1.12 0.0.299, 1.13 0.0.300, 1.12 0.0.300, 1.13
unread_const_arg.jl segfault segfault 9/9 9/9
custom_rule_inline_roots.jl 1 of 8 fail 4 of 8 fail 8/8 8/8

Not run locally on 1.10 or 1.11.

Fixes #3570.

🤖 Generated with Claude Code

@codecov

codecov Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.90%. Comparing base (0dfa740) to head (c25c0b6).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff             @@
##             main    #3736       +/-   ##
===========================================
+ Coverage   49.08%   79.90%   +30.82%     
===========================================
  Files          58       71       +13     
  Lines       23379    24820     +1441     
===========================================
+ Hits        11476    19833     +8357     
+ Misses      11903     4987     -6916     

☔ 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.

An error occurred while trying to automatically change base from wm/rooted-const-test to vc/enzyme-jll-0.0.300 October 1, 2026 13:22
An error occurred while trying to automatically change base from wm/rooted-const-test to vc/enzyme-jll-0.0.300 October 1, 2026 13:23
@vchuravy
vchuravy force-pushed the vc/custom-rule-regression-tests branch from ccfe25a to 5923d10 Compare October 1, 2026 13:23
@vchuravy
vchuravy added this pull request to stack #3737 October 1, 2026 21:39
@vchuravy
vchuravy force-pushed the vc/custom-rule-regression-tests branch from 5923d10 to 84190e7 Compare October 3, 2026 01:56
@vchuravy
vchuravy removed this pull request from stack #3737 October 3, 2026 01:56
@vchuravy
vchuravy changed the base branch from wm/rooted-const-test to main October 3, 2026 01:57
@vchuravy
vchuravy added this pull request to stack #3739 October 3, 2026 01:57
Both failed with Enzyme_jll 0.0.299 (a segfault for #3570, a dropped
store for the aggregate with inline roots) and pass with 0.0.300, which
includes EnzymeAD/Enzyme#3352. Taken from #3610.

Assisted-by: Claude Code (Opus 5.5)
@vchuravy
vchuravy force-pushed the vc/custom-rule-regression-tests branch from 84190e7 to c25c0b6 Compare October 7, 2026 13:32

This branch has not been deployed

No deployments
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.

Custom forward rule argument becomes jl_nothing across a @noinline helper (SIGSEGV)

1 participant