Trying to replicate Tim Besard’s (@maleadt) example from his talk from 2019 ‘Just compile it’.
using DualNumbers
f(x) = 3x^2 + 5x + 2
wrt(x) = Dual(x, typeof(x)(1))
a =
a = wrt.(a)
f.(2 .* a .- 3)
works when:
a = [1., 2., 3.]
3-element Vector{Dual128}:
0.0 - 2.0ɛ
10.0 + 22.0ɛ
44.0 + 46.0ɛ
doesn’t work when:
a = CuArray([1., 2., 3.]) # as in example for GPU
ERROR: LLVM error: Cannot select: 0x9960600: f64 = fpow 0x9960738, 0x9960870, math.jl:920 @[ /home/gil/.julia/packages/DualNumbers/OVRBb/src/dual.jl:272 ]
0x9960738: f64,ch = CopyFromReg 0x98e34f8, Register:f64 %0, math.jl:920 @[ /home/gil/.julia/packages/DualNumbers/OVRBb/src/dual.jl:272 ]
0x9960328: f64 = Register %0
0x9960870: f64 = sint_to_fp 0x99608d8, float.jl:94 @[ math.jl:920 @[ /home/gil/.julia/packages/DualNumbers/OVRBb/src/dual.jl:272 ] ]
0x99608d8: i64,ch = CopyFromReg 0x98e34f8, Register:i64 %15, float.jl:94 @[ math.jl:920 @[ /home/gil/.julia/packages/DualNumbers/OVRBb/src/dual.jl:272 ] ]
0x99600b8: i64 = Register %15
In function: julia_pow_7852
Thanks.