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

release-1.8: Backports for 1.8-rc4 #46075

Merged
merged 45 commits into from
Aug 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
08f12b9
fix convert call in Artifacts.jl (#46040)
KristofferC Jul 14, 2022
78ad6ff
Allow `BUILDKITE_BRANCH` to provide branch name (#46053)
staticfloat Jul 15, 2022
7674873
fixup time_imports news entry
IanButterworth Jul 16, 2022
c8c6cc7
[LibCURL_jll] Update to v7.84 (#45967)
giordano Jul 12, 2022
3dc152b
fix Libc.rand and seed problems (#44432)
vtjnash Apr 7, 2022
6a05297
give finalizers their own RNG state (#45212)
JeffBezanson Jul 14, 2022
6ba1d23
Update LLVM to include additional patches. (#46091)
maleadt Jul 19, 2022
2bb4aec
Unset NDEBUG in analyzers
haampie Jun 9, 2022
dcd915b
Don't segfault when running atexit before jl_threads_init
vchuravy Jun 20, 2022
47cd899
Explicitly test for a failing exit code, do not include signals
staticfloat Jun 20, 2022
9bb9625
Don't call `jl_errorf()` when we're early in bringup
staticfloat Jun 25, 2022
6d7539b
more friendly/useful error for stack overflow in type inference (#44971)
JeffBezanson Apr 15, 2022
d6e8e5d
mark two_mul as consistent (#46022)
oscardssmith Jul 15, 2022
ef18da7
Export jl_is_foreign_type
Jul 20, 2022
54a6806
[nghttp2_jll] Upgrade to v1.48.0 (#45980)
giordano Jul 17, 2022
9fa6b7f
fix #45825, BitArray methods assuming 1-indexing of AbstractArray (#4…
JeffBezanson Jul 18, 2022
bcac3c2
remove examples of time_imports nesting given it was a bug (#46072)
IanButterworth Jul 17, 2022
169567d
Fix fast path for `strides(::ReinterpretArray)` with dense parent. (#…
N5N3 Jul 20, 2022
bfc7e3e
bump Pkg version to latest 1.8
Jul 20, 2022
1549064
Specialize tuple setindex to avoid ntuple-related performance regress…
maleadt Jul 20, 2022
f3bc6bf
Use `max(1, Sys.CPU_THREADS)` BLAS threads for apple `aarch64`. (#46085)
chriselrod Jul 20, 2022
a382f32
Make gcd/lcm effect-free by using LazyString (#44935)
tkf Apr 12, 2022
8dc9f58
Fix return_type model when run in toplevel context (#44670)
Keno Mar 19, 2022
1110f2b
Merge pull request #45299 from JuliaLang/kf/rt_effect_free
Keno May 16, 2022
55eb09d
Merge pull request #45613 from JuliaLang/avi/concretemath
aviatesk Jun 11, 2022
1835d8f
test: allow new concrete-foldability tests to fail (#45670)
aviatesk Jun 15, 2022
2daf1fd
compiler: move effects-related test cases into dedicated file (#45992)
aviatesk Jul 12, 2022
1390613
Merge pull request #45993 from JuliaLang/avi/recursion-effects
aviatesk Jul 12, 2022
1645d1d
Merge pull request #46111 from JuliaLang/avi/correct-consistent
aviatesk Jul 25, 2022
a1937ab
effects: improve tri-state printing
aviatesk Jun 20, 2022
431a5e5
manual fixes, `@invoke` isn't exported on 1.8
aviatesk Jul 25, 2022
9b38226
inference: fix #46207, make sure we never form nested `Conditional` (…
aviatesk Jul 29, 2022
c02b4e1
Fix timev compilation time tracking and add tests (#46100)
IanButterworth Jul 20, 2022
20ef7d9
update Pkg branch & commit
IanButterworth Aug 1, 2022
a9bf474
Prefix Float16 intrinsics
vtjnash Jun 11, 2022
71d062c
Define aliases to FP16 crt in the OJIT
vchuravy Jun 11, 2022
7ff795c
Emit aliases into the system image
vchuravy Jun 12, 2022
4983135
Merge pull request #46110 from JuliaLang/vc/fp16_bb
vchuravy Aug 2, 2022
4b5ea08
improve `cat` inferrability (#45028)
aviatesk Apr 25, 2022
5cd8444
`copyto!` fix for `BitArray`/`AbstractArray`, fixes #25968 (#46161)
N5N3 Jul 25, 2022
2415a14
dump: ensure we generate the whole backedge graph (#46171)
vtjnash Jul 30, 2022
4fa7980
Fix rem2pi for NaN inputs, fixes #32888. (#36420)
mgautam98 Jul 24, 2022
87d89f7
fix rem2pi for non-finite arguments (#46163)
oscardssmith Jul 25, 2022
3e4646d
[LinearAlgebra] Support more env variables to set OpenBLAS threads (#…
giordano Jul 21, 2022
50bbad7
Lazily initialize Profile buffer (#46239)
IanButterworth Aug 6, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ New library features
* `extrema` now accepts an `init` keyword argument ([#36265], [#43604]).
* `Iterators.countfrom` now accepts any type that defines `+` ([#37747]).
* `@time` now separates out % time spent recompiling invalidated methods ([#45015]).
* `@time_imports` now shows any compilation and recompilation time percentages per import ([#45064]).

Standard library changes
------------------------
Expand Down Expand Up @@ -147,7 +146,8 @@ Standard library changes

#### InteractiveUtils

* New macro `@time_imports` for reporting any time spent importing packages and their dependencies ([#41612]).
* New macro `@time_imports` for reporting any time spent importing packages and their dependencies, highlighting
compilation and recompilation time as percentages per import ([#41612],[#45064]).

#### LinearAlgebra

Expand Down
5 changes: 0 additions & 5 deletions base/Base.jl
Original file line number Diff line number Diff line change
Expand Up @@ -292,9 +292,6 @@ include("process.jl")
include("ttyhascolor.jl")
include("secretbuffer.jl")

# RandomDevice support
include("randomdevice.jl")

# core math functions
include("floatfuncs.jl")
include("math.jl")
Expand Down Expand Up @@ -484,8 +481,6 @@ end

if is_primary_base_module
function __init__()
# for the few uses of Libc.rand in Base:
Libc.srand()
# Base library init
reinit_stdio()
Multimedia.reinit_displays() # since Multimedia.displays uses stdout as fallback
Expand Down
58 changes: 30 additions & 28 deletions base/abstractarray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -879,13 +879,12 @@ See also [`copyto!`](@ref).
is available from the `Future` standard library as `Future.copy!`.
"""
function copy!(dst::AbstractVector, src::AbstractVector)
firstindex(dst) == firstindex(src) || throw(ArgumentError(
"vectors must have the same offset for copy! (consider using `copyto!`)"))
if length(dst) != length(src)
resize!(dst, length(src))
end
for i in eachindex(dst, src)
@inbounds dst[i] = src[i]
end
dst
copyto!(dst, src)
end

function copy!(dst::AbstractArray, src::AbstractArray)
Expand Down Expand Up @@ -1011,6 +1010,10 @@ julia> y
"""
function copyto!(dest::AbstractArray, src::AbstractArray)
isempty(src) && return dest
if dest isa BitArray
# avoid ambiguities with other copyto!(::AbstractArray, ::SourceArray) methods
return _copyto_bitarray!(dest, src)
end
src′ = unalias(dest, src)
copyto_unaliased!(IndexStyle(dest), dest, IndexStyle(src′), src′)
end
Expand Down Expand Up @@ -1080,8 +1083,9 @@ function copyto!(dest::AbstractArray, dstart::Integer,
destinds, srcinds = LinearIndices(dest), LinearIndices(src)
(checkbounds(Bool, destinds, dstart) && checkbounds(Bool, destinds, dstart+n-1)) || throw(BoundsError(dest, dstart:dstart+n-1))
(checkbounds(Bool, srcinds, sstart) && checkbounds(Bool, srcinds, sstart+n-1)) || throw(BoundsError(src, sstart:sstart+n-1))
@inbounds for i = 0:(n-1)
dest[dstart+i] = src[sstart+i]
src′ = unalias(dest, src)
@inbounds for i = 0:n-1
dest[dstart+i] = src′[sstart+i]
end
return dest
end
Expand All @@ -1103,22 +1107,23 @@ function copyto!(B::AbstractVecOrMat{R}, ir_dest::AbstractRange{Int}, jr_dest::A
end
@boundscheck checkbounds(B, ir_dest, jr_dest)
@boundscheck checkbounds(A, ir_src, jr_src)
A′ = unalias(B, A)
jdest = first(jr_dest)
for jsrc in jr_src
idest = first(ir_dest)
for isrc in ir_src
@inbounds B[idest,jdest] = A[isrc,jsrc]
@inbounds B[idest,jdest] = A[isrc,jsrc]
idest += step(ir_dest)
end
jdest += step(jr_dest)
end
return B
end

function copyto_axcheck!(dest, src)
@noinline checkaxs(axd, axs) = axd == axs || throw(DimensionMismatch("axes must agree, got $axd and $axs"))
@noinline _checkaxs(axd, axs) = axd == axs || throw(DimensionMismatch("axes must agree, got $axd and $axs"))

checkaxs(axes(dest), axes(src))
function copyto_axcheck!(dest, src)
_checkaxs(axes(dest), axes(src))
copyto!(dest, src)
end

Expand Down Expand Up @@ -1712,23 +1717,16 @@ end
_cs(d, a, b) = (a == b ? a : throw(DimensionMismatch(
"mismatch in dimension $d (expected $a got $b)")))

function dims2cat(::Val{dims}) where dims
if any(≤(0), dims)
throw(ArgumentError("All cat dimensions must be positive integers, but got $dims"))
end
ntuple(in(dims), maximum(dims))
end

dims2cat(::Val{dims}) where dims = dims2cat(dims)
function dims2cat(dims)
if any(≤(0), dims)
throw(ArgumentError("All cat dimensions must be positive integers, but got $dims"))
end
ntuple(in(dims), maximum(dims))
end

_cat(dims, X...) = cat_t(promote_eltypeof(X...), X...; dims=dims)
_cat(dims, X...) = _cat_t(dims, promote_eltypeof(X...), X...)

@inline cat_t(::Type{T}, X...; dims) where {T} = _cat_t(dims, T, X...)
@inline function _cat_t(dims, ::Type{T}, X...) where {T}
catdims = dims2cat(dims)
shape = cat_size_shape(catdims, X...)
Expand All @@ -1738,6 +1736,9 @@ _cat(dims, X...) = cat_t(promote_eltypeof(X...), X...; dims=dims)
end
return __cat(A, shape, catdims, X...)
end
# this version of `cat_t` is not very kind for inference and so its usage should be avoided,
# nevertheless it is here just for compat after https://github.com/JuliaLang/julia/pull/45028
@inline cat_t(::Type{T}, X...; dims) where {T} = _cat_t(dims, T, X...)

# Why isn't this called `__cat!`?
__cat(A, shape, catdims, X...) = __cat_offset!(A, shape, catdims, ntuple(zero, length(shape)), X...)
Expand Down Expand Up @@ -1876,8 +1877,8 @@ julia> reduce(hcat, vs)
"""
hcat(X...) = cat(X...; dims=Val(2))

typed_vcat(::Type{T}, X...) where T = cat_t(T, X...; dims=Val(1))
typed_hcat(::Type{T}, X...) where T = cat_t(T, X...; dims=Val(2))
typed_vcat(::Type{T}, X...) where T = _cat_t(Val(1), T, X...)
typed_hcat(::Type{T}, X...) where T = _cat_t(Val(2), T, X...)

"""
cat(A...; dims)
Expand Down Expand Up @@ -1913,7 +1914,8 @@ julia> cat(true, trues(2,2), trues(4)', dims=(1,2))
```
"""
@inline cat(A...; dims) = _cat(dims, A...)
_cat(catdims, A::AbstractArray{T}...) where {T} = cat_t(T, A...; dims=catdims)
# `@constprop :aggressive` allows `catdims` to be propagated as constant improving return type inference
@constprop :aggressive _cat(catdims, A::AbstractArray{T}...) where {T} = _cat_t(catdims, T, A...)

# The specializations for 1 and 2 inputs are important
# especially when running with --inline=no, see #11158
Expand All @@ -1924,12 +1926,12 @@ hcat(A::AbstractArray) = cat(A; dims=Val(2))
hcat(A::AbstractArray, B::AbstractArray) = cat(A, B; dims=Val(2))
hcat(A::AbstractArray...) = cat(A...; dims=Val(2))

typed_vcat(T::Type, A::AbstractArray) = cat_t(T, A; dims=Val(1))
typed_vcat(T::Type, A::AbstractArray, B::AbstractArray) = cat_t(T, A, B; dims=Val(1))
typed_vcat(T::Type, A::AbstractArray...) = cat_t(T, A...; dims=Val(1))
typed_hcat(T::Type, A::AbstractArray) = cat_t(T, A; dims=Val(2))
typed_hcat(T::Type, A::AbstractArray, B::AbstractArray) = cat_t(T, A, B; dims=Val(2))
typed_hcat(T::Type, A::AbstractArray...) = cat_t(T, A...; dims=Val(2))
typed_vcat(T::Type, A::AbstractArray) = _cat_t(Val(1), T, A)
typed_vcat(T::Type, A::AbstractArray, B::AbstractArray) = _cat_t(Val(1), T, A, B)
typed_vcat(T::Type, A::AbstractArray...) = _cat_t(Val(1), T, A...)
typed_hcat(T::Type, A::AbstractArray) = _cat_t(Val(2), T, A)
typed_hcat(T::Type, A::AbstractArray, B::AbstractArray) = _cat_t(Val(2), T, A, B)
typed_hcat(T::Type, A::AbstractArray...) = _cat_t(Val(2), T, A...)

# 2d horizontal and vertical concatenation

Expand Down
58 changes: 31 additions & 27 deletions base/bitarray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -458,10 +458,11 @@ function unsafe_copyto!(dest::BitArray, doffs::Integer, src::Union{BitArray,Arra
return dest
end

copyto!(dest::BitArray, doffs::Integer, src::Array, soffs::Integer, n::Integer) =
copyto!(dest::BitArray, doffs::Integer, src::Union{BitArray,Array}, soffs::Integer, n::Integer) =
_copyto_int!(dest, Int(doffs), src, Int(soffs), Int(n))
function _copyto_int!(dest::BitArray, doffs::Int, src::Array, soffs::Int, n::Int)
function _copyto_int!(dest::BitArray, doffs::Int, src::Union{BitArray,Array}, soffs::Int, n::Int)
n == 0 && return dest
n < 0 && throw(ArgumentError("Number of elements to copy must be nonnegative."))
soffs < 1 && throw(BoundsError(src, soffs))
doffs < 1 && throw(BoundsError(dest, doffs))
soffs+n-1 > length(src) && throw(BoundsError(src, length(src)+1))
Expand Down Expand Up @@ -501,40 +502,42 @@ function Array{T,N}(B::BitArray{N}) where {T,N}
end

BitArray(A::AbstractArray{<:Any,N}) where {N} = BitArray{N}(A)

function BitArray{N}(A::AbstractArray{T,N}) where N where T
B = BitArray(undef, convert(Dims{N}, size(A)::Dims{N}))
Bc = B.chunks
l = length(B)
_checkaxs(axes(B), axes(A))
_copyto_bitarray!(B, A)
return B::BitArray{N}
end

function _copyto_bitarray!(B::BitArray, A::AbstractArray)
l = length(A)
l == 0 && return B
ind = 1
l > length(B) && throw(BoundsError(B, length(B)+1))
Bc = B.chunks
nc = num_bit_chunks(l)
Ai = first(eachindex(A))
@inbounds begin
for i = 1:length(Bc)-1
for i = 1:nc-1
c = UInt64(0)
for j = 0:63
c |= (UInt64(convert(Bool, A[ind])::Bool) << j)
ind += 1
c |= (UInt64(convert(Bool, A[Ai])::Bool) << j)
Ai = nextind(A, Ai)
end
Bc[i] = c
end
c = UInt64(0)
for j = 0:_mod64(l-1)
c |= (UInt64(convert(Bool, A[ind])::Bool) << j)
ind += 1
tail = _mod64(l - 1) + 1
for j = 0:tail-1
c |= (UInt64(convert(Bool, A[Ai])::Bool) << j)
Ai = nextind(A, Ai)
end
Bc[end] = c
msk = _msk_end(tail)
Bc[nc] = (c & msk) | (Bc[nc] & ~msk)
end
return B
end

function BitArray{N}(A::Array{Bool,N}) where N
B = BitArray(undef, size(A))
Bc = B.chunks
l = length(B)
l == 0 && return B
copy_to_bitarray_chunks!(Bc, 1, A, 1, l)
return B::BitArray{N}
end

reinterpret(::Type{Bool}, B::BitArray, dims::NTuple{N,Int}) where {N} = reinterpret(B, dims)
reinterpret(B::BitArray, dims::NTuple{N,Int}) where {N} = reshape(B, dims)

Expand Down Expand Up @@ -721,24 +724,25 @@ function _unsafe_setindex!(B::BitArray, X::AbstractArray, I::BitArray)
lx = length(X)
last_chunk_len = _mod64(length(B)-1)+1

c = 1
Xi = first(eachindex(X))
lastXi = last(eachindex(X))
for i = 1:lc
@inbounds Imsk = Ic[i]
@inbounds C = Bc[i]
u = UInt64(1)
for j = 1:(i < lc ? 64 : last_chunk_len)
if Imsk & u != 0
lx < c && throw_setindex_mismatch(X, c)
@inbounds x = convert(Bool, X[c])
Xi > lastXi && throw_setindex_mismatch(X, count(I))
@inbounds x = convert(Bool, X[Xi])
C = ifelse(x, C | u, C & ~u)
c += 1
Xi = nextind(X, Xi)
end
u <<= 1
end
@inbounds Bc[i] = C
end
if length(X) != c-1
throw_setindex_mismatch(X, c-1)
if Xi != nextind(X, lastXi)
throw_setindex_mismatch(X, count(I))
end
return B
end
Expand Down
9 changes: 5 additions & 4 deletions base/checked.jl
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,10 @@ function checked_abs end

function checked_abs(x::SignedInt)
r = ifelse(x<0, -x, x)
r<0 && throw(OverflowError(string("checked arithmetic: cannot compute |x| for x = ", x, "::", typeof(x))))
r
end
r<0 || return r
msg = LazyString("checked arithmetic: cannot compute |x| for x = ", x, "::", typeof(x))
throw(OverflowError(msg))
end
checked_abs(x::UnsignedInt) = x
checked_abs(x::Bool) = x

Expand Down Expand Up @@ -151,7 +152,7 @@ end


throw_overflowerr_binaryop(op, x, y) = (@noinline;
throw(OverflowError(Base.invokelatest(string, x, " ", op, " ", y, " overflowed for type ", typeof(x)))))
throw(OverflowError(LazyString(x, " ", op, " ", y, " overflowed for type ", typeof(x)))))

"""
Base.checked_add(x, y)
Expand Down
Loading