Skip to content

Backports for 1.13.0-beta2#60614

Merged
KristofferC merged 34 commits intorelease-1.13from
backports-release-1.13
Feb 3, 2026
Merged

Backports for 1.13.0-beta2#60614
KristofferC merged 34 commits intorelease-1.13from
backports-release-1.13

Conversation

@KristofferC
Copy link
Copy Markdown
Member

@KristofferC KristofferC commented Jan 9, 2026

Backported PRs:

Need manual backport:

Contains multiple commits, manual intervention needed:

Non-merged PRs with backport label:

@KristofferC KristofferC added the release Release management and versioning. label Jan 9, 2026
@KristofferC KristofferC requested a review from giordano as a code owner January 9, 2026 14:38
@DilumAluthge DilumAluthge added the don't squash Don't squash merge label Jan 14, 2026
stevengj and others added 8 commits January 14, 2026 18:06
(cherry picked from commit 8101956)
Moving out closures into separate functions, using `@lock` instead of
`lock() do`.

(cherry picked from commit 915a892)
…60615)

Co-authored-by: KristofferC <1282691+KristofferC@users.noreply.github.com>
Co-authored-by: KristofferC <1282691+KristofferC@users.noreply.github.com>
@DilumAluthge DilumAluthge force-pushed the backports-release-1.13 branch from 04dbf3f to 3fb442e Compare January 14, 2026 23:06
@DilumAluthge DilumAluthge removed the request for review from giordano January 14, 2026 23:33
DilumAluthgeBot and others added 17 commits January 15, 2026 20:17
…#60700)

Stdlib: SparseArrays
URL: https://github.com/JuliaSparse/SparseArrays.jl.git
Stdlib branch: release-1.13
Julia branch: backports-release-1.13
Old commit: 26c80c8
New commit: 6b7e9ef
Julia version: 1.13.0-beta1
SparseArrays version: 1.13.0
Bump invoked by: @dkarrasch
Powered by:
[BumpStdlibs.jl](https://github.com/JuliaLang/BumpStdlibs.jl)

Diff:
JuliaSparse/SparseArrays.jl@26c80c8...6b7e9ef

```
$ git log --oneline 26c80c8..6b7e9ef
6b7e9ef Backports to release v1.13 (#665)
0a37c0c Update CI workflow for Julia and checkout action (#659)
1216e80 Separate out tests for the GPL build and do not run them when GPL libs are not present (#658)
0f0cd32 Remove more bounds checks (#661)
d53ae09 Fix generic sparse-dense multiplication (#663)
```

Co-authored-by: dkarrasch <26658441+dkarrasch@users.noreply.github.com>
…0788)

Backport a fix from #59413 to unbreak `Compiler.inflate_ir!` with const-return IR.
We store the previous scope in the eh_state and thus hide it from GC.
This means we need to manually preserve that scope across the `try ... catch`,
instead fo the new scope that we switch to.

---------
Co-authored-by: Nathan Daly <nathan.daly@relational.ai>
Co-authored-by: Keno Fischer <keno@juliacomputing.com>

(cherry picked from commit f22ae77)
## Summary

This PR fixes the performance regression where `@fastmath x^2` for
`Float32` was not being inlined to efficient LLVM code, unlike
`Float64`.

## Problem

As reported in #60639, `@fastmath x^2` for `Float32` was falling back to
`power_by_squaring` instead of using the LLVM `powi` intrinsic. This
resulted in:
- Unnecessary function calls instead of inline multiplication
- Potential type promotion to `Float64`
- Suboptimal generated code compared to `Float64`

Before this fix, `@code_llvm @fastmath Float32(1.5)^2` would show calls
to `power_by_squaring`, while `Float64` correctly used the `llvm.powi`
intrinsic.

## Solution

Added the missing `pow_fast` methods for `Float32` and `Float16`:

- `pow_fast(::Float32, ::Int32)` - uses `llvm.powi.f32.i32` intrinsic
directly
- `pow_fast(::Float32, ::Integer)` - wrapper that converts to `Int32`
when safe, matching the `Float64` pattern
- `pow_fast(::Float16, ::Integer)` - converts to `Float32`, computes,
and converts back

This mirrors the existing implementation for `Float64` which already
used `llvm.powi.f64.i32`.

## Testing

Added a regression test that verifies `@fastmath x^2` generates inline
`fmul` instructions (not `power_by_squaring` calls) for `Float16`,
`Float32`, and `Float64`.

Fixes #60639

---------

