Skip to content

Backports release 1.11 #57714

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 56 commits into from
Apr 10, 2025
Merged

Backports release 1.11 #57714

merged 56 commits into from
Apr 10, 2025

Conversation

KristofferC
Copy link
Member

@KristofferC KristofferC commented Mar 11, 2025

Backported PRs:

Need manual backport:

Contains multiple commits, manual intervention needed:

Non-merged PRs with backport label:

KlausC and others added 14 commits March 25, 2025 19:38
Improve performance of `^(::Float64, n::Integer)` in the case of `abs(n)
> 2^13`.

While `pow_body` is unreliable for `abs(n) > 2^25` this implementation
provides errors of a few ULPs, while runtime is capped to that of the
`Float64` implementation.

Fixes  #53881
See also #53886.

(cherry picked from commit fe49d56)
- `dirname.c` was removed by
c2cec7a

(cherry picked from commit 85dc2c7)
Other backends (in this case NVPTX) require that `invariant.load`
metadata is maintained to generate non-coherent loads.

Currently, we unconditionally strip that metadata from all loads,
since our other uses of it may have become invalid.

x-ref: llvm/llvm-project#112834
JuliaGPU/CUDA.jl#2531

---------

Co-authored-by: Gabriel Baraldi <[email protected]>
(cherry picked from commit 29da86b)
Fixes the double accounting of the union byte array in
`Base.summarysize` as described in #57506.

If this is the correct fix, can it be backported to 1.11?

Fix #57506

(cherry picked from commit 7b7ba33)
…constructor (#57599)

Avoiding the converting `setindex!` should hopefully diminish
unwarranted invalidation of user code.

(cherry picked from commit 1e03ed6)
)

The type assertions are valid according to the doc strings of these
functions in the case of `AbstractString`.

Should prevent some invalidation on loading user code.

Fixes #57605

(cherry picked from commit 6c9c336)
Otherwise error when calling `print_inline_table`

