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

SubArray Broadcast Bug in 2.0 #488

Closed
btmit opened this issue Oct 13, 2020 · 1 comment
Closed

SubArray Broadcast Bug in 2.0 #488

btmit opened this issue Oct 13, 2020 · 1 comment
Labels
regression Something that used to work, doesn't anymore.

Comments

@btmit
Copy link

btmit commented Oct 13, 2020

The following code worked fine with v1.3.3, but is broken with v2.0.1.

using CUDA

dims = (4,4,3)

ad = CUDA.randn(Float32, dims)
ad[:,[1,3],:] .= 0

gives

ERROR: GPU compilation of kernel broadcast_kernel(CUDA.CuKernelContext, SubArray{Float32,4,CuDeviceArray{Float32,4,1},Tuple{Base.Slice{Base.OneTo{Int64}},Array{Int64,1},Base.Slice{Base.OneTo{Int64}},Base.Slice{Base.OneTo{Int64}}},false}, Base.Broadcast.Broadcasted{Nothing,NTuple{4,Base.OneTo{Int64}},typeof(identity),Tuple{Int64}}, Int64) failed
KernelError: passing and using non-bitstype argument

Argument 3 to your kernel function is of type SubArray{Float32,4,CuDeviceArray{Float32,4,1},Tuple{Base.Slice{Base.OneTo{Int64}},Array{Int64,1},Base.Slice{Base.OneTo{Int64}},Base.Slice{Base.OneTo{Int64}}},false}, which is not isbits:
.indices is of type Tuple{Base.Slice{Base.OneTo{Int64}},Array{Int64,1},Base.Slice{Base.OneTo{Int64}},Base.Slice{Base.OneTo{Int64}}} which is not isbits.
.2 is of type Array{Int64,1} which is not isbits.

I see the same error if I break it out into the following:

av = view(ad, :,[1,3],:)
av .= 0

Corresponding CPU/Base code which also works fine:

ah = randn(dims)
ah[:,[1,3],:] .= 0

Is there a workaround or different approach I should be using in 2.0?

@btmit btmit added the bug Something isn't working label Oct 13, 2020
@btmit btmit changed the title Reshape Bug in 2.0 SubArray Bug in 2.0 Oct 13, 2020
@btmit btmit changed the title SubArray Bug in 2.0 SubArray Broadcast Bug in 2.0 Oct 13, 2020
@maleadt maleadt added regression Something that used to work, doesn't anymore. and removed bug Something isn't working labels Oct 14, 2020
@maleadt
Copy link
Member

maleadt commented Oct 29, 2020

This now works on master, I guess I fixed it :-) could you verify?

@maleadt maleadt closed this as completed Oct 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
regression Something that used to work, doesn't anymore.
Projects
None yet
Development

No branches or pull requests

2 participants