Use RuntimeGeneratedFunctions instead of eval#82
Open
dpsanders wants to merge 2 commits into
Open
Conversation
1fac8f2 to
23a0150
Compare
Avoids world-age issues when building and invoking a generated gradient or forward-backward contractor in the same dynamic extent. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Patch bump for the RuntimeGeneratedFunctions swap: no changes to the exported API's calling convention, just a correctness fix (no more world-age errors) and a substantial build-time speedup. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
23a0150 to
746ff0c
Compare
f1ea4a5 to
4ce0682
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
eval(...)calls that build closures (ingradientandforward_backward_contractor) with@RuntimeGeneratedFunction, so callers can build and invoke a generated function in the same dynamic extent without hitting Julia world-age errors.RuntimeGeneratedFunctions0.5 as a direct dependency and initializes it in the module.@evals inreverse_icp.jl(per-operator_rev_*wrappers registered with Symbolics) are left alone — they don't suffer from world-age issues.Notes
__args,__inputs,__constraint,__params) and destructure on the first line of the body. Calling convention from the user's side is unchanged.add-ssa-function).Benchmarks (median; see commit message / discussion for full numbers)
gradientbuild, 2 varsgradientbuild, 3 vars + transcendentalsforward_backward_contractorbuild, x²+y²fwd_bwd_contractorcallSteady-state call cost is essentially unchanged in realistic use.
Test plan
Pkg.test()passes locally (12/12)🤖 Generated with Claude Code