LoopVectorization.jl
LoopVectorization.jl copied to clipboard
Handing of `end` in indexing
From https://github.com/mcabbott/Tullio.jl/issues/97, this gives an error:
function col!(out, A)
@avx for i in 1:3
out[i, end] = 10 * A[i]
out[i, begin] = 100 * A[i]
end
out
end
col!(rand(3,3), collect(1:3)) # UndefVarError: end not defined
begin would throw that error too.
The expression parser should replace those with firstindex/lastindex.
Trying to decide the best way to handle this.
LoopVectorization's parsing currently doesn't keep track of the index with respect to the parent array, but with respect to the stridedpointer while it parses.
The problem with that is that it'll drop dimensions from the pointer by taking views, so that to be correct with multiple constant indices, e.g. A[i,begin,end], it'll have to start tracking both.
That's probably the best option.