{"action":"created","issue":{"url":"https://api.github.com/repos/JuliaGPU/CuArrays.jl/issues/76","repository_url":"https://api.github.com/repos/JuliaGPU/CuArrays.jl","labels_url":"https://api.github.com/repos/JuliaGPU/CuArrays.jl/issues/76/labels{/name}","comments_url":"https://api.github.com/repos/JuliaGPU/CuArrays.jl/issues/76/comments","events_url":"https://api.github.com/repos/JuliaGPU/CuArrays.jl/issues/76/events","html_url":"https://github.com/JuliaGPU/CuArrays.jl/issues/76","id":319129055,"number":76,"title":"Any chance x^.a, for (a> 2.0) will be supported at some point?","user":{"login":"osofr","id":6721358,"avatar_url":"https://avatars2.githubusercontent.com/u/6721358?v=4","gravatar_id":"","url":"https://api.github.com/users/osofr","html_url":"https://github.com/osofr","followers_url":"https://api.github.com/users/osofr/followers","following_url":"https://api.github.com/users/osofr/following{/other_user}","gists_url":"https://api.github.com/users/osofr/gists{/gist_id}","starred_url":"https://api.github.com/users/osofr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/osofr/subscriptions","organizations_url":"https://api.github.com/users/osofr/orgs","repos_url":"https://api.github.com/users/osofr/repos","events_url":"https://api.github.com/users/osofr/events{/privacy}","received_events_url":"https://api.github.com/users/osofr/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-05-01T06:36:21Z","updated_at":"2018-05-01T11:02:30Z","closed_at":null,"author_association":"NONE","body":"Very simple `x2 .^ 4` completely fails and has been since the age of times. Any chance this may be supported at some point? It feels like `CuArrays` is in real shortage of TLC. Just my sad perspective of trying to use it, apologies.\r\n\r\n```julia\r\njulia> x = rand(Float32, 100);\r\n\r\njulia> using Flux\r\n\r\nusing CuArrays\r\n\r\njulia> \r\n\r\njulia> using CuArrays\r\nx2 = x |> gpu;\r\n\r\njulia> x2 = x |> gpu;\r\n\r\njulia> x2 .^ 4\r\n\r\nERROR: LLVM error: Cannot select: 0x23701520: f32 = fpow 0x237010c0, ConstantFP:f32<4.000000e+00>\r\n  0x237010c0: f32,ch = load<LD4[null(addrspace=101)]> 0x237065b0, TargetExternalSymbol:i64'julia__1_63502_param_0', undef:i64\r\n    0x23700fe0: i64 = TargetExternalSymbol'julia__1_63502_param_0'\r\n    0x23701050: i64 = undef\r\n  0x237014b0: f32 = ConstantFP<4.000000e+00>\r\nIn function: julia__1_63502\r\nStacktrace:\r\n [1] handle_error(::Cstring) at /home/ubuntu/.julia/v0.6/LLVM/src/core/context.jl:100\r\n [2] macro expansion at /home/ubuntu/.julia/v0.6/LLVM/src/base.jl:22 [inlined]\r\n [3] LLVMTargetMachineEmitToMemoryBuffer(::Ptr{LLVM.API.LLVMOpaqueTargetMachine}, ::Ptr{LLVM.API.LLVMOpaqueModule}, ::UInt32, ::Base.RefValue{Cstring}, ::Base.RefValue{Ptr{LLVM.API.LLVMOpaqueMemoryBuffer}}) at /home/ubuntu/.julia/v0.6/LLVM/src/../lib/3.9/libLLVM_h.jl:301\r\n [4] emit(::LLVM.TargetMachine, ::LLVM.Module, ::UInt32) at /home/ubuntu/.julia/v0.6/LLVM/src/targetmachine.jl:42\r\n [5] #mcgen#57(::Bool, ::Function, ::LLVM.Module, ::LLVM.Function, ::VersionNumber) at /home/ubuntu/.julia/v0.6/CUDAnative/src/jit.jl:393\r\n [6] (::CUDAnative.#kw##mcgen)(::Array{Any,1}, ::CUDAnative.#mcgen, ::LLVM.Module, ::LLVM.Function, ::VersionNumber) at ./<missing>:0\r\n [7] #compile_function#58(::Bool, ::Function, ::Any, ::Any, ::VersionNumber) at /home/ubuntu/.julia/v0.6/CUDAnative/src/jit.jl:440\r\n [8] cufunction(::CUDAdrv.CuDevice, ::Any, ::Any) at /home/ubuntu/.julia/v0.6/CUDAnative/src/jit.jl:488\r\n [9] macro expansion at /home/ubuntu/.julia/v0.6/CUDAnative/src/execution.jl:107 [inlined]\r\n [10] _cuda(::Tuple{Int64,Int64}, ::Int64, ::CUDAdrv.CuStream, ::CuArrays.#broadcast_kernel, ::##1#2, ::CUDAnative.CuDeviceArray{Float32,1,CUDAnative.AS.Global}, ::Tuple{Tuple{Bool}}, ::Tuple{Tuple{Int64}}, ::CUDAnative.CuDeviceArray{Float32,1,CUDAnative.AS.Global}, ::Tuple{}) at /home/ubuntu/.julia/v0.6/CUDAnative/src/execution.jl:80\r\n [11] _broadcast! at /home/ubuntu/.julia/v0.6/CuArrays/src/broadcast.jl:22 [inlined]\r\n [12] broadcast_t at /home/ubuntu/.julia/v0.6/CuArrays/src/broadcast.jl:37 [inlined]\r\n [13] broadcast_c at /home/ubuntu/.julia/v0.6/CuArrays/src/broadcast.jl:58 [inlined]\r\n [14] broadcast(::Function, ::CuArray{Float32,1}) at ./broadcast.jl:455\r\n\r\njulia> \r\n\r\njulia> x2 .^ 4.0\r\nERROR: LLVM error: Cannot select: 0x252443c0: f64 = fpow 0x252442e0, ConstantFP:f64<4.000000e+00>\r\n  0x252442e0: f64 = fp_extend 0x25243ef0\r\n    0x25243ef0: f32,ch = load<LD4[null(addrspace=101)]> 0x23494000, TargetExternalSymbol:i64'julia_^_63768_param_0', undef:i64\r\n      0x25243e10: i64 = TargetExternalSymbol'julia_^_63768_param_0'\r\n      0x25243e80: i64 = undef\r\n  0x25244350: f64 = ConstantFP<4.000000e+00>\r\nIn function: julia_^_63768\r\nStacktrace:\r\n [1] handle_error(::Cstring) at /home/ubuntu/.julia/v0.6/LLVM/src/core/context.jl:100\r\n [2] macro expansion at /home/ubuntu/.julia/v0.6/LLVM/src/base.jl:22 [inlined]\r\n [3] LLVMTargetMachineEmitToMemoryBuffer(::Ptr{LLVM.API.LLVMOpaqueTargetMachine}, ::Ptr{LLVM.API.LLVMOpaqueModule}, ::UInt32, ::Base.RefValue{Cstring}, ::Base.RefValue{Ptr{LLVM.API.LLVMOpaqueMemoryBuffer}}) at /home/ubuntu/.julia/v0.6/LLVM/src/../lib/3.9/libLLVM_h.jl:301\r\n [4] emit(::LLVM.TargetMachine, ::LLVM.Module, ::UInt32) at /home/ubuntu/.julia/v0.6/LLVM/src/targetmachine.jl:42\r\n [5] #mcgen#57(::Bool, ::Function, ::LLVM.Module, ::LLVM.Function, ::VersionNumber) at /home/ubuntu/.julia/v0.6/CUDAnative/src/jit.jl:393\r\n [6] (::CUDAnative.#kw##mcgen)(::Array{Any,1}, ::CUDAnative.#mcgen, ::LLVM.Module, ::LLVM.Function, ::VersionNumber) at ./<missing>:0\r\n [7] #compile_function#58(::Bool, ::Function, ::Any, ::Any, ::VersionNumber) at /home/ubuntu/.julia/v0.6/CUDAnative/src/jit.jl:440\r\n [8] cufunction(::CUDAdrv.CuDevice, ::Any, ::Any) at /home/ubuntu/.julia/v0.6/CUDAnative/src/jit.jl:488\r\n [9] macro expansion at /home/ubuntu/.julia/v0.6/CUDAnative/src/execution.jl:107 [inlined]\r\n [10] _cuda(::Tuple{Int64,Int64}, ::Int64, ::CUDAdrv.CuStream, ::CuArrays.#broadcast_kernel, ::##3#4, ::CUDAnative.CuDeviceArray{Float64,1,CUDAnative.AS.Global}, ::Tuple{Tuple{Bool}}, ::Tuple{Tuple{Int64}}, ::CUDAnative.CuDeviceArray{Float32,1,CUDAnative.AS.Global}, ::Tuple{}) at /home/ubuntu/.julia/v0.6/CUDAnative/src/execution.jl:80\r\n [11] _broadcast! at /home/ubuntu/.julia/v0.6/CuArrays/src/broadcast.jl:22 [inlined]\r\n [12] broadcast_t at /home/ubuntu/.julia/v0.6/CuArrays/src/broadcast.jl:37 [inlined]\r\n [13] broadcast_c at /home/ubuntu/.julia/v0.6/CuArrays/src/broadcast.jl:58 [inlined]\r\n [14] broadcast(::Function, ::CuArray{Float32,1}) at ./broadcast.jl:455\r\n\r\njulia> x2 .^ 4.0f0\r\nERROR: LLVM error: Cannot select: 0x240c3670: f32 = fpow 0x240c3210, ConstantFP:f32<4.000000e+00>\r\n  0x240c3210: f32,ch = load<LD4[null(addrspace=101)]> 0x2497acc0, TargetExternalSymbol:i64'julia__5_63777_param_0', undef:i64\r\n    0x240c3130: i64 = TargetExternalSymbol'julia__5_63777_param_0'\r\n    0x240c31a0: i64 = undef\r\n  0x240c3600: f32 = ConstantFP<4.000000e+00>\r\nIn function: julia__5_63777\r\nStacktrace:\r\n [1] handle_error(::Cstring) at /home/ubuntu/.julia/v0.6/LLVM/src/core/context.jl:100\r\n [2] macro expansion at /home/ubuntu/.julia/v0.6/LLVM/src/base.jl:22 [inlined]\r\n [3] LLVMTargetMachineEmitToMemoryBuffer(::Ptr{LLVM.API.LLVMOpaqueTargetMachine}, ::Ptr{LLVM.API.LLVMOpaqueModule}, ::UInt32, ::Base.RefValue{Cstring}, ::Base.RefValue{Ptr{LLVM.API.LLVMOpaqueMemoryBuffer}}) at /home/ubuntu/.julia/v0.6/LLVM/src/../lib/3.9/libLLVM_h.jl:301\r\n [4] emit(::LLVM.TargetMachine, ::LLVM.Module, ::UInt32) at /home/ubuntu/.julia/v0.6/LLVM/src/targetmachine.jl:42\r\n [5] #mcgen#57(::Bool, ::Function, ::LLVM.Module, ::LLVM.Function, ::VersionNumber) at /home/ubuntu/.julia/v0.6/CUDAnative/src/jit.jl:393\r\n [6] (::CUDAnative.#kw##mcgen)(::Array{Any,1}, ::CUDAnative.#mcgen, ::LLVM.Module, ::LLVM.Function, ::VersionNumber) at ./<missing>:0\r\n [7] #compile_function#58(::Bool, ::Function, ::Any, ::Any, ::VersionNumber) at /home/ubuntu/.julia/v0.6/CUDAnative/src/jit.jl:440\r\n [8] cufunction(::CUDAdrv.CuDevice, ::Any, ::Any) at /home/ubuntu/.julia/v0.6/CUDAnative/src/jit.jl:488\r\n [9] macro expansion at /home/ubuntu/.julia/v0.6/CUDAnative/src/execution.jl:107 [inlined]\r\n [10] _cuda(::Tuple{Int64,Int64}, ::Int64, ::CUDAdrv.CuStream, ::CuArrays.#broadcast_kernel, ::##5#6, ::CUDAnative.CuDeviceArray{Float32,1,CUDAnative.AS.Global}, ::Tuple{Tuple{Bool}}, ::Tuple{Tuple{Int64}}, ::CUDAnative.CuDeviceArray{Float32,1,CUDAnative.AS.Global}, ::Tuple{}) at /home/ubuntu/.julia/v0.6/CUDAnative/src/execution.jl:80\r\n [11] _broadcast! at /home/ubuntu/.julia/v0.6/CuArrays/src/broadcast.jl:22 [inlined]\r\n [12] broadcast_t at /home/ubuntu/.julia/v0.6/CuArrays/src/broadcast.jl:37 [inlined]\r\n [13] broadcast_c at /home/ubuntu/.julia/v0.6/CuArrays/src/broadcast.jl:58 [inlined]\r\n [14] broadcast(::Function, ::CuArray{Float32,1}) at ./broadcast.jl:455\r\n\r\njulia>\r\n```"},"comment":{"url":"https://api.github.com/repos/JuliaGPU/CuArrays.jl/issues/comments/385647122","html_url":"https://github.com/JuliaGPU/CuArrays.jl/issues/76#issuecomment-385647122","issue_url":"https://api.github.com/repos/JuliaGPU/CuArrays.jl/issues/76","id":385647122,"user":{"login":"MikeInnes","id":2234614,"avatar_url":"https://avatars3.githubusercontent.com/u/2234614?v=4","gravatar_id":"","url":"https://api.github.com/users/MikeInnes","html_url":"https://github.com/MikeInnes","followers_url":"https://api.github.com/users/MikeInnes/followers","following_url":"https://api.github.com/users/MikeInnes/following{/other_user}","gists_url":"https://api.github.com/users/MikeInnes/gists{/gist_id}","starred_url":"https://api.github.com/users/MikeInnes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MikeInnes/subscriptions","organizations_url":"https://api.github.com/users/MikeInnes/orgs","repos_url":"https://api.github.com/users/MikeInnes/repos","events_url":"https://api.github.com/users/MikeInnes/events{/privacy}","received_events_url":"https://api.github.com/users/MikeInnes/received_events","type":"User","site_admin":false},"created_at":"2018-05-01T11:02:30Z","updated_at":"2018-05-01T11:02:30Z","author_association":"COLLABORATOR","body":"Yeah, I realise this gives a bad impression and seems like a basic issue, but it's not for want of trying to fix it; it turns out to run pretty deep in the compiler. Future work on the Julia compiler should help us resolve this.\r\n\r\nYou can also try wrapping with the `NNlib.@fix` macro, though I don't know if it supports `^` right now. If not, we can fix that."}}
{"actor":{"display_login":"MikeInnes"}}