Skip to content

Commit 18b6944

Browse files
committed
Remove inline annations from broadcast kernels
1 parent 1c16afd commit 18b6944

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

base/broadcast.jl

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -759,8 +759,8 @@ julia> string.(("one","two","three","four"), ": ", 1:4)
759759
broadcast(f::Tf, As...) where {Tf} = materialize(broadcasted(f, As...))
760760

761761
# special cases defined for performance
762-
@inline broadcast(f, x::Number...) = f(x...)
763-
@inline broadcast(f, t::NTuple{N,Any}, ts::Vararg{NTuple{N,Any}}) where {N} = map(f, t, ts...)
762+
broadcast(f, x::Number...) = f(x...)
763+
broadcast(f, t::NTuple{N,Any}, ts::Vararg{NTuple{N,Any}}) where {N} = map(f, t, ts...)
764764

765765
"""
766766
broadcast!(f, dest, As...)
@@ -818,23 +818,23 @@ end
818818
819819
Take a lazy `Broadcasted` object and compute the result
820820
"""
821-
@inline materialize(bc::Broadcasted) = copy(instantiate(bc))
821+
materialize(bc::Broadcasted) = copy(instantiate(bc))
822822
materialize(x) = x
823-
@inline function materialize!(dest, bc::Broadcasted{Style}) where {Style}
823+
function materialize!(dest, bc::Broadcasted{Style}) where {Style}
824824
return copyto!(dest, instantiate(Broadcasted{Style}(bc.f, bc.args, axes(dest))))
825825
end
826-
@inline function materialize!(dest, x)
826+
function materialize!(dest, x)
827827
return copyto!(dest, instantiate(Broadcasted(identity, (x,), axes(dest))))
828828
end
829829

830830
## general `copy` methods
831-
@inline copy(bc::Broadcasted{<:AbstractArrayStyle{0}}) = bc[CartesianIndex()]
831+
copy(bc::Broadcasted{<:AbstractArrayStyle{0}}) = bc[CartesianIndex()]
832832
copy(bc::Broadcasted{<:Union{Nothing,Unknown}}) =
833833
throw(ArgumentError("broadcasting requires an assigned BroadcastStyle"))
834834

835835
const NonleafHandlingStyles = Union{DefaultArrayStyle,ArrayConflict}
836836

837-
@inline function copy(bc::Broadcasted{Style}) where {Style}
837+
function copy(bc::Broadcasted{Style}) where {Style}
838838
ElType = combine_eltypes(bc.f, bc.args)
839839
if Base.isconcretetype(ElType)
840840
# We can trust it and defer to the simpler `copyto!`
@@ -862,10 +862,10 @@ end
862862
## general `copyto!` methods
863863
# The most general method falls back to a method that replaces Style->Nothing
864864
# This permits specialization on typeof(dest) without introducing ambiguities
865-
@inline copyto!(dest::AbstractArray, bc::Broadcasted) = copyto!(dest, convert(Broadcasted{Nothing}, bc))
865+
copyto!(dest::AbstractArray, bc::Broadcasted) = copyto!(dest, convert(Broadcasted{Nothing}, bc))
866866

867867
# Performance optimization for the common identity scalar case: dest .= val
868-
@inline function copyto!(dest::AbstractArray, bc::Broadcasted{<:AbstractArrayStyle{0}})
868+
function copyto!(dest::AbstractArray, bc::Broadcasted{<:AbstractArrayStyle{0}})
869869
# Typically, we must independently execute bc for every storage location in `dest`, but:
870870
# IF we're in the common no-op identity case with no nested args (like `dest .= val`),
871871
if bc.f === identity && bc.args isa Tuple{Any} && isflat(bc)
@@ -897,7 +897,7 @@ preprocess_args(dest, args::Tuple{Any}) = (preprocess(dest, args[1]),)
897897
preprocess_args(dest, args::Tuple{}) = ()
898898