Co-authored-by: Oscar Smith <oscardssmith@gmail.com>
(cherry picked from commit f34d5f2)
This gets rid of the following JET warnings (present on julia
1.13.0-beta1 with JET
aviatesk/JET.jl@377fa53
(see aviatesk/JET.jl#796 why I did not use a
released version), no longer present with this patch applied onto julia
1.13.0-beta1)
```julia
julia> @report_call Base.process_backtrace(Base.stacktrace(Base.backtrace()))
[ Info: tracking Base
┌ Warning: skipping var"#sprint#423"(context, sizehint::Integer, ::typeof(sprint), f::Function, args...) @ Base strings/io.jl:102 to avoid parsing too much code
└ @ Revise ~/.julia/packages/Revise/icvyF/src/packagedef.jl:1344
═════ 3 possible errors found ═════
┌ process_backtrace(t::Vector{Base.StackTraces.StackFrame}) @ Base ./errorshow.jl:1094
│┌ process_backtrace(tracecount::Vector{Any}) @ Base ./errorshow.jl:1100
││┌ _backtrace_collapse_repeated_locations!(trace::Vector{Any}) @ Base ./errorshow.jl:1048
│││┌ sprint(f::typeof(show), args::Base.StackTraces.StackFrame) @ Base ./strings/io.jl:102
││││┌ sprint(f::typeof(show), args::Base.StackTraces.StackFrame; context::Nothing, sizehint::Int64) @ Base ./strings/io.jl:109
│││││┌ show(io::IOBuffer, frame::Base.StackTraces.StackFrame) @ Base.StackTraces ./stacktraces.jl:331
││││││┌ show_spec_linfo(io::IOBuffer, frame::Base.StackTraces.StackFrame) @ Base.StackTraces ./stacktraces.jl:282
│││││││┌ show_custom_spec_sig(io::IOBuffer, owner::Any, linfo::Core.CodeInstance, frame::Base.StackTraces.StackFrame) @ Base.StackTraces ./stacktraces.jl:298
││││││││ no matching method found `show_spec_sig(::IOBuffer, ::Module, ::Any)` (1/2 union split): Base.StackTraces.show_spec_sig(io::IOBuffer, mi.def::Union{Method, Module}, mi.specTypes::Any)
│││││││└────────────────────
││││││┌ show_spec_linfo(io::IOBuffer, frame::Base.StackTraces.StackFrame) @ Base.StackTraces ./stacktraces.jl:286
│││││││┌ getproperty(x::Nothing, f::Symbol) @ Base ./Base_compiler.jl:57
││││││││ invalid builtin function call: getfield(x::Nothing, f::Symbol)
│││││││└────────────────────
││││││┌ show_spec_linfo(io::IOBuffer, frame::Base.StackTraces.StackFrame) @ Base.StackTraces ./stacktraces.jl:286
│││││││ no matching method found `show_spec_sig(::IOBuffer, ::Nothing, ::Any)` (1/2 union split): Base.StackTraces.show_spec_sig(io::IOBuffer, def::Union{Nothing, Method}, (Base.StackTraces.frame_mi(frame::Base.StackTraces.StackFrame)::Union{Nothing, Core.MethodInstance}).specTypes::Any)
││││││└────────────────────
```

It would be great to get this backported to 1.12 and 1.13.

cc @fingolfin

(cherry picked from commit 57d5fb1)
This might cause double frees/use after frees.

Found on the mimalloc PR

(cherry picked from commit 06def89)
Since this task's stack or scope field could have been modified after it
was marked by an incremental collection (and not just for copy stacks),
move the barrier back unconditionally here.

---------

Co-authored-by: Valentin Churavy <v.churavy@gmail.com>
Co-authored-by: Jeff Bezanson <jeff.bezanson@gmail.com>
(cherry picked from commit 14ca1ab)
…60720)

We're currently excepting callers of `addExternalModule` to provide
modules with a DL that contains NI tags:

```
ERROR: LoadError: LLVM error: Added modules have incompatible data layouts: e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-n32:64-S128-Fn32 (module) vs e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-n32:64-S128-Fn32-ni:10:11:12:13 (jit)
```

Doing so is invalid and asserts later during compilation:

```
Assertion failed: (Target.isCompatibleDataLayout(getDataLayout()) && "Can't create a MachineFunction using a Module with a " "Target-incompatible DataLayout attached\n"), function init, file /workspace/srcdir/llvm-project/llvm/lib/CodeGen/MachineFunction.cpp, line 248.
```

