Skip to content

Conversation

jishnub and others added 2 commits February 20, 2025 18:57
This reinstates slightly altered versions of the methods that were
removed in JuliaLang/julia#52389. Sort of fixes
#1205, although this doesn't recover the full performance. However, this
version is more general, and works with the example presented in
JuliaLang/julia#52389. There's still a
performance regression, but the full performance may only be obtained
for mutable matrices, and we may not assume mutability in general.

Performance:
v1.10:

```julia
julia> n = 100
100

julia> A = adjoint(sparse(Float64, I, n, n));

julia> B = Diagonal(ones(n));

julia> @Btime $A * $B;
  837.119 ns (5 allocations: 2.59 KiB)
```

This PR
```julia
julia> @Btime $A * $B;
  1.106 μs (15 allocations: 5.56 KiB)
```
We need double the allocations here compared to earlier, as we firstly
materialize `D' * A'`, and then we again copy the adjoint of this
result. I wonder if this may be reduced.

---------

Co-authored-by: Daniel Karrasch <[email protected]>
@ViralBShah
Copy link
Member

ViralBShah commented Feb 20, 2025

Shouldn't we pull in all the other PRs that were merged since branching? #1186 is the only one I am not sure of.

@dkarrasch
Copy link
Member Author

I don't know. Until when are we going to backport feature PRs? #1194 has been marked for backport already in another bump stdlib PR, that's why I included it. #1207 fixes a regression and needs to be backported even to v1.11.

@ViralBShah
Copy link
Member

ViralBShah commented Feb 20, 2025

I am thinking we pull in everything until we get to RCs (except for bug changes).

Does it make sense to stay on Linalg master and branch much later? That would mean holding off PRs like #1186 from merging when we are in the feature freeze (all the way to RCs), and that can often be many months.

@codecov
Copy link

codecov bot commented Feb 20, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.90%. Comparing base (e7da19f) to head (6b5bdf2).
Report is 8 commits behind head on release-1.12.

Additional details and impacted files
@@               Coverage Diff                @@
##           release-1.12    #1217      +/-   ##
================================================
+ Coverage         91.89%   91.90%   +0.01%     
================================================
  Files                34       34              
  Lines             15360    15385      +25     
================================================
+ Hits              14115    14140      +25     
  Misses             1245     1245              

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

@jishnub
Copy link
Member

jishnub commented Feb 21, 2025

Won't that make it much harder to deal with regressions on the backport branches? Before the repo was split, only bugfixes used to be backported. It's easier if regressions stay on the master branch, where firstly it's possible to address them faster, and secondly they don't delay releases.

Keno and others added 4 commits February 25, 2025 13:14
These would otherwise give a warning after
JuliaLang/julia#57311, but are a good change
even independently.

---------

Co-authored-by: Daniel Karrasch <[email protected]>
(cherry picked from commit 2a1696a)
This manually adds the critical optimisation investigated in
JuliaLang/julia#56954. While we could rely on
LLVM to continue doing this optimisation, it's more robust to add it
manually.

(cherry picked from commit ed35a37)
As noted in #1193,
the `sqrt(::Digonal{<:Real})` method requires the diagonal element to be
positive, so that `sqrt` is defined for the individual elements. We
therefore may restrict the diagonal branch in the dense `sqrt` method to
matrices with positive `diag` if the `eltype` is `Real`.

Fixes #1193

After this,
```julia
julia> A = diagm(0 => [1.0, -1.0])
2×2 Matrix{Float64}:
 1.0   0.0
 0.0  -1.0

julia> sqrt(A)
2×2 Matrix{ComplexF64}:
 1.0+0.0im  0.0+0.0im
 0.0+0.0im  0.0+1.0im
```

(cherry picked from commit 16d9d61)
@KristofferC KristofferC merged commit f0f7a46 into release-1.12 Feb 25, 2025
4 checks passed
@KristofferC KristofferC deleted the backports-release-1.12 branch February 25, 2025 14:24
@ViralBShah
Copy link
Member

Yes agree. Let's just focus on getting bugfixes.

@RalphAS
Copy link

RalphAS commented Apr 4, 2025

If #1214 doesn't get backported, it's a breaking change. I might be the only one who cares, but I'd like to know if that's actually a decision or a can kicked down the road.

@jishnub
Copy link
Member

jishnub commented Apr 4, 2025

Yes we should backport that PR (it seems to be happening in #1237)

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.

7 participants