Repository navigation
Fix LinearScan Windows unwind crash in Dual ODE RHS - #111
Closed
ChrisRackauckas-Claude wants to merge 4 commits into
Closed
ChrisRackauckas-Claude wants to merge 4 commits into
ChrisRackauckas-Claude wants to merge 4 commits into
Conversation
The ±1 walk used `@inbounds if` around `cond && return` / `cond && continue`. That control-flow shape produced invalid Windows unwind information (ntdll!RtlVirtualUnwind2 ACCESS_VIOLATION) when DataInterpolations evaluated KIND_LINEAR_SCAN from an OrdinaryDiffEq Dual Jacobian. Rewrite the walk as a straight if/return loop, @inbounds only the loads, and mark the kernels @noinline so they are not inlined into the Dual RHS. Search results are unchanged. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
A search-only microbench hid the call. On get_idx + slope (the DataInterpolations path) @noinline is 7.62 vs 3.57 ns Float64 lerp and blocks Dual fusion. The CFG rewrite is the unwind fix; the kernels stay @inline like the other strategy kernels. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Member
Author
|
|
Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Member
Author
|
Agreed — this is not a real change. LLVM for the moved- |
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.
Please ignore this PR until it is reviewed by @ChrisRackauckas.
Fixes the kernel, does not stop using
KIND_LINEAR_SCAN.What changed and why
SciML/DataInterpolations.jl#580 is a Windows
EXCEPTION_ACCESS_VIOLATIONinntdll!RtlVirtualUnwind2, isolated toKIND_LINEAR_SCAN(notKIND_BRACKET_GALLOP), more likely under@profview, hidden by print statements. It shows up when DataInterpolations evaluates short non-uniform interpolants from an OrdinaryDiffEq Dual RHS.The linear-scan walk was:
@inbounds ifcoveringcond && return/cond && continueis a known-bad Windows unwind CFG. The kernels are now a straightif/returnloop,@inboundsonly on the loads, and@noinlineso the walk is not inlined into a Dual Jacobian (or into the enum dispatcher that also contains SIMDllvmcall).The SIMD scalar backward walks had the same
&& returnshape and were rewritten the same way.Search results are unchanged. Auto still picks
KIND_LINEAR_SCANfor non-uniformlength(v) ≤ 16.A previous DataInterpolations PR remapped LINEAR_SCAN → BRACKET_GALLOP. That was the wrong fix and is closed: SciML/DataInterpolations.jl#582
Verification
Julia 1.12.6:
Existing LinearScan / SIMDLinearScan / enum-dispatch tests are the correctness check (they already compared against
Base.searchsortedlast/searchsortedfirst). New Dual-query test covers the ODE-Jacobian shape (Float64 knots, Dual query, Int hint).What I did not verify
Judgment call
@noinlineon just these two kernels. The FFF design wants kernels inlined; this is an explicit exception so the walk is not pasted into a Dual RHS. If someone can confirm the CFG rewrite alone is enough on Windows, the@noinlinecan be dropped.