Skip to content

Commit

Permalink
more PtrArrays
Browse files Browse the repository at this point in the history
  • Loading branch information
chriselrod committed May 27, 2022
1 parent 27224a7 commit 27a03a3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "StrideArraysCore"
uuid = "7792a7ef-975c-4747-a70f-980b88e8d1da"
authors = ["Chris Elrod <[email protected]> and contributors"]
version = "0.3.7"
version = "0.3.8"

[deps]
ArrayInterface = "4fba245c-0d91-5ea0-9b3e-6abc04ee57a9"
Expand Down
8 changes: 7 additions & 1 deletion src/thread_compatible.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,13 @@ end
@inline object_and_preserve(x::String) = (x, x)
@inline object_and_preserve(A::AbstractArray{T}) where {T<:NativeTypes} =
array_object_and_preserve(ArrayInterface.device(A), A)
@inline object_and_preserve(A::AbstractArray) = (A, A)
@inline function object_and_preserve(A::AbstractArray{T}) where {T}
if isbitstype(T) && ArrayInterface.device(A) === ArrayInterface.CPUPointer()
(PtrArray(A), preserve_buffer(A))
else
(A, A)
end
end
@inline function object_and_preserve(bc::Base.Broadcast.Broadcasted)
if isbits(bc.f) && isbits(bc.axes)
bca, bcp = object_and_preserve(bc.args)
Expand Down

2 comments on commit 27a03a3

@chriselrod
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/61150

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.3.8 -m "<description of version>" 27a03a332009223950872198d292683cb2013e9f
git push origin v0.3.8

Please sign in to comment.