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

Errors with certain simple for loop #483

Open
junyuan-chen opened this issue Apr 5, 2023 · 2 comments
Open

Errors with certain simple for loop #483

junyuan-chen opened this issue Apr 5, 2023 · 2 comments

Comments

@junyuan-chen
Copy link

Depending on how the index ranges are specified, there are a few cases in which I get unexpected errors.

For example, I am getting errors on something like this:

using LoopVectorization
a = zeros(3,2)
N = 2
@turbo thread=true for i in 1:1, j in 1:N
    a[i,j] += 1.0
end
ERROR: MethodError: no method matching vmul_nw(::Int64)

The following also errors:

v = zeros(3)
N1 = 1
N2 = 3
@turbo thread=true for i in 1:N2, j in 1:N1
    v[i,j] += 1.0
end
ERROR: BoundsError: attempt to access 1-element Vector{Any} at index [2]
chriselrod added a commit that referenced this issue Apr 5, 2023
@chriselrod
Copy link
Member

The second case is tricker. The ideal behavior is that LV would figure out that N1 has to be <=1, and throw an error otherwise. Currently, throwing some error always probably isn't so bad.

I fixed the first case, and added it to the tests: ded74ba

@junyuan-chen
Copy link
Author

@chriselrod Thank you so much for the fast response.

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