(cherry picked from commit f207224)
…on (#57476)

Typevars are all existential (in the sense of variable lb/ub) during
intersection. This fix is somehow costly as we have to perform 3 times
check to prove a false result. But a single existential <: seems too
dangerous as it cause many circular env in the past.
fix #57429
fix #41561

(cherry picked from commit beb928b)
…lignment to LLVM (#56938)

Fixes #56937

---------

Co-authored-by: Oscar Smith <[email protected]>
(cherry picked from commit 1e2758e)
The alignment of a nested object (in C layouts) is not affected by the
alignment of its parent container when computing a field offset (as if
it will be allocated at address 0). This can be strongly
counter-intuitive (as it implies it should add padding where it does not
seem to provide value to the user), but this is required to match the C
standard. It also permits users to write custom allocators which happen
to provide alignment in excess of that which codegen may assume is
guaranteed, and get the behavioral characteristics they intended to
specify (without resorting to computing explicit padding).

Addresses
#57713 (comment)

(Cherry-picked from c9008ff, with
typo fix to typed_loaded memcpy which was already deleted from master)
…eless inferred code" (#57864)

This reverts commit bdf8219, from
#56749

**Note that this PR is made against `backports-release-1.11`.**

Rationale: when coverage is on, both the native code and the inferred
code might be eliminated, a complete loss of all precompilation results.
There are intentions to adopt a new strategy for Julia 1.12, but in the
meantime we should revert this change since it is "just" a sysimg size
reduction.

Affected Julia versions: 1.11.3, 1.11.4

xref
timholy/SnoopCompile.jl#413 (comment)
@KristofferC KristofferC force-pushed the backports-release-1.11 branch from 59ec75e to 56909d7 Compare March 25, 2025 18:38
@lgoettgens
Copy link
Contributor

lgoettgens commented Mar 27, 2025

The list of commits to backports here (and also in the 1.12 backport PR) is missing #57493. Even though this is shown as closed, it has been merged to master as e2cc68c. (In the PR thread is a small discussion about the github weirdness happening around this.)
It would be great if we could get this backported.

cc @thofma

@gbaraldi
Copy link
Member

@IanButterworth
Copy link
Member

My bad, but can we make finalizers throw during julia CI?

IanButterworth and others added 7 commits March 27, 2025 18:47
Fixes #57141.

Given the function

```julia
julia> function _f()
           ref = Ref{Any}()
           ref[] = 3
           @Assert isdefined(ref, :x)
           inner = Returns(ref)
           x = inner()
           (x, ref[])
       end
_f (generic function with 1 method)

julia> f() = first(_f())
f (generic function with 1 method)
```

Here is before:
```julia
julia> @code_typed f()
CodeInfo(
1 ─ %1 = %new(Base.RefValue{Any})::Base.RefValue{Any}
└──      goto #3
2 ─      unreachable
3 ─      return %1
) => Base.RefValue{Any}
```

Here is after this PR:
```julia
julia> @code_typed f()
CodeInfo(
1 ─ %1 = %new(Base.RefValue{Any})::Base.RefValue{Any}
│          builtin Base.setfield!(%1, :x, 3)::Int64
│   %3 =   builtin Main.isdefined(%1, :x)::Bool
└──      goto #3 if not %3
2 ─      goto #4
3 ─ %6 =    invoke Base.AssertionError("isdefined(ref, :x)"::String)::AssertionError
│          builtin Base.throw(%6)::Union{}
└──      unreachable
4 ─      return %1
) => Base.RefValue{Any}
```

The elimination of `setfield!` was due to a use still being recorded for
`ref[]` in the def-use data while DCE eliminated this `getindex` call
(by virtue of not using the second tuple element in the result).

---------

Co-authored-by: Cédric Belmant <[email protected]>
Co-authored-by: Shuhei Kadowaki <[email protected]>
(cherry picked from commit fea26dd)
…it on (#57585)

Reduces the number of invalidations from 512 to 505 on running this
code:

```julia
struct I <: Integer end
Base.Int(::I) = 7
```

(cherry picked from commit a97137e)
Make this function `--trim` compatible.

(cherry picked from commit 8edc2b3)
Co-authored-by: Jishnu Bhattacharya <[email protected]>
(cherry picked from commit 3e57a8a)
@KristofferC KristofferC force-pushed the backports-release-1.11 branch from 5c74dc0 to 618c74e Compare March 31, 2025 19:26
When pre-compiling `stdlib/` this cache has a 91% hit rate, so this
seems fairly profitable. It also dramatically improves some pathological
cases, a few of which have been hit in the wild (arguably due to
inference bugs)

Without this PR, this package takes exponentially long to pre-compile:
```julia
function BigType(N)
    (N == 0) && return Nothing
    T = BigType(N-1)
    return Pair{T,T}
end
foo(::Type{T}) where T = T
precompile(foo, (Type{BigType(40)},))
```

For an in-the-wild test case hit by a customer, this reduces
pre-compilation time from over an hour to just ~two and a half minutes.

Resolves #53331.
@topolarity topolarity force-pushed the backports-release-1.11 branch from 75bf576 to ee1e525 Compare April 1, 2025 16:12
visr and others added 3 commits April 4, 2025 16:59
When SSL_CERT_FILE or SSL_CERT_DIR is set, it is [impossible to set this
location](https://github.com/libgit2/libgit2/blob/4dcdb64c6844d76776745cdc25071a72c1af84d6/src/libgit2/settings.c#L206-L222)
in LibGit2_jll on Apple and Windows because [it isn't built with support
for
that](https://github.com/JuliaPackaging/Yggdrasil/blob/7123a60a68102ba6cd953e13a4e45845dc37fd82/L/LibGit2/build_tarballs.jl#L67).
Until now we've errored out with a message telling users to set
JULIA_SSL_CA_ROOTS_PATH to an empty string, which is a somewhat
problematic workaround because the Windows environment variables UI
doesn't allow empty values, and [setting it to an empty string from
PowerShell unsets
it](https://discourse.julialang.org/t/how-to-fix-ssl-cert-issues-in-pkg/115495/7?u=visr).
This PR changes the behavior to allow this expected error.

Variables like SSL_CERT_FILE are for instance [set by the Conda OpenSSL
package on environment
activation](https://github.com/conda-forge/openssl-feedstock/blob/83b5e2a793bc95d19e6cc2d9d28068f1a6ff6b79/recipe/activate-win.ps1)
used by e.g. Python, ensuring many people cannot use Pkg operations that
use LibGit2, like `dev Example`, `add Example#master`. See more user
reports [on
Discourse](https://discourse.julialang.org/search?q=JULIA_SSL_CA_ROOTS_PATH).

Together with JuliaLang/NetworkOptions.jl#37
this should improve the experience of users trying out Julia from a
Conda environment. This should also be fine to backport.

(cherry picked from commit 7fa969a)
Makes the sysimage more resistant to method invalidation, when defining
a new `Integer` subtype with a right bitshift method.

(cherry picked from commit 69a22cf)
Without this change `prevpow` and `nextpow` fail for, e.g., `BigInt`;
incorrectly throwing a `MethodError`. For example, calls like
`prevpow(3, big"10")` or `nextpow(3, big"10")` fail.

The issue is that the code incorrectly assumes the existence of a
`typemax` method.

Another issue was a missing promote for the arguments of a
`mul_with_overflow` call.

Fixes #57906

(cherry picked from commit 3627a85)
@stemann
Copy link

stemann commented Apr 5, 2025

@KristofferC If possible, please bump Pkg to include JuliaLang/Pkg.jl#4140 (related to JuliaLang/Pkg.jl#4141) - should fix #56458.

KristofferC and others added 3 commits April 5, 2025 20:20
lld 17 and above by default error if symbols listed in the version
script are undefined. Julia has a few of these, as some symbols are
defined conditionally in Julia (e.g. based on OS), others perhaps have
been removed from Julia and other seem to be defined in other libraries.
Further the version script is used in linking three times, each time
linking together different objects and so having different symbols
defined.

Adding `-Wl,--undefined-version` is not a great solution as passing that
to ld < 2.40 errors and there doesn't seem to be a great way to check if
a linker supports this flag.
I don't know how to get around these errors for symbols like
`_IO_stdin_used` which Julia doesn't define and it seems to matter
whether or not they are exported, see
https://libc-alpha.sourceware.narkive.com/SevIQmU3/io-stdin-used-stripped-by-version-scripts.
So I've converted all undefined symbols into wildcards to work around
the error.

Fixes #50414, fixes #54533 and replaces #55319.

---------

Co-authored-by: Zentrik <[email protected]>
(cherry picked from commit d269d7d)
@KristofferC
Copy link
Member Author

@nanosoldier runtests(vs=":release-1.11")

@gbaraldi gbaraldi force-pushed the backports-release-1.11 branch from 7d79a8b to 99a18f6 Compare April 7, 2025 20:06
@nanosoldier
Copy link
Collaborator

The package evaluation job you requested has completed - possible new issues were detected.
The full report is available.

Report summary

❗ Packages that crashed

3 packages crashed only on the current version.

  • An unreachable instruction was executed: 1 packages
  • A segmentation fault happened: 2 packages

22 packages crashed on the previous version too.

✖ Packages that failed

50 packages failed only on the current version.

  • Package fails to precompile: 9 packages
  • Package has test failures: 5 packages
  • Package tests unexpectedly errored: 6 packages
  • Package requires a missing binary dependency: 1 packages
  • Networking-related issues were detected: 1 packages
  • Tests became inactive: 3 packages
  • Test duration exceeded the time limit: 25 packages

2861 packages failed on the previous version too.

✔ Packages that passed tests

36 packages passed tests only on the current version.

  • Other: 36 packages

6204 packages passed tests on the previous version too.

➖ Packages that were skipped altogether

2 packages were skipped only on the current version.

  • Package could not be installed: 2 packages

1299 packages were skipped on the previous version too.

)

Fix #57852.
The 'e->triangle' branch doesn't make sense for variables outside the
constructor.
Let pkgeval tell us if `constraintkind` based branches are suitable for
handling them.
(The second commit is needed to fix some stack overflow regression.)

(cherry picked from commit ec424d4)
@KristofferC
Copy link
Member Author

@nanosoldier runtests(["Hygienic", "FloatTracker", "PlutoHooks", "DarkCurves", "JuliaInterpreter", "Curve25519", "LogDensityProblemsAD", "LinearMaps", "ColPack", "StableHashTraits", "BlockArrays", "UCX", "Quaternionic", "BasicBSpline", "Folds", "Herb", "PointNeighbors", "Evolutionary", "PlutoPlotly", "PlantRayTracer", "LaTeXCompilers", "MRICoilSensitivities", "PlutoStyles", "PlutoSplitter", "JupyterPlutoConverter", "NEOSServer", "CompressedSensing", "OptimizationNLPModels", "TableTransforms", "Strided", "PlutoPages", "PALEOocean", "FinanceModels", "ParametrisedConvexApproximators", "MLJTestIntegration", "GeometricProblems", "OptimalBranchingMIS", "SDEProblemLibrary", "ModelOrderReduction", "LiquidElectrolytes", "NestedEnvironments", "PlugFlowReactor", "Modia", "LibTrixi", "CEEDesigns", "AtmosphericDeposition", "OVERT", "Test"], vs = ":release-1.11")

@nanosoldier
Copy link
Collaborator

The package evaluation job you requested has completed - possible new issues were detected.
The full report is available.

Report summary

❗ Packages that crashed

1 packages crashed only on the current version.

  • A segmentation fault happened: 1 packages

✖ Packages that failed

15 packages failed only on the current version.

  • Package fails to precompile: 9 packages
  • Package has test failures: 1 packages
  • Package tests unexpectedly errored: 3 packages
  • Test duration exceeded the time limit: 2 packages

5 packages failed on the previous version too.

✔ Packages that passed tests

1 packages passed tests only on the current version.

  • Other: 1 packages

26 packages passed tests on the previous version too.

@KristofferC
Copy link
Member Author

Pluto stuff is fonsp/Pluto.jl#3178

Not sure about:

Error During Test at /home/pkgeval/.julia/packages/DarkCurves/ULKGM/test/curve.test.jl:20
  Test threw exception
  Expression: double(b) == convert(ptp, double(b_ref))
  MethodError: convert(::Type{MLUInt{4, UInt64}}, ::MLInt{4, UInt64}) is ambiguous.
  
  Candidates:
    convert(::Type{MLUInt{N, T}}, x::Integer) where {N, T}
      @ DarkIntegers ~/.julia/packages/DarkIntegers/wu36S/src/multi_limb.jl:96
    convert(::Type{V}, x::MLInt{N, T}) where {V<:Unsigned, N, T}
      @ DarkIntegers ~/.julia/packages/DarkIntegers/wu36S/src/multi_limb_signed.jl:115
  
  Possible fix, define
    convert(::Type{MLUInt{N, T}}, ::MLInt{N, T}) where {T, N, N, T}
  
  Stacktrace:
    [1] rem(x::MLInt{4, UInt64}, T::Type{MLUInt{4, UInt64}})

@KristofferC
Copy link
Member Author


math                                              (5) \|         failed at 2025-04-09T11:53:57.806
--
  | Test Failed at /cache/build/tester-amdci5-11/julialang/julia-release-1-dot-11/julia-88568a8784/share/julia/test/math.jl:1600
  | Expression: Core.Compiler.is_foldable(effects)
  | Context: effects = (+c,+e,+n,!t,+s,+m,+u,+o,+r)
  | T = Float64

seems to fail on 32-bit linux, sigh.

@KristofferC KristofferC merged commit 2b7a874 into release-1.11 Apr 10, 2025
6 checks passed
@KristofferC KristofferC deleted the backports-release-1.11 branch April 10, 2025 17:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release Release management and versioning.
Projects
None yet
Development

Successfully merging this pull request may close these issues.