Skip to content
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

Backports release 1.11 #53790

Merged
merged 23 commits into from
Apr 9, 2024
Merged

Backports release 1.11 #53790

merged 23 commits into from
Apr 9, 2024

Commits on Mar 20, 2024

  1. Add an IndexStyle example to the diagind docstring (#53757)

    Also, simplifies the docstring by splitting the usage into two lines.
    
    (cherry picked from commit 0b1587c)
    jishnub authored and KristofferC committed Mar 20, 2024
    Configuration menu
    Copy the full SHA
    9b14cc4 View commit details
    Browse the repository at this point in the history
  2. remove dllexport jl_arraylen which no longer exists (#53765)

    (cherry picked from commit 1d532f4)
    fatteneder authored and KristofferC committed Mar 20, 2024
    Configuration menu
    Copy the full SHA
    005ac6d View commit details
    Browse the repository at this point in the history
  3. Remove some duplicates from emitted compilation traces for Julia 1.10 (

    …#53776)
    
    When multiple threads concurrently attempt to compile the same method,
    `--trace-compile` could emit duplicate `precompile` statements. This
    small tweak eliminates one source of these duplicates.
    
    Backported to 1.10 from #53774.
    
    (cherry picked from commit f6a3c5f)
    kpamnany authored and KristofferC committed Mar 20, 2024
    Configuration menu
    Copy the full SHA
    a579dab View commit details
    Browse the repository at this point in the history

Commits on Mar 27, 2024

  1. Add missing GC_POP() in emit_cfunction (#53809)

    ~~Apparently somewhere in codegen inside `emit_codeinst`some piece of
    code is relying on the implicit try catch gcstack restoring. I haven't
    got the analyzer working on that file yet (it has hundreds of issues and
    it doesn't like C++ code that much + the file is tens of thousands of
    lines after includes so it struggles).~~
    
    This fixes the compileall segfault in apple-aarch64 ci.
    #53811
    
    (cherry picked from commit 52fc796)
    gbaraldi authored and KristofferC committed Mar 27, 2024
    Configuration menu
    Copy the full SHA
    0a7a95c View commit details
    Browse the repository at this point in the history
  2. also check that UUID of project is non-null when treating it as a pac…

    …kage (#53789)
    
    Fixes #53788
    
    (cherry picked from commit 3e37e17)
    KristofferC authored and KristofferC committed Mar 27, 2024
    Configuration menu
    Copy the full SHA
    6f6cae8 View commit details
    Browse the repository at this point in the history
  3. precompilepkgs: simplify custom config printing if only one (#53805)

    Currently it's a bit excessive in the `Pkg.test` precompile job
    
    ![Screenshot 2024-03-20 at 12 04
    03 PM](https://github.com/JuliaLang/julia/assets/1694067/7600f0b8-6e4b-43b2-9c42-c8d5d16b8d57)
    
    This PR
    ```
    Precompiling project for configuration --code-coverage=none --color=yes --check-bounds=yes --warn-overwrite=yes --depwarn=yes --inline=yes --startup-file=no --track-allocation=none...
        354.9 ms  ✓ RFFT
      1 dependency successfully precompiled in 1 seconds. 38 already precompiled.
    ```
    
    Pkg could also just set the non-default flags to minimize the list.
    
    (cherry picked from commit 9291845)
    IanButterworth authored and KristofferC committed Mar 27, 2024
    Configuration menu
    Copy the full SHA
    a414011 View commit details
    Browse the repository at this point in the history
  4. Bump libuv (#53822)

    Fixes JuliaDebug/Cthulhu.jl#541 by picking up
    libuv/libuv@3ecce91.
    
    (cherry picked from commit 5ed51d3)
    Keno authored and KristofferC committed Mar 27, 2024
    Configuration menu
    Copy the full SHA
    ce13c35 View commit details
    Browse the repository at this point in the history
  5. update MPFR to 4.2.1 (#53837)

    MPFR 4.2.1 was released on 22 August 2023.
    It contains bugfixes.
    
    (cherry picked from commit 61caaa8)
    fxcoudert authored and KristofferC committed Mar 27, 2024
    Configuration menu
    Copy the full SHA
    3cc6c5c View commit details
    Browse the repository at this point in the history
  6. precompilepkgs: fix error reporting (#53862)

    (cherry picked from commit fc2d3af)
    IanButterworth authored and KristofferC committed Mar 27, 2024
    Configuration menu
    Copy the full SHA
    08c4987 View commit details
    Browse the repository at this point in the history
  7. Add _unsetindex! methods for SubArrays and CartesianIndexes (#5…

    …3383)
    
    With this, the following (and equivalent calls) work:
    ```julia
    julia> copyto!(view(zeros(BigInt, 2), 1:2), Vector{BigInt}(undef,2))
    2-element view(::Vector{BigInt}, 1:2) with eltype BigInt:
     #undef
     #undef
    
    julia> copyto!(view(zeros(BigInt, 2), 1:2), view(Vector{BigInt}(undef,2), 1:2))
    2-element view(::Vector{BigInt}, 1:2) with eltype BigInt:
     #undef
     #undef
    ```
    
    Close #53098. With this, all
    the `_unsetindex!` branches in `copyto_unaliased!` work for
    `Array`-views, and this makes certain indexing operations vectorize and
    speed-up:
    ```julia
    julia> using BenchmarkTools
    
    julia> a = view(rand(100,100), 1:100, 1:100); b = view(similar(a), axes(a)...);
    
    julia> @Btime copyto!($b, $a);
      16.427 μs (0 allocations: 0 bytes) # master
      2.308 μs (0 allocations: 0 bytes) # PR
    ```
    
    Improves (but doesn't resolve)
    #40962 and
    #53158
    
    ```julia
    julia> a = rand(40,40); b = rand(40,40);
    
    julia> @Btime $a[1:end,1:end] .= $b;
      5.383 μs (0 allocations: 0 bytes) # v"1.12.0-DEV.16"
      3.194 μs (0 allocations: 0 bytes) # PR
    ```
    ƒ
    Co-authored-by: Jameson Nash <[email protected]>
    
    (cherry picked from commit 1a90409)
    jishnub authored and KristofferC committed Mar 27, 2024
    Configuration menu
    Copy the full SHA
    121226b View commit details
    Browse the repository at this point in the history
  8. Fix boundscheck in unsetindex for SubArrays (#53475)

    These had been copy-pasted incorrectly, and should throw an error if the
    indices are out of bounds.
    
    (cherry picked from commit 98b3f72)
    jishnub authored and KristofferC committed Mar 27, 2024
    Configuration menu
    Copy the full SHA
    cd297c7 View commit details
    Browse the repository at this point in the history
  9. add invokelatest to on_done callback in bracketed paste (#53696)

    fixes #52120
    
    (cherry picked from commit bb3b09d)
    JeffBezanson authored and KristofferC committed Mar 27, 2024
    Configuration menu
    Copy the full SHA
    c356e60 View commit details
    Browse the repository at this point in the history

Commits on Apr 8, 2024

  1. fix typos in codegen.cpp (#53888)

    Not sure why this typo didn't mess up the CI, but it looks like a clear
    problem, let's correct it. I'd appreciate any idea on how to exercise
    this change.
    
    - fixes JuliaDebug/JuliaInterpreter.jl#621
    aviatesk committed Apr 8, 2024
    Configuration menu
    Copy the full SHA
    6c6097c View commit details
    Browse the repository at this point in the history

Commits on Apr 9, 2024

  1. Revert change to checksum for llvm-julia (#53870)

    Should fix #53399. I think this is the correct fix.
    Makes it so you can build Julia with `USE_BINARYBUILDER=0`.
    
    (cherry picked from commit b2e8eb2)
    Zentrik authored and KristofferC committed Apr 9, 2024
    Configuration menu
    Copy the full SHA
    6f8e78d View commit details
    Browse the repository at this point in the history
  2. Add Base.isrelocatable(pkg) (#53906)

    This PR adds a utility function `isrelocatable(pkg)` that can be used to
    check if `pkg` is already precompiled and if the associated cachefile is
    relocatable.
    
    The reason to implicitly perform the `isprecompiled` check is that the
    exact same computation needs to be done to find the right `.ji`.
    
    A `pkg` is said to be relocatable if
    1. all `include()` paths are relocatable (they start with `@depot`),
    2. all `include_dependency()` paths are relocatable (they start with
    `@depot` and `track_content=true` was used to include them).
    
    (cherry picked from commit e9d25ca)
    fatteneder authored and KristofferC committed Apr 9, 2024
    Configuration menu
    Copy the full SHA
    9afd069 View commit details
    Browse the repository at this point in the history
  3. Profile: make heap snapshots viewable in vscode viewer (#53833)

    (cherry picked from commit 57bbff6)
    IanButterworth authored and KristofferC committed Apr 9, 2024
    Configuration menu
    Copy the full SHA
    bfac67b View commit details
    Browse the repository at this point in the history
  4. LazyString in LinearAlgebra.checksquare error message (#53961)

    This reduces dynamic dispatch and makes JET happier.
    Testing on v1.11:
    ```julia
    julia> import LinearAlgebra: checksquare
    
    julia> using JET
    
    julia> @report_opt checksquare(rand(2,2), rand(2,2))
    ═════ 4 possible errors found ═════
    ┌ checksquare(::Matrix{Float64}, ::Matrix{Float64}) @ LinearAlgebra /cache/build/builder-amdci4-1/julialang/julia-release-1-dot-11/usr/share/julia/stdlib/v1.11/LinearAlgebra/src/LinearAlgebra.jl:307
    │┌ string(::String, ::Tuple{Int64, Int64}) @ Base ./strings/io.jl:189
    ││┌ print_to_string(::String, ::Tuple{Int64, Int64}) @ Base ./strings/io.jl:150
    │││┌ _unsafe_take!(io::IOBuffer) @ Base ./iobuffer.jl:494
    ││││┌ wrap(::Type{Array}, m::MemoryRef{UInt8}, l::Int64) @ Base ./array.jl:3101
    │││││ failed to optimize due to recursion: wrap(::Type{Array}, ::MemoryRef{UInt8}, ::Int64)
    ││││└────────────────────
    │││┌ print_to_string(::String, ::Vararg{Any}) @ Base ./strings/io.jl:143
    ││││ runtime dispatch detected: Base._str_sizehint(%17::Any)::Int64
    │││└────────────────────
    │││┌ print_to_string(::String, ::Vararg{Any}) @ Base ./strings/io.jl:148
    ││││ runtime dispatch detected: print(%59::IOBuffer, %97::Any)::Any
    │││└────────────────────
    │││┌ string(::String, ::Int64, ::String, ::Tuple{Int64}, ::String, ::Int64, ::String, ::Int64, ::String) @ Base ./strings/io.jl:189
    ││││ failed to optimize due to recursion: string(::String, ::Int64, ::String, ::Tuple{Int64}, ::String, ::Int64, ::String, ::Int64, ::String)
    │││└────────────────────
    
    julia> function checksquare(A...) # This PR
                      sizes = Int[]
                      for a in A
                          size(a,1)==size(a,2) || throw(DimensionMismatch(lazy"matrix is not square: dimensions are $(size(a))"))
                          push!(sizes, size(a,1))
                      end
                      return sizes
                  end
    checksquare (generic function with 2 methods)
    
    julia> @report_opt checksquare(rand(2,2), rand(2,2))
    No errors detected
    
    ```
    
    (cherry picked from commit d505c8c)
    jishnub authored and KristofferC committed Apr 9, 2024
    Configuration menu
    Copy the full SHA
    ec16401 View commit details
    Browse the repository at this point in the history
  5. Use StringMemory instead of StringVector where possible (#53962)

    On `1.11.0-alpha2`
    Old:
    ```julia
    @benchmark Base.dec($0x1, $0, $false)
    BenchmarkTools.Trial: 10000 samples with 994 evaluations.
     Range (min … max):  33.702 ns …   4.242 μs  ┊ GC (min … max):  0.00% … 97.61%
     Time  (median):     37.626 ns               ┊ GC (median):     0.00%
     Time  (mean ± σ):   45.787 ns ± 147.794 ns  ┊ GC (mean ± σ):  14.53% ±  4.47%
    
        ▄▅▆▇█▇▇▅▃▃▂▂▂▁    ▁▂▁▁▁             ▁▁   ▁                 ▂
      ▄▇███████████████▇▇██████▇█▆▆▄▄▃▄▅▄▆▇████████▆▅▅▇▆▅▆▄▄▅▄▄▄▁▅ █
      33.7 ns       Histogram: log(frequency) by time      67.5 ns <
    
     Memory estimate: 88 bytes, allocs estimate: 3.
    ```
    New:
    ```julia
    BenchmarkTools.Trial: 10000 samples with 995 evaluations.
     Range (min … max):  27.538 ns …   3.397 μs  ┊ GC (min … max):  0.00% … 97.86%
     Time  (median):     30.151 ns               ┊ GC (median):     0.00%
     Time  (mean ± σ):   34.547 ns ± 105.101 ns  ┊ GC (mean ± σ):  10.37% ±  3.39%
    
           ▁ █▆▃  ▁
      ▂▂▃▃▅█████▆████▆▄▄▃▃▃▃▃▃▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▁▂▂▂▂▂▁▂▂▂▂▂▂▂▂▂▂▂▂▂ ▃
      27.5 ns         Histogram: frequency by time         43.8 ns <
    
     Memory estimate: 56 bytes, allocs estimate: 2.
    ```
    
    Fixes #53950, actually now even faster than `1.10.2`.
    
    It doesn't look like the length is ever changed and we don't return
    these `StringMemory`s so this change should be fine.
    
    (cherry picked from commit 0e59c9e)
    Zentrik authored and KristofferC committed Apr 9, 2024
    Configuration menu
    Copy the full SHA
    df60193 View commit details
    Browse the repository at this point in the history
  6. profile: doc: update the Allocs.@profile doc string (#53825)

    (cherry picked from commit d963a34)
    nsajko authored and KristofferC committed Apr 9, 2024
    Configuration menu
    Copy the full SHA
    25c1c87 View commit details
    Browse the repository at this point in the history
  7. LazyString in DimensionMismatch error messages in broadcasting (#…

    …53975)
    
    This reduces dynamic dispatch, and makes JET happier. Something similar
    is already used in line 523.
    
    (cherry picked from commit f7c7410)
    jishnub authored and KristofferC committed Apr 9, 2024
    Configuration menu
    Copy the full SHA
    b0d7ee4 View commit details
    Browse the repository at this point in the history
  8. Avoid repeated precompilation when loading from non-relocatable cache…

    …files (#53905)
    
    Fixes
    #53859 (comment),
    which was actually fixed before in
    #52346, but
    #52750 undid that fix.
    
    This PR does not directly address #53859, because I can not reproduce it
    atm.
    
    ---
    
    The `@depot` resolution logic for `include()` files is adjusted as
    follows:
    
    1. (new behavior) If the cache is not relocatable because of an absolute
    path, we ignore that path for the depot search. Recompilation will be
    triggered by `stale_cachefile()` if that absolute path does not exist.
    Previously this caused any `@depot` tags to be not resolved and so
    trigger recompilation.
    2. (new behavior) If we can't find a depot for a relocatable path, we
    still replace it with the depot we found from other files. Recompilation
    will be triggered by `stale_cachefile()` because the resolved path does
    not exist.
    3. (this behavior is kept) We require that relocatable paths all resolve
    to the same depot.
    4. (new behavior) We no longer use the first matching depot for
    replacement, but instead we explicitly check that all resolve to the
    same depot. This has two reasons:
    - We want to scan all source files anyways in order to provide logs for
    1. and 2. above, so the check is free.
    - It is possible that a depot might be missing source files. Assume that
    we have two depots on `DEPOT_PATH`, `depot_complete` and
    `depot_incomplete`.
    If `DEPOT_PATH=["depot_complete","depot_incomplete"]` then no
    recompilation shall happen, because `depot_complete` will be picked.
    If `DEPOT_PATH=["depot_incomplete","depot_complete"]` we trigger
    recompilation and hopefully a meaningful error about missing files is
    thrown. If we were to just select the first depot we find, then whether
    recompilation happens would depend on whether the first relocatable file
    resolves to `depot_complete` or `depot_incomplete`.
    
    (cherry picked from commit d8d3842)
    fatteneder authored and KristofferC committed Apr 9, 2024
    Configuration menu
    Copy the full SHA
    967e2f0 View commit details
    Browse the repository at this point in the history
  9. Make reshape and view on Memory produce Arrays and delete wrap (#53896)

    - Make reshape and view with one based indexing on Memory produce Arrays
    - delete wrap
    
    Implements
    #53552 (comment)
    
    ---------
    
    Co-authored-by: Jameson Nash <[email protected]>
    (cherry picked from commit 273d91e)
    LilithHafner authored and KristofferC committed Apr 9, 2024
    Configuration menu
    Copy the full SHA
    146a7db View commit details
    Browse the repository at this point in the history
  10. Test and fix non-int-length bug in `view(::Memory, ::Union{UnitRange,…

    … Base.OneTo})` (#53991)
    
    We assumed, falsely, that `length(inds) isa Int`. The length must be
    convertible to an `Int` or we throw, but that conversion may need to be
    explicitly performed.
    
    Fixes #53990
    
    CC @oscardssmith @vtjnash @odow
    
    (cherry picked from commit e4f2124)
    LilithHafner authored and KristofferC committed Apr 9, 2024
    Configuration menu
    Copy the full SHA
    eb96c07 View commit details
    Browse the repository at this point in the history