The NI tags are stripped during optimization, and modules passed to
`addExternalModule` are expected to be optimized as they are passed
straight to the JIT (as opposed to `addModule`), so we should make sure
to use the correct data layout.

(cherry picked from commit 3a884a7)
Inherit alignment from the original GC allocation with
JL_SMALL_BYTE_ALIGNMENT
as the minimum. Use alignment-sized integer chunks for the alloca type
(matching emit_static_alloca) so SROA splits allocations into aligned
pieces
for better performance and vectorization.

Also adds the missing setAlignment call in splitOnStack.

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

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
(cherry picked from commit 54fde7e)
~~(I wrote this with assistance from Gemini since I'm not very used to
writing LLVM IR)~~ No longer using that code

This is an attempt to fix
#60441. After bumbling around a
bit, it seems that the problem is that `invoke(f, ::CodeInstance,
args...)` calls are not turned into `Expr(:invoke` statements in the IR,
but remains as `:call`s to the `invoke` builtin which ends up going
through the runtime.

~~There's probably a better way to do this, but the way I found was to
just detect these builtin calls in the LLVM IR, and send them to
`emit_invoke`.~~ I'm now detecting `InvokeCICallInfo`s in the inlining
step of the optimizer and turning those into `Expr(:invoke`s.

It appears to resolve the issue:
```julia
using BenchmarkTools

mysin(x::Float64) = sin(x)
@Assert mysin(1.0) == sin(1.0)
const mysin_ci = Base.specialize_method(Base._which(Tuple{typeof(mysin), Float64})).cache
```
Before this PR:
```julia
julia> @Btime invoke(mysin, mysin_ci, x) setup=(x=rand())
  24.952 ns (2 allocations: 32 bytes)
0.7024964043721993
```
After this PR:
```julia
julia> @Btime invoke(mysin, mysin_ci, x) setup=(x=rand())
  4.748 ns (0 allocations: 0 bytes)
0.32283046823183426
```

(cherry picked from commit e1dda38)
We were missing handling for the case where the binding that we're using
is ambiguous. There are two possible behaviors:

1. The ambiguous binding gets ignored for the purpose of resolution
2. The ambiguity poisons and the imported binding is also ambiguous

Current behavior between these two depends on resolution order (which is
bad and part of what the assert was complaining about). This decides
that case #2 is the correct behavior and fixes #60659.

(cherry picked from commit 0f275e3)
During incremental compaction a forwarded NewSSAValue with a negative id
was treated like an SSAValue, producing SSAValue(-n) and tripping
`renumber_ssa2` bounds checks. Only convert NewSSAValue to SSAValue when
the id is positive, so new_new_nodes references remain valid.

Fixes #57827.
Found by claude-code debugging a random zygote issue:
SciML/NeuralPDE.jl#1020 (comment).

`spvals` just doesn't exist within this function. This issue has
apparently existed since Julia 1.6
KristofferC and others added 9 commits January 29, 2026 20:27
`MustAlias` has `has_extended_unionsplit(::MustAliasLattice) === true`
so it is treated as a target for union split, but `uniontypes` does not
handle `MustAlias` specially, causing union split to fail for
`MustAlias`.

This issue is addressed by always applying `uniontypes` to the result of
`widenconst(x)`.
External custom lattice implementations could previously provide their
own `uniontypes`, but it would be cleaner interface design if they just
overload `widenconst` for their custom lattice elements so that it
returns `Union`-type.
Test suite: switch to `httpbingo.julialang`, fall back to `httpbin.julialang` on failure

(cherry picked from commit 5ab8db3)
(cherry picked from commit e4cfa46)
(cherry picked from commit 2db36c1)
That is, if it is called twice (e.g. because precompilation is disabled)
with identical arguments, then this should not trigger an assertion.

This should resolve oscar-system/GAP.jl#1314

(cherry picked from commit 1708d99)
…ished or be interrupted (#60822)

resolve #60797

Co-authored-by: songjhaha <songjh96@foxmali.com>
Co-authored-by: Ian Butterworth <i.r.butterworth@gmail.com>
Co-authored-by: Chengyu Han <git@wo-class.cn>
(cherry picked from commit d8994dc)
(cherry picked from commit 99a8a7a)
@KristofferC KristofferC merged commit a06f152 into release-1.13 Feb 3, 2026
7 checks passed
@KristofferC KristofferC deleted the backports-release-1.13 branch February 3, 2026 11:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

don't squash Don't squash merge release Release management and versioning.

Projects

None yet

Development

Successfully merging this pull request may close these issues.