Skip to content
This repository has been archived by the owner on Sep 27, 2021. It is now read-only.

Muladd fallback #33

Closed
ranocha opened this issue Jun 17, 2018 · 3 comments · Fixed by SimonDanisch/Transpiler.jl#27
Closed

Muladd fallback #33

ranocha opened this issue Jun 17, 2018 · 3 comments · Fixed by SimonDanisch/Transpiler.jl#27

Comments

@ranocha
Copy link
Member

ranocha commented Jun 17, 2018

For CuArrays, muladd has been added, see JuliaGPU/GPUArrays.jl#21. However, CLArrays don't seem to support muladd, which is used a lot in OrdinaryDiffEq.jl. It would be very nice if muladd could be used for broadcasting with CLArrayss.

julia> using CLArrays

julia> u0 = CLArray(ones(Float32, 32, 32)); u1 = zeros(u0); muladd.(2, u0, u1)
___________________________________________________________________
Error in Expr rewrite! UndefRefError()

Expression resulting in the error: 
(muladd_float)(x::Float32, y::Float32, z::Float32)::Float32
happening in function tree:
Sugar stack trace:
  [1] muladd(Float32, Float32, Float32)

  [2] muladd(Int64, Float32, Float32)

  [3] #1(Float32, Float32)

  [4] GPUArrays.apply_broadcast(UInt32, ##1#2, Tuple{UInt32,UInt32}, Tuple{GPUArrays.BInfo{Array,2},GPUArrays.BInfo{Array,2}}, Tuple{CLArrays.DeviceArray{Float32,2,Transpiler.CLIntrinsics.GlobalPointer{Float32}},CLArrays.DeviceArray{Float32,2,Transpiler.CLIntrinsics.GlobalPointer{Float32}}})

  [5] GPUArrays.broadcast_kernel!(CLArrays.KernelState, ##1#2, CLArrays.DeviceArray{Float32,2,Transpiler.CLIntrinsics.GlobalPointer{Float32}}, Tuple{UInt32,UInt32}, Tuple{GPUArrays.BInfo{Array,2},GPUArrays.BInfo{Array,2}}, Tuple{CLArrays.DeviceArray{Float32,2,Transpiler.CLIntrinsics.GlobalPointer{Float32}},CLArrays.DeviceArray{Float32,2,Transpiler.CLIntrinsics.GlobalPointer{Float32}}})


Code of the context this error occured in: 
begin 
      return (Base.muladd_float)(x::Float32, y::Float32, z::Float32)::Float32
  end::Any
ERROR: UndefRefError: access to undefined reference

I get similar errors if I use OrdinaryDiffEq with CLArrays.

@SimonDanisch
Copy link
Member

Hm, I do actually have a test for it:

@testset "muladd & abs" begin

Let me see in what way it differs from that

@SimonDanisch
Copy link
Member

Yeah, it's the int... muladd.(2f0, u0, u1) works... Let me see if I can fix it!

@ranocha
Copy link
Member Author

ranocha commented Jun 17, 2018

Thank you very much for your fast response and help!

SimonDanisch added a commit that referenced this issue Jun 17, 2018
* make size(x, 1) type stable

* add test for #33
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants