Skip to content

Commit 49673bc

Browse files
authored
Move MemoryBuffer definition to StrideArraysCore (#78)
1 parent 0123f39 commit 49673bc

File tree

4 files changed

+6
-25
lines changed

4 files changed

+6
-25
lines changed

Project.toml

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

66
[deps]
77
ArrayInterface = "4fba245c-0d91-5ea0-9b3e-6abc04ee57a9"
88
LoopVectorization = "bdcacae8-1622-11e9-2a5c-532679323890"
99
Static = "aedffcd0-7271-4cad-89d0-dc628f76c6d3"
10+
StrideArraysCore = "7792a7ef-975c-4747-a70f-980b88e8d1da"
1011
ThreadingUtilities = "8290d209-cae3-49c0-8002-c8c24d57dab5"
1112
VectorizationBase = "3d5dd08c-fd9d-11e8-17fa-ed2836048c2f"
1213

1314
[compat]
1415
ArrayInterface = "3"
15-
LoopVectorization = "0.11,0.12"
16+
LoopVectorization = "0.12"
1617
Static = "0.2"
18+
StrideArraysCore = "0.1.5"
1719
ThreadingUtilities = "0.4"
18-
VectorizationBase = "0.18,0.19"
20+
VectorizationBase = "0.19"
1921
julia = "1.5"
2022

2123
[extras]

src/Octavian.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ using ArrayInterface: OptionallyStaticUnitRange, size, strides, offsets, indices
1111

1212
using Static: StaticInt, Zero, One, StaticBool, True, False, gt, eq, StaticFloat64,
1313
roundtostaticint, floortostaticint
14+
using StrideArraysCore: MemoryBuffer
1415

1516
using ThreadingUtilities:
1617
_atomic_add!, _atomic_load, _atomic_store!,

src/memory_buffer.jl

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,3 @@
1-
@inline Base.unsafe_convert(::Type{Ptr{T}}, d::MemoryBuffer) where {T} = Base.unsafe_convert(Ptr{T}, Base.pointer_from_objref(d))
2-
@inline MemoryBuffer{T}(::UndefInitializer, ::StaticInt{L}) where {L,T} = MemoryBuffer{L,T}(undef)
3-
Base.size(::MemoryBuffer{L}) where L = (L,)
4-
@inline Base.similar(::MemoryBuffer{L,T}) where {L,T} = MemoryBuffer{L,T}(undef)
5-
# Base.IndexStyle(::Type{<:MemoryBuffer}) = Base.IndexLinear()
6-
@inline function Base.getindex(m::MemoryBuffer{L,T}, i::Int) where {L,T}
7-
@boundscheck checkbounds(m, i)
8-
GC.@preserve m x = vload(pointer(m), VectorizationBase.lazymul(VectorizationBase.static_sizeof(T), i - one(i)))
9-
x
10-
end
11-
@inline function Base.setindex!(m::MemoryBuffer{L,T}, x, i::Int) where {L,T}
12-
@boundscheck checkbounds(m, i)
13-
GC.@preserve m vstore!(pointer(m), convert(T, x), lazymul(static_sizeof(T), i - one(i)))
14-
end
151

162
if Sys.WORD_SIZE == 32
173
@inline function first_cache_buffer(::Type{T}) where {T}

src/types.jl

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,3 @@
1-
mutable struct MemoryBuffer{L,T} <: DenseVector{T}
2-
data::NTuple{L,T}
3-
@inline function MemoryBuffer{L,T}(::UndefInitializer) where {L,T}
4-
@assert isbitstype(T) "Memory buffers must point to bits types, but `isbitstype($T) == false`."
5-
new{L,T}()
6-
end
7-
end
8-
91
struct BCache{T<:Union{UInt,Nothing}}
102
p::Ptr{Cvoid}
113
i::T

0 commit comments

Comments
 (0)