Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add is_strided #24

Closed
oxinabox opened this issue Sep 30, 2019 · 4 comments
Closed

Add is_strided #24

oxinabox opened this issue Sep 30, 2019 · 4 comments

Comments

@oxinabox
Copy link
Member

see JuliaLang/julia#2345 (comment)

@ChrisRackauckas
Copy link
Member

Definitely agree

@chriselrod
Copy link
Collaborator

chriselrod commented Jul 19, 2020

I want something that only returns true if we can call pointer (or Base.unsafe_convert(Ptr{T}, A)) and get a Ptr to valid CPU memory.
With it returning false for GPUArrays (which are <: StridedArray), I could use that for LoopVectorization.check_args.

Would we want separate is_strided and is_cpu_strided (maybe adding is_device_strided as a mirror)?

@chriselrod
Copy link
Collaborator

@mbauman, I hope I can ping you here to ask both about implementation, and what you think should be covered.

I would be happy with something like:

is_strided(::Any) = false
is_strided(::StridedArray) = true
# library support
is_strided(::GPUArrays.GPUArray) = false
is_strided(::StaticArrays.MArray) = true

and I can special case support for things like PermutedDimsArray of is_strided arrays myself.

But it depends upon what interfaces we want is_strided(A) == true to promise support for.
What I am suggesting above is:

  1. You can get a pointer to memory the CPU can work with.
  2. The memory is strided and column major.

I'd also like to have something else for whether isone(LinearAlgebra.stride1(A)) is known to be true at compile time.

@Tokazama
Copy link
Member

Can we close this now that we have defines_strides?

@Tokazama Tokazama closed this as completed Sep 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants