Skip to content

Fix --jit=jac crash: CompileJacobian never set nVars/nConsts - #175

Merged
foolnotion merged 2 commits into
mainfrom
fix/jit-jac-covar-count
Aug 20, 2026
Merged

Fix --jit=jac crash: CompileJacobian never set nVars/nConsts#175
foolnotion merged 2 commits into
mainfrom
fix/jit-jac-covar-count

Conversation

@foolnotion

@foolnotion foolnotion commented Aug 19, 2026

Copy link
Copy Markdown
Member

Summary

--jit=jac (JIT-compile only the Jacobian, interpreter residuals) crashed for any tree with variables, tripping ENSURE(nVars_ < 0 || jacColPtrs_.size() == nVars_) in JitLMCostFunction::Evaluate.

Cause: TreeCompiler::CompileJacobian never set CompileMeta::nVars or nConsts on its result, so both stayed at their default of 0. TreeCompiler::CompileAVX2 does set them. --jit=all never exposed this bug because it always falls through to GetOrCompile, and that function's cache-merge branch backfills nVars/nConsts from the residual compile. --jit=jac never takes that fallback path, so the zeroed metadata reached JitLMCostFunction directly.

Fix: set nVars and nConsts in CompileJacobian, mirroring CompileAVX2.

Test plan

  • All jit tests pass (./build/test/operon_test '[jit]~[performance]').
  • Full suite otherwise unaffected, aside from one pre-existing failure unrelated to this change.
  • Reproduced the crash before the fix; confirmed a clean run with correct model output after.

…nsts

Unlike CompileAVX2, leaving them at their 0 default, tripping
JitLMCostFunction::Evaluate's ENSURE for any tree with variables --
--jit=all never hit it since it always falls through to GetOrCompile's
merge branch, which backfills them from the residual compile.
@foolnotion
foolnotion merged commit ba2e72d into main Aug 20, 2026
3 checks passed
@foolnotion
foolnotion deleted the fix/jit-jac-covar-count branch August 20, 2026 08:06
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.

1 participant