Skip to content

Backports for 1.13.0-rc2#61728

Open
KristofferC wants to merge 27 commits into
release-1.13from
backports-release-1.13
Open

Backports for 1.13.0-rc2#61728
KristofferC wants to merge 27 commits into
release-1.13from
backports-release-1.13

Conversation

@KristofferC
Copy link
Copy Markdown
Member

@KristofferC KristofferC commented May 6, 2026

Backported PRs:

Need manual backport:

Contains multiple commits, manual intervention needed:

Non-merged PRs with backport label:

DilumAluthgeBot and others added 3 commits April 24, 2026 13:52
#61643)

Stdlib: LinearAlgebra
URL: https://github.com/JuliaLang/LinearAlgebra.jl.git
Stdlib branch: release-1.13
Julia branch: backports-release-1.13
Old commit: 4786452
New commit: 0cfd355
Julia version: 1.13.0-beta3
LinearAlgebra version: 1.13.0
Bump invoked by: @dkarrasch
Powered by:
[BumpStdlibs.jl](https://github.com/JuliaLang/BumpStdlibs.jl)

Diff:
JuliaLang/LinearAlgebra.jl@4786452...0cfd355

```
$ git log --oneline 4786452..0cfd355
0cfd355 Backports to release v1.13 (#1577)
7e750f1 Run CI on v1.13
378f7aa Use `matprod_dest` mechanism consistently in triangular mul
064bc47 Backports to 1.13 (#1528)
e6086d4 Fix promotion in triangular linalg with mixed BLASFloats (#1561)
8c78509 docs: use current function signatures in @docs blocks (#1566)
dedcea0 matrix multiplication: delete unused functions `matmul2x2`, `matmul3x3` (#1564)
b1714dc resolve test ambiguities with Base (#1568)
1e08891 Generalize zero in Givens algorithm (#1562)
aa870fe Avoid construction in convert (#1556)
eebb473 Add ::Tuple assertion in fzero to prevent invalidation cascade (#1553)
096ff7a make 3-arg `*` run by BLAS in real/complex mixed cases (#1552)
9add3c6 Limit adj/trans `diagview` to matrices (#1550)
2e2da7b Fix `Matrix(::HessenbergQ)` and multiplication for empty matrices (#1546)
707fed4 Optimize `copytrito!(B, A, 'L')` (#1541)
c4152b8 Added note to BLAS.[g|s]et_num_threads about Apple Accelerate not supporting it  (#1195)
8068002 Added CHANGELOG.md for LinearAlgebra.jl (#1532)
27769a6 use muladd in generic_syrk (#1559)
cdee36a In-place multiplication of `Diagonal` with OffsetMatrix should throw (#1526)
```

Co-authored-by: dkarrasch <26658441+dkarrasch@users.noreply.github.com>
…its (#61680)

Another fix for #61671.

On Arrow Lake these have been observed to vary from core to core, but
these instructions are not available in user space so we should not be
using them to key our images / codegen.
…hybrid arch (#61679)

A backported version of d7bbc190fcee27fe19f11466813910a3d7c3f710
Expected to resolve #61671 for released versions of Julia.

Generated via Claude  by requesting translation / backport of that commit.

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
maleadt and others added 12 commits May 6, 2026 11:48
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Bumps [actions/github-script](https://github.com/actions/github-script) from 8.0.0 to 9.0.0.
- [Release notes](https://github.com/actions/github-script/releases)
- [Commits](actions/github-script@ed59741...3a2844b)

---
updated-dependencies:
- dependency-name: actions/github-script
  dependency-version: 9.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Bumps [julia-actions/setup-julia](https://github.com/julia-actions/setup-julia) from 2.7.0 to 3.0.1.
- [Release notes](https://github.com/julia-actions/setup-julia/releases)
- [Commits](julia-actions/setup-julia@4c0cb0f...f6f565d)

---
updated-dependencies:
- dependency-name: julia-actions/setup-julia
  dependency-version: 3.0.1
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
(cherry picked from commit 9a6eac9)
Change the anonymous function name for `if @generated` to use the module
counter.

Using `gensy` (`gensym()`) for anonymous module-level names is generally
avoided in lowering, since it makes the anonymized names susceptible to
changes to unrelated execution / lowering in other modules etc. (in the
same process), but it seems that we missed this usage.

Required for #61577, since
JuliaLowering cannot guarantee `gensym()` parity with flisp (only module
counter parity).

(cherry picked from commit b936235)
Also add helper functions so the supported layout forms are explicit at
each use site.

Co-authored-by: Codex <codex@openai.com>

This PR used to also contain the fix for
oscar-system/GAP.jl#1366 but I got that merged
separately via PR #61517

---

Off-topic, but: I am actually somewhat amazed by the AI here: while I
discovered the source of the bug myself, and the fix was clear, I
wondered if I could let the AI write the test for me... and then also
thought that some enums for the `fielddesc_type` values would be good...
I ended up *not* telling it about the specific crash; instead I just
asked it to introduce the enum and adjust the code to use it; and to
check for spots that are not handling all `fielddesc_type`. That's it. I
thought I'd follow this up with telling it what to fix and to add a test
case. But actually it one-shotted it, discovered the crash in
`summarysize` and created a test case. *I did not tell it there is a
crash.

Co-authored-by: Codex <codex@openai.com>
(cherry picked from commit 908d825)
When merging overlay and base method match results in `findall(sig,
::OverlayMethodTable)`, base methods whose signature is fully covered by
any of matching overlay methods' signatures are now filtered out.

Previously, both the overlay and base methods with the same signature
appeared in the results. This caused type inference to union their
return types even though the overlay should take dispatch priority.

While this is a general inference correctness improvement that makes
inference's emulation of overlay method selection at runtime more
"correct", it might be worth explaining the concrete need that motivates
this change:

Currently, inference for code like `[(x::Vector{Vector{Int}})...;]`
unexpectedly infers `Union{Vector{Int},Vector{Any}}` instead of
`Vector{Int}`, causing type instability isseus as reported in
aviatesk/JET.jl#413.
The root cause of this type instability is the existence of the fallback
method `vcat() = Any[]`.
To fix this, I initially attempted to remove the `vcat()` method
(#47628), but that turned out to be a considerably
breaking change, so I concluded it was not viable to proceed in that
direction as of Julia v1 time.
I also considered alternative approaches: 1.) changing the lowering of
`[x...;]` to produce a primitive for `vcat` that would allow inference
to work correctly in such cases, and 2.) adding a typed required 1st
argument to other `vcat` methods so that dispatch to `vcat()` would not
be considered — but both of those also proved impractical for various
reasons (primarily because the complexity they introduce is too high).
Removing the fallback method definitions for `vcat()` and `hcat()`
themselves would be the simplest and most elegant fix, but that would
have to wait for the release of Julia v2.

Therefore, rather than fixing this type instability on the Julia base
side, I believe the least invasive solution is to define, on the JET
side:
```julia
@overlay JET_METHOD_TABLE Base.vcat() = error()
```
so that, during JET's abstract interpretation, the method match that
could produce the `Vector{Any}` possibility is effectively ignored. And
this commit is required for that to actually work.

(cherry picked from commit 3181c36)
Fix missing `(JL_STREAM*)` cast for `jl_safe_static_show` in
`gc_assert_parent_validity` in gc-stock.c, which caused an
incompatible pointer type error.

Fix stale initializer in gc-debug.c: the `always_full` field was
removed from `jl_gc_debug_env_t` in #58713 but the corresponding `0`
in the initializer was not removed, causing excess-elements-in-scalar
warnings.

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
(cherry picked from commit 435b97e)
fixes #60304,
#61440,
#61441

the old approach was a little "clever" in this map-twice approach to
first make an array of `Ref` and then fill those results. I imagine the
intention was to use all the `map` specializations to keep the same
output type whenever possible. but `collect_similar` can also do this
and avoids the bugs arising for arrays where `x[i] !== x[i]`.

also there were several paths in the mutating `asyncmap!` that were
completely non-functional and some other drive-by cleanups.

co-developed with Opus 4.6

(cherry picked from commit ea8d7b9)
REPL.History.matchregions used naive string indexing, which assumed the
last character of match regions were ASCII. This led to StringIndexError
when searching for e.g. "α".

Tests were created with Claude Opus 4.7

Closes #61653

(cherry picked from commit 9c78a22)
(cherry picked from commit 361fd38)
Even without `reassoc` and with identical optimization flags, `contract`
alone is enough to see divergent floating-point results from identical
code so IEEE mode must not set it.

This change means that `muladd` never fuses under `--math-mode=ieee`
which is consistent with the existing semantics (fuse when possible, but
no guarantees)

(cherry picked from commit 13c2c70)
@KristofferC KristofferC force-pushed the backports-release-1.13 branch from 8137d6e to 0dc9d62 Compare May 6, 2026 09:48
Copy link
Copy Markdown
Member

@DilumAluthge DilumAluthge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[CI changes are fine, just updating the commit hashes of some external actions.]

DilumAluthgeBot and others added 8 commits May 18, 2026 18:26
…#61835)

Stdlib: SparseArrays
URL: https://github.com/JuliaSparse/SparseArrays.jl.git
Stdlib branch: release-1.13
Julia branch: backports-release-1.13
Old commit: 9d08bb3
New commit: 0ecfa6f
Julia version: 1.13.0-beta3
SparseArrays version: 1.13.0
Bump invoked by: @dkarrasch
Powered by:
[BumpStdlibs.jl](https://github.com/JuliaLang/BumpStdlibs.jl)

Diff:
JuliaSparse/SparseArrays.jl@9d08bb3...0ecfa6f

```
$ git log --oneline 9d08bb3..0ecfa6f
0ecfa6f Backports to release-1.13 (#717)
7a78eb0 fix 3-argument dot (#715)
```

Co-authored-by: dkarrasch <26658441+dkarrasch@users.noreply.github.com>
LazyLibrary is not supported yet by `--trim`.

We have plans to support it in 1.14 via TypedCallable or upcoming
AbstractLibrary changes (both expected within ~1 mo.), but for now to
avoid this regression on 1.13 we have to revert these changes.

Generated by Claude.
As far as I could tell we never added documentation to these debug
tools,
partly explaining why they keep bit-rooting.

Document the debugging tools enabled by building Julia with
`WITH_GC_DEBUG_ENV=1`, including the `JULIA_GC_ALLOC_POOL`,
`JULIA_GC_ALLOC_OTHER`, `JULIA_GC_ALLOC_PRINT`, and
`JULIA_GC_WAIT_FOR_DEBUGGER` environment variables, the `GC_VERIFY`
write-barrier verifier, and tips for debugging write-barrier violations
using GDB, ASLR disabling, and `rr` record-replay.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
(cherry picked from commit 5f9e892)
Both `OverrideStackAlignment` and `getStackProtectorGuard` are
ModuleFlags and should already be copied over, but
`m->setStackProtectorGuard(source->getStackProtectorGuard());` will set
the stack-protector flag to be the empty string.

Instead, we can copy the flags over from the source and then if they are
missing, initialize them to the expected ones.

(cherry picked from commit 9958ed3)
`gc_scrub_range` (active under `WITH_GC_DEBUG_ENV`) conservatively marks
any
pool object it finds on a task stack by setting `pg->has_marked = 1` and
`tag->bits.gc = GC_MARKED`. It does not account for the pool's
bump-pointer
allocation frontier (`pool->newpages`): slots at or beyond this boundary
are
unconditionally treated as garbage by `gc_sweep_page` regardless of
their GC
bits (the `(char*)v >= lim_newpages` check). When every slot on such a
page
falls past the frontier, `freedall` stays 1 and `assert(!freedall)`
fires.

The mismatch was introduced by PR #50137 (June 2023), which switched the
pool
allocator to a bump-pointer scheme and added the `lim_newpages` guard in
sweep, without updating `gc_scrub_range` to match.

Fix: relax the assertion to permit `freedall=1` when `lim_newpages` is
before
the end of the page (i.e., this is the currently-active bump-pointer
page).
That is precisely the case where `gc_scrub` can set `has_marked=1` while
the
sweep legitimately finds no live objects.

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
(cherry picked from commit 065c369)
fixes JuliaArrays/StaticArrays.jl#1282

test case minimized by codex

(cherry picked from commit 90e7065)
Fixes #61805

It seems that the problem is that our `foldr_impl` is passing a
non-reversed iterator to `_xfadjoint`, and then doing the actual final
reduction on a reversed iterator. This is normally fine, but it
interacts incorrectly with `FlatteningRF` which does a sub-reduction
inside each reducing step:
```julia
@inline function (op::FlatteningRF)(acc, x)
    op′, itr′ = _xfadjoint(op.rf, x)
    return _foldl_impl(op′, acc, itr′)
end
```
and this sub-reduction is not reversed when it gets hit during `foldr`,
resulting in the weird reduction order shown in the linked issue:
```julia
julia> foldr(Iterators.flatten([["a","b"],["c","d"]])) do l, r
           @info "" l r
           l * r
       end
┌ Info:
│   l = "d"
└   r = "c"
┌ Info:
│   l = "a"
└   r = "dc"
┌ Info:
│   l = "b"
└   r = "adc"
"badc"
```

This PR changes around the location of the `_reverse_iter` so that the
sub-reductions are also reversed:

```julia

julia> foldr(Iterators.flatten([["a","b"],["c","d"]])) do l, r
           @info "" l r
           l * r
       end
┌ Info:
│   l = "c"
└   r = "d"
┌ Info:
│   l = "b"
└   r = "cd"
┌ Info:
│   l = "a"
└   r = "bcd"
"abcd"
```

---------

Co-authored-by: Andy Dienes <51664769+adienes@users.noreply.github.com>
Co-authored-by: Matt Bauman <mbauman@juliahub.com>
(cherry picked from commit ccd0279)
timholy and others added 4 commits May 25, 2026 13:08
When a struct is redefined, we first check whether the new definition is
in fact identical to the old definition, and if so we just reuse the old
type. Revise leans pretty heavily on this behavior, as signature
extraction relies (in corner cases) on struct definition. As identified
in #61789, the equivalence check failed for self-referential `struct`s

```julia
struct R
    x
    next::R
end
```

The fix is fairly straightforward: before comparing equivalence with
`equiv_field_types`, ensure that type-substitution occurs throughout the
struct definition.

Fixes #61789

This pull request was written with the assistance of generative AI
(Claude Code, Opus 4.7).

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

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
(cherry picked from commit 3d6bb83)
fixes #61870, closes
#61871

```julia
julia> using BenchmarkTools

julia> function my_zero_inbounds!(A::Matrix{Float64})
           for i in eachindex(A)
               @inbounds A[i] = 0.0
           end
           return A
       end
my_zero_inbounds! (generic function with 1 method)

julia> function my_zero!(A::Matrix{Float64})
           for i in eachindex(A)
               A[i] = 0.0
           end
           return A
       end
my_zero! (generic function with 1 method)

julia> @benchmark my_zero_inbounds!(X) setup=X=rand(1000, 1000)
BenchmarkTools.Trial: 10000 samples with 1 evaluation per sample.
 Range (min … max):  27.083 μs … 226.500 μs  ┊ GC (min … max): 0.00% … 0.00%
 Time  (median):     32.750 μs               ┊ GC (median):    0.00%
 Time  (mean ± σ):   41.400 μs ±  15.265 μs  ┊ GC (mean ± σ):  0.00% ± 0.00%

  ▅▆██▇▅▃▂▁▁ ▇ ▂ ▂▃▂  ▁    ▂▅▅▅▄▃▂▁▂▁▁▃▁▁▁▂▂▂▁▁ ▁    ▁ ▃▂      ▂
  ██████████▇████████▇█▇▇▇▆██████████████████████▇███████▇▆▇█▆ █
  27.1 μs       Histogram: log(frequency) by time      82.8 μs <

 Memory estimate: 0 bytes, allocs estimate: 0.

julia> @benchmark my_zero!(X) setup=X=rand(1000, 1000)
BenchmarkTools.Trial: 10000 samples with 1 evaluation per sample.
 Range (min … max):  27.125 μs … 156.000 μs  ┊ GC (min … max): 0.00% … 0.00%
 Time  (median):     30.167 μs               ┊ GC (median):    0.00%
 Time  (mean ± σ):   33.619 μs ±   5.419 μs  ┊ GC (mean ± σ):  0.00% ± 0.00%

         █▇                            ▂
  ▂▃▃▄▂▂████▃▂▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▃▃▃▃▂▃▅▇▇█▄▂▂▂▂▂▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ ▂
  27.1 μs         Histogram: frequency by time         45.8 μs <

 Memory estimate: 0 bytes, allocs estimate: 0.
```

previously the non-inbounds one was slower
```julia
julia> @benchmark my_zero!(X) setup=X=rand(1000, 1000)
BenchmarkTools.Trial: 10000 samples with 1 evaluation per sample.
 Range (min … max):  55.250 μs …  1.088 ms  ┊ GC (min … max): 0.00% … 0.00%
 Time  (median):     63.250 μs              ┊ GC (median):    0.00%
 Time  (mean ± σ):   67.430 μs ± 15.484 μs  ┊ GC (mean ± σ):  0.00% ± 0.00%

  ▄ ▁▁▆▅▁   █▆▃▄▃▂▂▂▂▁▁▁▁▁▅▁▂▂▁▁▂▃▁▁                ▂▃▂▁      ▂
  ███████▇▇▇███████████████████████████▇▇▇▆▆▆▆▅▅▆▇▇█████▇█▇▇▇ █
  55.2 μs      Histogram: log(frequency) by time      98.4 μs <

 Memory estimate: 0 bytes, allocs estimate: 0.
```

(cherry picked from commit 8bb4ad6)
(cherry picked from commit f4596e5)
Co-authored-by: Cody Tapscott <84105208+topolarity@users.noreply.github.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.