Skip to content

Commit cf180f1

Browse files
committed
Remove inline annations from broadcast kernels
1 parent 527d6b6 commit cf180f1

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

base/broadcast.jl

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

822822
# special cases defined for performance
823-
@inline broadcast(f, x::Number...) = f(x...)
824-
@inline broadcast(f, t::NTuple{N,Any}, ts::Vararg{NTuple{N,Any}}) where {N} = map(f, t, ts...)
823+
broadcast(f, x::Number...) = f(x...)
824+
broadcast(f, t::NTuple{N,Any}, ts::Vararg{NTuple{N,Any}}) where {N} = map(f, t, ts...)
825825

826826
"""
827827
broadcast!(f, dest, As...)
@@ -879,28 +879,28 @@ end
879879
880880
Take a lazy `Broadcasted` object and compute the result
881881
"""
882-
@inline materialize(bc::Broadcasted) = copy(instantiate(bc))
882+
materialize(bc::Broadcasted) = copy(instantiate(bc))
883883
materialize(x) = x
884884

885-
@inline function materialize!(dest, x)
885+
function materialize!(dest, x)
886886
return materialize!(dest, instantiate(Broadcasted(identity, (x,), axes(dest))))
887887
end
888888

889-
@inline function materialize!(dest, bc::Broadcasted{Style}) where {Style}
889+
function materialize!(dest, bc::Broadcasted{Style}) where {Style}
890890
return materialize!(combine_styles(dest, bc), dest, bc)
891891
end
892-
@inline function materialize!(::BroadcastStyle, dest, bc::Broadcasted{Style}) where {Style}
892+
function materialize!(::BroadcastStyle, dest, bc::Broadcasted{Style}) where {Style}
893893
return copyto!(dest, instantiate(Broadcasted{Style}(bc.f, bc.args, axes(dest))))
894894
end
895895

896896
## general `copy` methods
897-
@inline copy(bc::Broadcasted{<:AbstractArrayStyle{0}}) = bc[CartesianIndex()]
897+
copy(bc::Broadcasted{<:AbstractArrayStyle{0}}) = bc[CartesianIndex()]
898898
copy(bc::Broadcasted{<:Union{Nothing,Unknown}}) =
899899
throw(ArgumentError("broadcasting requires an assigned BroadcastStyle"))
900900

901901
const NonleafHandlingStyles = Union{DefaultArrayStyle,ArrayConflict}
902902

903-
@inline function copy(bc::Broadcasted{Style}) where {Style}
903+
function copy(bc::Broadcasted{Style}) where {Style}
904904
ElType = combine_eltypes(bc.f, bc.args)
905905
if Base.isconcretetype(ElType)
906906
# We can trust it and defer to the simpler `copyto!`
@@ -932,10 +932,10 @@ end
932932
## general `copyto!` methods
933933
# The most general method falls back to a method that replaces Style->Nothing
934934
# This permits specialization on typeof(dest) without introducing ambiguities
935-
@inline copyto!(dest::AbstractArray, bc::Broadcasted) = copyto!(dest, convert(Broadcasted{Nothing}, bc))
935+
copyto!(dest::AbstractArray, bc::Broadcasted) = copyto!(dest, convert(Broadcasted{Nothing}, bc))
936936

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

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

988988
# Performance optimization: for BitArray outputs, we cache the result
989989
# in a "small" Vector{Bool}, and then copy in chunks into the output
990-
@inline function copyto!(dest::BitArray, bc::Broadcasted{Nothing})
990+
function copyto!(dest::BitArray, bc::Broadcasted{Nothing})
991991
axes(dest) == axes(bc) || throwdm(axes(dest), axes(bc))
992992
ischunkedbroadcast(dest, bc) && return chunkedcopyto!(dest, bc)
993993
length(dest) < 256 && return invoke(copyto!, Tuple{AbstractArray, Broadcasted{Nothing}}, dest, bc)
@@ -1043,7 +1043,7 @@ liftchunks(args::Tuple{<:Bool,Vararg{Any}}) = (ifelse(args[1], typemax(UInt64),
10431043
ithchunk(i) = ()
10441044
Base.@propagate_inbounds ithchunk(i, c::Vector{UInt64}, args...) = (c[i], ithchunk(i, args...)...)
10451045
Base.@propagate_inbounds ithchunk(i, b::UInt64, args...) = (b, ithchunk(i, args...)...)
1046-
@inline function chunkedcopyto!(dest::BitArray, bc::Broadcasted)
1046+
function chunkedcopyto!(dest::BitArray, bc::Broadcasted)
10471047
isempty(dest) && return dest
10481048
f = flatten(liftfuncs(bc))
10491049
args = liftchunks(f.args)
@@ -1090,7 +1090,7 @@ end
10901090

10911091
## Tuple methods
10921092

1093-
@inline function copy(bc::Broadcasted{Style{Tuple}})
1093+
function copy(bc::Broadcasted{Style{Tuple}})
10941094
dim = axes(bc)
10951095
length(dim) == 1 || throw(DimensionMismatch("tuple only supports one dimension"))
10961096
N = length(dim[1])
@@ -1174,15 +1174,15 @@ struct BitMaskedBitArray{N,M}
11741174
mask::BitArray{M}
11751175
BitMaskedBitArray{N,M}(parent, mask) where {N,M} = new(parent, mask)
11761176
end
1177-
@inline function BitMaskedBitArray(parent::BitArray{N}, mask::BitArray{M}) where {N,M}
1177+
function BitMaskedBitArray(parent::BitArray{N}, mask::BitArray{M}) where {N,M}
11781178
@boundscheck checkbounds(parent, mask)
11791179
BitMaskedBitArray{N,M}(parent, mask)
11801180
end
11811181
Base.@propagate_inbounds dotview(B::BitArray, i::BitArray) = BitMaskedBitArray(B, i)
11821182
Base.show(io::IO, B::BitMaskedBitArray) = foreach(arg->show(io, arg), (typeof(B), (B.parent, B.mask)))
11831183
# Override materialize! to prevent the BitMaskedBitArray from escaping to an overrideable method
1184-
@inline materialize!(B::BitMaskedBitArray, bc::Broadcasted{<:Any,<:Any,typeof(identity),Tuple{Bool}}) = fill!(B, bc.args[1])
1185-
@inline materialize!(B::BitMaskedBitArray, bc::Broadcasted{<:Any}) = materialize!(SubArray(B.parent, to_indices(B.parent, (B.mask,))), bc)
1184+
materialize!(B::BitMaskedBitArray, bc::Broadcasted{<:Any,<:Any,typeof(identity),Tuple{Bool}}) = fill!(B, bc.args[1])
1185+
materialize!(B::BitMaskedBitArray, bc::Broadcasted{<:Any}) = materialize!(SubArray(B.parent, to_indices(B.parent, (B.mask,))), bc)
11861186
function Base.fill!(B::BitMaskedBitArray, b::Bool)
11871187
Bc = B.parent.chunks
11881188
Ic = B.mask.chunks

0 commit comments

Comments
 (0)