-
Notifications
You must be signed in to change notification settings - Fork 72
Closed
Description
Could cospi
and sinpi
function be supported within @avx
?
function f1()
z = cumsum(ones(4))
A = zeros(4)
for i in 1:size(A)[1]
A[i] = cospi(z[i])
end
return A
end
function f1a()
z = cumsum(ones(4))
A = zeros(4)
@avx for i in 1:size(A)[1]
A[i] = cospi(z[i])
end
return A
end
gives
julia> f1()
4-element Array{Float64,1}:
-1.0
1.0
-1.0
1.0
julia> f1a()
ERROR: MethodError: no method matching cospi(::VectorizationBase.SVec{4,Float64})
Closest candidates are:
cospi(::T) where T<:AbstractFloat at special/trig.jl:815
cospi(::Integer) at special/trig.jl:864
cospi(::T) where T<:Union{Integer, Rational} at special/trig.jl:841
...
Stacktrace:
[1] macro expansion at C:\Users\jr\.julia\packages\LoopVectorization\9Qgzg\src\reconstruct_loopset.jl:232 [inlined]
[2] _avx_! at C:\Users\jr\.julia\packages\LoopVectorization\9Qgzg\src\reconstruct_loopset.jl:232 [inlined]
[3] macro expansion at .\gcutils.jl:91 [inlined]
[4] f1a() at .\REPL[35]:4
[5] top-level scope at REPL[37]:1
Sometimes sinpi
can be faster, I wonder if this applies to @avx
using BenchmarkTools
a=10e6*rand(10_000_000);
b=π*a;
@btime sinpi.($a)
@btime sin.($b);
gives
167.324 ms (2 allocations: 76.29 MiB)
322.987 ms (2 allocations: 76.29 MiB)
Metadata
Metadata
Assignees
Labels
No labels