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

Bug in device for reshaped views #158

Open
ranocha opened this issue May 31, 2021 · 1 comment
Open

Bug in device for reshaped views #158

ranocha opened this issue May 31, 2021 · 1 comment

Comments

@ranocha
Copy link
Contributor

ranocha commented May 31, 2021

Reported by @chriselrod in #156 (comment):

 julia> using ArrayInterface
 
 julia> u_base = randn(10, 10); u_view = view(u_base, 2:3, :); u_reshaped_view = reshape(u_view, 1, length(u_view));
 
 julia> ArrayInterface.device(u_reshaped_view)
 ArrayInterface.CPUPointer()

This u_reshaped_view is not strided, so it should not be a CPUPointer(), but a CPUIndex() (which currently is not supported by LoopVectorization).

@Tokazama
Copy link
Member

The core issue here is that we cannot properly dispatch on ReshapedArray (or ReinterpretArray) to a known solution for defines_strides. Previously, we were giving up on strides for both of these if we didn't know it was possible from type information, but recent changes attempt to solve this at runtime.

To fix this we need to either go back to giving up on strides when it isn't known at compile time, get Base Julia to store size information statically, or rework how device is supposed to be used so that it doesn't rely on strides.

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

2 participants