LoopVectorization.jl
LoopVectorization.jl copied to clipboard
Broadcast bug
trafficstars
julia> xs = [1.9, 1.0]
2-element Array{Float64,1}:
1.0
1.0
julia> max_ = maximum(xs, dims=1)
1-element Array{Float64,1}:
1.0
julia> exp_ = @avx exp.(xs .- max_)
2-element Array{Float64,1}:
1.0
2.7182818284590455
The problem here is that broadcasting doesn't support broadcasting the first dimension yet when it isn't known that size(src,1) == 1 at compile time.
I'm not sure what the best way to support that is.
As a workaround, on master you can:
xs = rand(T, M);
max_ = maximum(xs, dims=1)
@test (@avx exp.(xs .- LowDimArray{(false,)}(max_))) ≈ exp.(xs .- LowDimArray{(false,)}(max_))