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

Broadcast fusion fails when scalars are involved #22

Closed
ChrisRackauckas opened this issue Jun 5, 2017 · 6 comments
Closed

Broadcast fusion fails when scalars are involved #22

ChrisRackauckas opened this issue Jun 5, 2017 · 6 comments

Comments

@ChrisRackauckas
Copy link
Member

u0 = GPUArray(rand(Float32, 32, 32))
tmp = ones(u0)
uprev = ones(u0)
k1 = ones(u0)
a = Float32(2.0)
tmp .=  uprev.+a.*k1
indexing not defined for GPUArrays.GPUArray{Float32,2,OpenCL.cl.Buffer{Float32},GPUArrays.CLBackend.CLContext}
getindex at abstractarray.jl:874 [inlined]
_getindex at abstractarray.jl:921 [inlined]
getindex at abstractarray.jl:875 [inlined]
_broadcast_getindex at broadcast.jl:133 [inlined]
_broadcast_getindex at broadcast.jl:130 [inlined]
macro expansion at broadcast.jl:151 [inlined]
macro expansion at simdloop.jl:73 [inlined]
macro expansion at broadcast.jl:147 [inlined]
_broadcast!(::##5#6, ::GPUArrays.GPUArray{Float32,2,OpenCL.cl.Buffer{Float32},GPUArrays.CLBackend.CLContext}, ::Tuple{Tuple{Bool,Bool},Tuple{},Tuple{Bool,Bool}}, ::Tuple{Tuple{Int64,Int64},Tuple{},Tuple{Int64,Int64}}, ::GPUArrays.GPUArray{Float32,2,OpenCL.cl.Buffer{Float32},GPUArrays.CLBackend.CLContext}, ::Tuple{Float32,GPUArrays.GPUArray{Float32,2,OpenCL.cl.Buffer{Float32},GPUArrays.CLBackend.CLContext}}, ::Type{Val{2}}, ::CartesianRange{CartesianIndex{2}}) at broadcast.jl:139
broadcast_c! at broadcast.jl:211 [inlined]
broadcast!(::Function, ::GPUArrays.GPUArray{Float32,2,OpenCL.cl.Buffer{Float32},GPUArrays.CLBackend.CLContext}, ::GPUArrays.GPUArray{Float32,2,OpenCL.cl.Buffer{Float32},GPUArrays.CLBackend.CLContext}, ::Float32, ::GPUArrays.GPUArray{Float32,2,OpenCL.cl.Buffer{Float32},GPUArrays.CLBackend.CLContext}) at broadcast.jl:204
include_string(::String, ::String) at loading.jl:515
include_string(::String, ::String, ::Int64) at eval.jl:30
include_string(::Module, ::String, ::String, ::Int64, ::Vararg{Int64,N} where N) at eval.jl:34
(::Atom.##49#52{String,Int64,String})() at eval.jl:50
withpath(::Atom.##49#52{String,Int64,String}, ::String) at utils.jl:30
withpath(::Function, ::String) at eval.jl:38
macro expansion at eval.jl:49 [inlined]
(::Atom.##48#51{Dict{String,Any}})() at task.jl:80
@SimonDanisch
Copy link
Member

That probably just needs another broadcast overload .... It's a bit problematic to overload broadcast without ambiguities. I should try to have a more systematic approach of what I overload!

@ChrisRackauckas
Copy link
Member Author

I actually don't understand how you're defining broadcast here. In my packages I had to make sure that broadcasts could include Number and used a generating function to build the correct call. I would assume something similar would work here.

@SimonDanisch
Copy link
Member

I wanted it to work with Any as well, which makes it more ambiguous, I think...

@ChrisRackauckas
Copy link
Member Author

I wanted it to work with Any as well, which makes it more ambiguous, I think...

Not sure how that could work since you need to be making a GPU kernel, right? At least I assumed what you're somehow doing is building an anonymous function and generating a GPU kernel to map on that. And if that's what you're doing, handling scalars is fine, but arbitrary Julia types will definitely not work.

@SimonDanisch
Copy link
Member

immutable arbitrary julia type work relatively fine ;)

SimonDanisch added a commit that referenced this issue Jun 6, 2017
SimonDanisch added a commit that referenced this issue Jul 23, 2017
@SimonDanisch
Copy link
Member

Solved by #37

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