|
44 | 44 | @inline ArrayInterface.parent_type( |
45 | 45 | ::Type{LowDimArray{D,T,N,A}} |
46 | 46 | ) where {T,D,N,A} = A |
47 | | -@inline Base.strides(A::LowDimArray) = map(Int, strides(A)) |
| 47 | +@inline Base.strides(A::LowDimArray) = map(Int, static_strides(A)) |
48 | 48 | @inline ArrayInterface.device(::LowDimArray) = ArrayInterface.CPUPointer() |
49 | | -@generated function ArrayInterface.size(A::LowDimArray{D,T,N}) where {D,T,N} |
| 49 | +@generated function ArrayInterface.static_size( |
| 50 | + A::LowDimArray{D,T,N} |
| 51 | +) where {D,T,N} |
50 | 52 | t = Expr(:tuple) |
51 | 53 | for n ∈ 1:N |
52 | 54 | if n > length(D) || D[n] |
@@ -105,11 +107,13 @@ end |
105 | 107 | @inline forbroadcast(A) = A |
106 | 108 | # @inline forbroadcast(A::Adjoint) = forbroadcast(parent(A)) |
107 | 109 | # @inline forbroadcast(A::Transpose) = forbroadcast(parent(A)) |
108 | | -@inline function ArrayInterface.strides(A::Union{LowDimArray,ForBroadcast}) |
| 110 | +@inline function ArrayInterface.static_strides( |
| 111 | + A::Union{LowDimArray,ForBroadcast} |
| 112 | +) |
109 | 113 | B = parent(A) |
110 | 114 | _strides( |
111 | | - size(A), |
112 | | - strides(B), |
| 115 | + static_size(A), |
| 116 | + static_strides(B), |
113 | 117 | VectorizationBase.val_stride_rank(B), |
114 | 118 | VectorizationBase.val_dense_dims(B) |
115 | 119 | ) |
@@ -145,10 +149,10 @@ end |
145 | 149 | ) where {D,T,N,A} |
146 | 150 | _lowdimfilter(Val(D), ArrayInterface.dense_dims(A)) |
147 | 151 | end |
148 | | -@inline function ArrayInterface.strides( |
| 152 | +@inline function ArrayInterface.static_strides( |
149 | 153 | fb::LowDimArrayForBroadcast{D} |
150 | 154 | ) where {D} |
151 | | - _lowdimfilter(Val(D), strides(parent(fb))) |
| 155 | + _lowdimfilter(Val(D), static_strides(parent(fb))) |
152 | 156 | end |
153 | 157 | @inline function ArrayInterface.offsets( |
154 | 158 | fb::LowDimArrayForBroadcast{D} |
@@ -225,11 +229,9 @@ function _strides_expr( |
225 | 229 | sₙ_value::Int = 0 |
226 | 230 | for n ∈ Nrange |
227 | 231 | xₙ_type = x[n] |
228 | | - # xₙ_type = typeof(x).parameters[n] |
229 | 232 | xₙ_static = xₙ_type <: StaticInt |
230 | 233 | xₙ_value::Int = xₙ_static ? (xₙ_type.parameters[1])::Int : 0 |
231 | 234 | s_type = s[n] |
232 | | - # s_type = typeof(s).parameters[n] |
233 | 235 | sₙ_static = s_type <: StaticInt |
234 | 236 | if sₙ_static |
235 | 237 | sₙ_value = s_type.parameters[1] |
@@ -365,7 +367,7 @@ function add_broadcast!( |
365 | 367 | pushprepreamble!(ls, Expr(:(=), mB, Expr(:(.), bcname, QuoteNode(:b)))) |
366 | 368 | pushprepreamble!( |
367 | 369 | ls, |
368 | | - Expr(:(=), Klen, Expr(:call, getfield, Expr(:call, :size, mB), 1)) |
| 370 | + Expr(:(=), Klen, Expr(:call, getfield, Expr(:call, :static_size, mB), 1)) |
369 | 371 | ) |
370 | 372 | pushpreamble!(ls, Expr(:(=), Krange, Expr(:call, :(:), staticexpr(1), Klen))) |
371 | 373 | k = gensym!(ls, "k") |
@@ -587,7 +589,7 @@ function add_broadcast_loops!( |
587 | 589 | destsym::Symbol |
588 | 590 | ) |
589 | 591 | axes_tuple = Expr(:tuple) |
590 | | - pushpreamble!(ls, Expr(:(=), axes_tuple, Expr(:call, :axes, destsym))) |
| 592 | + pushpreamble!(ls, Expr(:(=), axes_tuple, Expr(:call, :static_axes, destsym))) |
591 | 593 | for itersym ∈ loopsyms |
592 | 594 | Nrange = gensym!(ls, "N") |
593 | 595 | Nlower = gensym!(ls, "N") |
|
0 commit comments