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

chunk returns views for CuArrays #103

Closed
CarloLucibello opened this issue Jun 19, 2022 · 2 comments · Fixed by #133
Closed

chunk returns views for CuArrays #103

CarloLucibello opened this issue Jun 19, 2022 · 2 comments · Fixed by #133

Comments

@CarloLucibello
Copy link
Member

CarloLucibello commented Jun 19, 2022

See the discussion in FluxML/Metalhead.jl#165
and JuliaGPU/CUDA.jl#1542.

The problem is that we don't want wrapped cuarray types since it will affect the following dispatches, right @theabhirath @darsnack?

using CUDA, MLUtils

julia> x = rand(2, 10) |> cu;

julia> a = chunk(x, 2)[1]  # wrapped cuarray
2×2 view(::CuArray{Float32, 2, CUDA.Mem.DeviceBuffer}, :, 1:2) with eltype Float32:
 0.545259  0.936495
 0.174116  0.514381

julia> view(x, :, 1:2) # just a cuarray
2×2 CuArray{Float32, 2, CUDA.Mem.DeviceBuffer}:
 0.545259  0.936495
 0.174116  0.514381
@CarloLucibello CarloLucibello changed the title chunk is not gpu compatible chunk returns views for CuArrays Jun 19, 2022
@darsnack
Copy link
Member

Yeah that's the issue. Is there a difference between what selectdim returns vs. a manually written view?

@ToucheSir
Copy link
Contributor

ToucheSir commented Jun 19, 2022

There is, all the gory details (and a possible fix) are in the CUDA.jl issue.

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

Successfully merging a pull request may close this issue.

3 participants