899899
# Specialize this method if all you want to do is specialize on typeof(dest)
900-
@inline function copyto!(dest::AbstractArray, bc::Broadcasted{Nothing})
900+
function copyto!(dest::AbstractArray, bc::Broadcasted{Nothing})
901901
axes(dest) == axes(bc) || throwdm(axes(dest), axes(bc))
902902
# Performance optimization: broadcast!(identity, dest, A) is equivalent to copyto!(dest, A) if indices match
903903
if bc.f === identity && bc.args isa Tuple{AbstractArray} # only a single input argument to broadcast!
@@ -915,7 +915,7 @@ end
915915

916916
# Performance optimization: for BitArray outputs, we cache the result
917917
# in a "small" Vector{Bool}, and then copy in chunks into the output
918-
@inline function copyto!(dest::BitArray, bc::Broadcasted{Nothing})
918+
function copyto!(dest::BitArray, bc::Broadcasted{Nothing})
919919
axes(dest) == axes(bc) || throwdm(axes(dest), axes(bc))
920920
ischunkedbroadcast(dest, bc) && return chunkedcopyto!(dest, bc)
921921
length(dest) < 256 && return invoke(copyto!, Tuple{AbstractArray, Broadcasted{Nothing}}, dest, bc)
@@ -971,7 +971,7 @@ liftchunks(args::Tuple{<:Bool,Vararg{Any}}) = (ifelse(args[1], typemax(UInt64),
971971
ithchunk(i) = ()
972972
Base.@propagate_inbounds ithchunk(i, c::Vector{UInt64}, args...) = (c[i], ithchunk(i, args...)...)
973973
Base.@propagate_inbounds ithchunk(i, b::UInt64, args...) = (b, ithchunk(i, args...)...)
974-
@inline function chunkedcopyto!(dest::BitArray, bc::Broadcasted)
974+
function chunkedcopyto!(dest::BitArray, bc::Broadcasted)
975975
isempty(dest) && return dest
976976
f = flatten(liftfuncs(bc))
977977
args = liftchunks(f.args)
@@ -1018,7 +1018,7 @@ end
10181018

10191019
## Tuple methods
10201020

1021-
@inline function copy(bc::Broadcasted{Style{Tuple}})
1021+
function copy(bc::Broadcasted{Style{Tuple}})
10221022
dim = axes(bc)
10231023
length(dim) == 1 || throw(DimensionMismatch("tuple only supports one dimension"))
10241024
N = length(dim[1])
@@ -1102,15 +1102,15 @@ struct BitMaskedBitArray{N,M}
11021102
mask::BitArray{M}
11031103
BitMaskedBitArray{N,M}(parent, mask) where {N,M} = new(parent, mask)
11041104
end
1105-
@inline function BitMaskedBitArray(parent::BitArray{N}, mask::BitArray{M}) where {N,M}
1105+
function BitMaskedBitArray(parent::BitArray{N}, mask::BitArray{M}) where {N,M}
11061106
@boundscheck checkbounds(parent, mask)
11071107
BitMaskedBitArray{N,M}(parent, mask)
11081108
end
11091109
Base.@propagate_inbounds dotview(B::BitArray, i::BitArray) = BitMaskedBitArray(B, i)
11101110
Base.show(io::IO, B::BitMaskedBitArray) = foreach(arg->show(io, arg), (typeof(B), (B.parent, B.mask)))
11111111
# Override materialize! to prevent the BitMaskedBitArray from escaping to an overrideable method
1112-
@inline materialize!(B::BitMaskedBitArray, bc::Broadcasted{<:Any,<:Any,typeof(identity),Tuple{Bool}}) = fill!(B, bc.args[1])
1113-
@inline materialize!(B::BitMaskedBitArray, bc::Broadcasted{<:Any}) = materialize!(SubArray(B.parent, to_indices(B.parent, (B.mask,))), bc)
1112+
materialize!(B::BitMaskedBitArray, bc::Broadcasted{<:Any,<:Any,typeof(identity),Tuple{Bool}}) = fill!(B, bc.args[1])
1113+
materialize!(B::BitMaskedBitArray, bc::Broadcasted{<:Any}) = materialize!(SubArray(B.parent, to_indices(B.parent, (B.mask,))), bc)
11141114
function Base.fill!(B::BitMaskedBitArray, b::Bool)
11151115
Bc = B.parent.chunks
11161116
Ic = B.mask.chunks

0 commit comments

Comments
 (0)