[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
Conversation
2946e59 to
cc36c3e
Compare
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>
cc36c3e to
f794dae
Compare
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.
Summary
Two things:
hasbranchingandis_leaf(both documented and in the rendered API page).is_leaf_sighook added in 0.1.7 (so no per-container override is needed — e.g. split-mode MTKgetindex(::MTKParameters, ::Int)).Analysis change
The type recursion stays the source of truth. When it reports a branch inside a call carrying
Core.Constarguments, 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 /ComponentArrayneural-net RHS: const inference propagates aConstsymbol intogetproperty(::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.Compilerinternals whose API differs across versions (theInferenceStateconstruction 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).MTK RHS table through the
ODEFunction(linear/power branch-free,relubranchy, 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)deploydocspointed atgithub.com/SciML/MultiScaleArrays.jl.git→ fixed to FunctionProperties.jl.FunctionProperties = "0.1.2"→"1".Trade-off (flagged)
The refutation depends on non-public compiler internals (
InferenceResult/InferenceState/typeinf/retrieve_code_info), which the removedis_leaf_sigdid 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.7→1.0.0.