Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handing of end in indexing #246

Open
mcabbott opened this issue Apr 20, 2021 · 2 comments
Open

Handing of end in indexing #246

mcabbott opened this issue Apr 20, 2021 · 2 comments

Comments

@mcabbott
Copy link

From mcabbott/Tullio.jl#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
@chriselrod
Copy link
Member

begin would throw that error too.
The expression parser should replace those with firstindex/lastindex.

@chriselrod
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants