Skip to content

[WIP – ignore until reviewed by @ChrisRackauckas] Release v1.0.0: constant refutation replaces is_leaf_sig#64

Draft
ChrisRackauckas-Claude wants to merge 1 commit into
SciML:mainfrom
ChrisRackauckas-Claude:constprop-refutation
Draft

[WIP – ignore until reviewed by @ChrisRackauckas] Release v1.0.0: constant refutation replaces is_leaf_sig#64
ChrisRackauckas-Claude wants to merge 1 commit into
SciML:mainfrom
ChrisRackauckas-Claude:constprop-refutation

Conversation

@ChrisRackauckas-Claude

@ChrisRackauckas-Claude ChrisRackauckas-Claude commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Please ignore until reviewed by @ChrisRackauckas. Draft opened by an agent. Follow-up to #62 (merged); promotes the package to a stable v1.0.0.

Summary

Two things:

  1. Promotes FunctionProperties to a stable 1.0 public APIhasbranching and is_leaf (both documented and in the rendered API page).
  2. Makes constant-propagation-aware analysis the single mechanism for suppressing value-independent branches, replacing the is_leaf_sig hook added in 0.1.7 (so no per-container override is needed — e.g. split-mode MTK getindex(::MTKParameters, ::Int)).

Analysis change

The type recursion stays the source of truth. When it reports a branch inside a call carrying Core.Const arguments, the callee is re-inferred with those constants preserved (no optimizer, so no library/structural branches are inlined into view); only if that folds the branch away is the finding refuted. This is a strict refinement — it can only downgrade a reported branch to branch-free, never the reverse — so it introduces no false positives on arbitrary code. (An earlier "run const-prop on every constant-carrying call" version regressed broadcast / ComponentArray neural-net RHS: const inference propagates a Const symbol into getproperty(::ComponentArray, ::Symbol)'s specialized path and surfaces an unfolded index branch. Refuting only found branches avoids that.)

Version robustness (lts / 1 / pre)

The refutation uses Base.Compiler/Core.Compiler internals whose API differs across versions (the InferenceState construction and inferred-source location already differ between 1.12 and 1.13). It is functionally gated: a probe folds a constant-decided-branch fixture through the const inference at first use and only activates the refutation if the fold works; otherwise, and on any inference failure, the analysis is exactly the plain type recursion (conservative).

channel version refutation tests
lts 1.10.11 gated off
1 1.12.6 active
pre 1.13.0-rc1 active

MTK RHS table through the ODEFunction (linear/power branch-free, relu branchy, both split modes) is correct with no container-specific overrides (with the merged unwrap, SciML/SciMLBase.jl#1413). Docs build verified locally (clean; version auto-detected as 1.0.0).

Docs config fixes (were broken on main)

  • deploydocs pointed at github.com/SciML/MultiScaleArrays.jl.git → fixed to FunctionProperties.jl.
  • docs environment pinned FunctionProperties = "0.1.2""1".

Trade-off (flagged)

The refutation depends on non-public compiler internals (InferenceResult/InferenceState/typeinf/retrieve_code_info), which the removed is_leaf_sig did not. It is gated to degrade safely, but where active it tracks compiler-internal churn each release. The public API committed at v1 (hasbranching, is_leaf) is independent of this and stable; the const-prop path is an internal, self-disabling implementation detail.

Semver

Breaking / 1.0 release: removes the exported is_leaf_sig (public in 0.1.7). 0.1.71.0.0.

Promotes FunctionProperties to a stable 1.0 public API surface -- `hasbranching`
and `is_leaf` -- and makes constant-propagation-aware analysis the single
mechanism for suppressing value-independent branches.

Analysis change (follow-up to SciML#62): the type recursion is the source of truth;
when it reports a branch inside a call carrying `Core.Const` arguments, the callee
is re-inferred with those constants preserved (no optimizer, so no
library/structural branches are inlined into view) and, only if that folds the
branch, the finding is refuted. This is a strict refinement -- it can only
downgrade a reported branch to branch-free -- so it adds no false positives on
arbitrary code (broadcast, ComponentArrays), unlike a "run const-prop everywhere"
approach. It replaces the `is_leaf_sig` hook, so no per-container override is
needed (e.g. split-mode MTK `getindex(::MTKParameters, ::Int)`).

The refutation uses `Base.Compiler`/`Core.Compiler` internals whose API differs
across versions, so it is functionally gated: a probe folds a constant-decided
branch fixture at first use and only activates if the fold works; otherwise, and
on any inference failure, the analysis is exactly the plain type recursion.
Verified: lts 1.10.11 (gated off), 1.12.6, 1.13.0-rc1 all green; MTK RHS table
correct through the `ODEFunction` with no container-specific overrides; docs build
clean.

Also fixes the docs config: `deploydocs` pointed at MultiScaleArrays.jl, and the
docs environment pinned `FunctionProperties = "0.1.2"`.

BREAKING (1.0.0): removes the exported `is_leaf_sig` (public in 0.1.7).

Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
@ChrisRackauckas-Claude ChrisRackauckas-Claude changed the title [WIP – ignore until reviewed by @ChrisRackauckas] Fold value-independent branches via constant refutation; drop is_leaf_sig [WIP – ignore until reviewed by @ChrisRackauckas] Release v1.0.0: constant refutation replaces is_leaf_sig Jul 3, 2026
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