Skip to content

Commit c6d46de

Browse files
authored
Updates for ArrayInterface 7, fixes #168 (#169)
1 parent 4304bce commit c6d46de

File tree

5 files changed

+17
-16
lines changed

5 files changed

+17
-16
lines changed

Project.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
name = "Octavian"
22
uuid = "6fd5a793-0b7e-452c-907f-f8bfe9c57db4"
33
authors = ["Chris Elrod", "Dilum Aluthge", "Mason Protter", "contributors"]
4-
version = "0.3.20"
4+
version = "0.3.21"
55

66
[deps]
7-
ArrayInterface = "4fba245c-0d91-5ea0-9b3e-6abc04ee57a9"
87
CPUSummary = "2a0fbf3d-bb9c-48f3-b0a9-814d99fd7ab9"
98
IfElse = "615f187c-cbe4-4ef1-ba3b-2fcf58d6d173"
109
LoopVectorization = "bdcacae8-1622-11e9-2a5c-532679323890"
@@ -13,19 +12,20 @@ PolyesterWeave = "1d0040c9-8b98-4ee7-8388-3f51789ca0ad"
1312
Requires = "ae029012-a4dd-5104-9daa-d747884805df"
1413
SnoopPrecompile = "66db9d55-30c0-4569-8b51-7e840670fc0c"
1514
Static = "aedffcd0-7271-4cad-89d0-dc628f76c6d3"
15+
StaticArrayInterface = "0d7ed370-da01-4f52-bd93-41d350b8b718"
1616
ThreadingUtilities = "8290d209-cae3-49c0-8002-c8c24d57dab5"
1717
VectorizationBase = "3d5dd08c-fd9d-11e8-17fa-ed2836048c2f"
1818

1919
[compat]
20-
ArrayInterface = "3.1.14, 5.0.1, 6"
2120
CPUSummary = "0.1.26, 0.2.1"
2221
IfElse = "0.1"
2322
LoopVectorization = "0.12.86"
2423
ManualMemory = "0.1.1"
2524
PolyesterWeave = "0.1.1, 0.2"
2625
Requires = "1"
2726
SnoopPrecompile = "1"
28-
Static = "0.7.5, 0.8"
27+
Static = "0.8.4"
28+
StaticArrayInterface = "1"
2929
ThreadingUtilities = "0.5"
3030
VectorizationBase = "0.21.15"
3131
julia = "1.6"

src/Octavian.jl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ module Octavian
22

33
using Requires: @require
44

5-
using VectorizationBase, ArrayInterface, LoopVectorization
5+
using VectorizationBase, StaticArrayInterface, LoopVectorization
66

77
using VectorizationBase:
88
align,
@@ -18,7 +18,9 @@ using VectorizationBase:
1818
has_feature
1919
using CPUSummary: cache_size, num_cores, cache_inclusive, cache_linesize
2020
using LoopVectorization: preserve_buffer, CloseOpen, UpperBoundedInteger
21-
using ArrayInterface: size, strides, offsets, indices, axes, StrideIndex
21+
using StaticArrayInterface:
22+
static_size, static_strides, offsets, indices, axes, StrideIndex
23+
const ArrayInterface = StaticArrayInterface
2224
using IfElse: ifelse
2325
using PolyesterWeave
2426
using Static:

src/complex_matmul.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
real_rep(a::AbstractArray{Complex{T},N}) where {T,N} =
22
reinterpret(reshape, T, a)
3-
#PtrArray(Ptr{T}(pointer(a)), (StaticInt(2), size(a)...))
43

54
for AT in [:AbstractVector, :AbstractMatrix] # to avoid ambiguity error
65
@eval begin

src/matmul.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ end
120120
@inline contiguousstride1(A) = ArrayInterface.contiguous_axis(A) === One()
121121
@inline contiguousstride1(A::AbstractStridedPointer{T,N,1}) where {T,N} = true
122122
# @inline bytestride(A::AbstractArray, i) = VectorizationBase.bytestrides(A)[i]
123-
@inline bytestride(A::AbstractStridedPointer, i) = strides(A)[i]
123+
@inline bytestride(A::AbstractStridedPointer, i) = static_strides(A)[i]
124124
@inline firstbytestride(A::AbstractStridedPointer) = bytestride(A, One())
125125

126126
@inline function vectormultiple(bytex, ::Type{Tc}, ::Type{Ta}) where {Tc,Ta}
@@ -154,8 +154,8 @@ end
154154
B::AbstractMatrix{TB}
155155
) where {TA,TB}
156156
# TODO: if `M` and `N` are statically sized, shouldn't return a `Matrix`.
157-
M, KA = size(A)
158-
KB, N = size(B)
157+
M, KA = static_size(A)
158+
KB, N = static_size(B)
159159
@assert KA == KB "Size mismatch."
160160
if M === StaticInt(1)
161161
transpose(Vector{promote_type(TA, TB)}(undef, N)), (M, KA, N)
@@ -168,7 +168,7 @@ end
168168
B::AbstractVector{TB}
169169
) where {TA,TB}
170170
# TODO: if `M` and `N` are statically sized, shouldn't return a `Matrix`.
171-
M, KA = size(A)
171+
M, KA = static_size(A)
172172
KB = length(B)
173173
@assert KA == KB "Size mismatch."
174174
Vector{promote_type(TA, TB)}(undef, M), (M, KA, One())

src/utils.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ Checks sizes for compatibility, and preserves the static size information if
99
given a mix of static and dynamic sizes.
1010
"""
1111
@inline function matmul_sizes(C, A, B)
12-
MC, NC = size(C)
13-
MA, KA = size(A)
14-
KB, NB = size(B)
12+
MC, NC = static_size(C)
13+
MA, KA = static_size(A)
14+
KB, NB = static_size(B)
1515
@assert ((MC == MA) & (KA == KB) & (NC == NB)) "Size mismatch."
1616
(_select(MA, MC), _select(KA, KB), _select(NB, NC))
1717
end
@@ -77,7 +77,7 @@ end
7777
Bn = Core.ifelse(B > 1, B + 1, B)
7878
quote
7979
$(Expr(:meta, :inline))
80-
x = strides(sp)
80+
x = static_strides(sp)
8181
x0 = $gf(x, 1, false)
8282
si = StrideIndex{$(N + 1),$Rn,$Cn}($xt, $ot)
8383
stridedpointer($gf(sp, :p), si, StaticInt{$Bn}())
@@ -97,7 +97,7 @@ end
9797
end
9898
quote
9999
$(Expr(:meta, :inline))
100-
x = strides(sp)
100+
x = static_strides(sp)
101101
o = offsets(sp)
102102
si = StrideIndex{$(N - 1),$rt,$Cn}($xt, $ot)
103103
stridedpointer($gf(sp, :p), si, StaticInt{$Bn}())

0 commit comments

Comments
 (0)