Skip to content

Fix Julia 1.11 compatibility by handling SSAValue callees#39

Closed
ChrisRackauckas-Claude wants to merge 1 commit into
SciML:mainfrom
ChrisRackauckas-Claude:investigate-issue-18
Closed

Fix Julia 1.11 compatibility by handling SSAValue callees#39
ChrisRackauckas-Claude wants to merge 1 commit into
SciML:mainfrom
ChrisRackauckas-Claude:investigate-issue-18

Conversation

@ChrisRackauckas-Claude

Copy link
Copy Markdown
Contributor

Summary

This PR fixes the Julia 1.11 segfault/crash reported in #18.

Root Cause

In Julia 1.11, the IR representation changed: function calls now store the function reference in an SSA slot first, then use SSAValue as the callee. For example:

Julia 1.10 IR:

[1] :(_2 < 0) :: Expr
[8] :(%6 + %7) :: Expr

Julia 1.11 IR:

[1] :(Main.:+) :: GlobalRef
[2] :(Main.:<) :: GlobalRef  
[3] :((%2)(_2, 0)) :: Expr  # callee is SSAValue
[13] :((%1)(%10, %12)) :: Expr  # callee is SSAValue

The _pass function was wrapping callstmt.args[1] with :nooverdub unconditionally, which doesn't work when args[1] is an SSAValue (the function lookup already happened in a prior statement and wrapping an SSAValue with :nooverdub is incorrect).

Fix

This fix only wraps the callee with :nooverdub when it's a GlobalRef, which preserves correct behavior on Julia 1.10 while fixing Julia 1.11.

Test Changes

The test file was also updated to work with the current Lux API - Lux.apply_activation was deprecated/removed and replaced with simple identity broadcasting.

Test plan

  • Tests pass on Julia 1.11.8
  • Tests pass on Julia 1.10.10 (backwards compatibility verified)

Fixes #18

cc @ChrisRackauckas

🤖 Generated with Claude Code

In Julia 1.11, the IR representation changed: function calls now store
the function reference in an SSA slot first, then use SSAValue as
the callee. For example:
  %1 = Main.:+
  %3 = (%1)(x, y)

The _pass function was wrapping callstmt.args[1] with :nooverdub
unconditionally, which doesn't work when args[1] is an SSAValue
(the function lookup already happened in a prior statement).

This fix only wraps the callee with :nooverdub when it's a GlobalRef,
which preserves correct behavior on Julia 1.10 while fixing 1.11.

Also updates the test file to work with current Lux API (the deprecated
Lux.apply_activation was replaced with identity broadcasting).

Fixes SciML#18

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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.

Cassette segfault on v1.11

3 participants