Fix batched ForwardWithPrimal primal slot width - #3488
Draft
ChrisRackauckas-Claude wants to merge 1 commit into
Draft
ChrisRackauckas-Claude wants to merge 1 commit into
ChrisRackauckas-Claude wants to merge 1 commit into
Conversation
Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://chatgpt.com/codex/tasks/01a03f84-af17-7a90-955c-10b5d980e4da
ChrisRackauckas-Claude
force-pushed
the
fix/batched-abi-primal-slot-width
branch
from
August 27, 2026 21:42
e5b93fc to
19c8137
Compare
This branch has not been deployed
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.
Ignore this PR until it has been reviewed by @ChrisRackauckas.
What changed and why
When batched
ForwardWithPrimalreturns a boxed primal alongside batched derivatives, the ABI wrapper has a batched derivative sret slot followed by a scalar primal sret slot. The wrapper currently applies the batch width to both slots, so it tries to extract the scalar primal pointer as an aggregate and segfaults inLLVMBuildExtractValue.This keeps the existing scalar-width handling for
Constreturns and also assigns scalar width to the final primal slot. The regression test covers the distinctForwardWithPrimalpath and checks both tangent batches and the primal result.Dependency
This follows #3486, which fixed the earlier undefined ABI-wrapper loop index and has now merged. This branch is rebased onto the resulting
maincommit and contains only the slot-width follow-up.Failing before
I ran this SciML-free reproducer on commit
1187627c, after the undefined-index fix but before this slot-width fix:It exited with status 139:
Passing after
I ran the same reproducer on this branch with Julia 1.12.7 and observed:
The targeted repository test group also passed:
Pre-push checks:
This repository does not expose a separate QA/Aqua/ExplicitImports/JET test target. I did not run the full suite, GPU tests, integration tests, or a docs build; this change does not touch documentation or public API.
Reviewer attention: the new condition is deliberately additive. Replacing the existing
Constcondition would regress its scalar-width case.🤖 Generated with Claude Code
https://chatgpt.com/codex/tasks/01a03f84-af17-7a90-955c-10b5d980e4da