From ea52a85f19a9ffd0558b0fb7e43d9ac6a9129368 Mon Sep 17 00:00:00 2001 From: Penelope Yong Date: Sat, 29 Mar 2025 21:59:26 +0000 Subject: [PATCH] Mark _evaluate!! as noinline --- src/model.jl | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/model.jl b/src/model.jl index a0451b1b6..0fcfaa3ce 100644 --- a/src/model.jl +++ b/src/model.jl @@ -931,7 +931,13 @@ end Evaluate the `model` with the arguments matching the given `context` and `varinfo` object. """ -function _evaluate!!(model::Model, varinfo::AbstractVarInfo, context::AbstractContext) +@noinline function _evaluate!!( + model::Model, varinfo::AbstractVarInfo, context::AbstractContext +) + # NOTE(penelopeysm): This @noinline is a workaround for + # https://github.com/EnzymeAD/Enzyme.jl/issues/2337 and only really affects + # the smallest models (e.g. those with a single parameter). This call can + # be removed once that issue is fixed. args, kwargs = make_evaluate_args_and_kwargs(model, varinfo, context) return model.f(args...; kwargs...) end