Skip to content

Rename the scope operand of enter when building IR - #166

Merged
CarloLucibello merged 1 commit into
masterfrom
cl/enter-scope-rename
Oct 22, 2026
Merged

CarloLucibello merged 1 commit into
masterfrom
cl/enter-scope-rename

Conversation

@CarloLucibello

Copy link
Copy Markdown
Member

IR(::CodeInfo) copied EnterNode.scope without renaming it, so a scoped try region (@with, and @sync since Julia 1.14) ends up pointing at an unrelated statement. Round-tripping such a function through a dynamo either hits InvalidIRError in the optimizer or runs the region under a bogus scope.

This breaks Zygote gradients through @with (on 1.11+) and through @sync (on 1.14+, where it is behind the nightly CI failures of Zygote).

🤖 Generated with Claude Code

`IR(::CodeInfo)` copied `EnterNode.scope` verbatim, so the `enter` of a scoped
try region (`@with`, and `@sync` since Julia 1.14) kept the raw `SSAValue` of
the lowered code and referenced an unrelated statement after renumbering.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codecov

codecov Bot commented Oct 22, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.45%. Comparing base (8ffa08c) to head (2f1a767).

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #166   +/-   ##
=======================================
  Coverage   78.45%   78.45%           
=======================================
  Files          16       16           
  Lines        1652     1652           
=======================================
  Hits         1296     1296           
  Misses        356      356           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@CarloLucibello
CarloLucibello merged commit 04f2d3e into master Oct 22, 2026
10 checks passed
@CarloLucibello
CarloLucibello deleted the cl/enter-scope-rename branch October 22, 2026 08:13
CarloLucibello added a commit to FluxML/Zygote.jl that referenced this pull request Oct 22, 2026
- Build `Task`s around their final closure instead of replacing `t.code`,
  which Julia 1.14 rejects (the failing task made the `structures` tests hang).
- Forward the extra `sync_end` argument and mark the scope and cancellation
  machinery entered by `@with`/`@sync` as non-differentiable.
- Require IRTools 0.4.22 for the `enter` scope fix (FluxML/IRTools.jl#166).
- Mark the primal frame name in pullback stacktraces broken on Julia 1.14.
- Remove Conda from the test deps; it is unused and failed to precompile
  from a restored CI cache.
- Time out CI test jobs after an hour.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CarloLucibello added a commit to FluxML/Zygote.jl that referenced this pull request Oct 22, 2026
* Fix tasks and `@sync` on Julia 1.14, drop unused Conda test dep

- Build `Task`s around their final closure instead of replacing `t.code`,
  which Julia 1.14 rejects (the failing task made the `structures` tests hang).
- Forward the extra `sync_end` argument and mark the scope and cancellation
  machinery entered by `@with`/`@sync` as non-differentiable.
- Require IRTools 0.4.22 for the `enter` scope fix (FluxML/IRTools.jl#166).
- Mark the primal frame name in pullback stacktraces broken on Julia 1.14.
- Remove Conda from the test deps; it is unused and failed to precompile
  from a restored CI cache.
- Time out CI test jobs after an hour.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Skip statements without line info in the catch-block error message

On Julia 1.15 nightly the first statement of a catch block can have no line info, so indexing `ir.lines` with it threw a BoundsError while compiling functions with try/catch/else and try/catch/finally.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.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.

1 participant