LoopVectorization.jl icon indicating copy to clipboard operation
LoopVectorization.jl copied to clipboard

Can i use this package with while loop?

Open develooper1994 opened this issue 3 years ago • 2 comments

Can i use this package with while loop?

develooper1994 avatar Jan 30 '22 20:01 develooper1994

Can i use this package with while loop?

No. If it isn't possible to transform the while loop into a for loop, then the loop is probably too complicated for it to understand.

LoopVectorization works by performing different iterations in parallel (using SIMD instructions with @turbo, or SIMD instructions + threading with @tturbo), so it's also important that this is legal. E.g., while loops are often used for iterative algorithms, and these necessarily require you to perform one iteration after the other, rather than in parallel.

chriselrod avatar Jan 30 '22 23:01 chriselrod

There are some numerical methods that i couldn't transform to for loop (fixed iteration). It goes on and on until the condition meets. It will be nice to see any plan to support while (not fixed) iterations.

İdea: Don't parse whole loop body, parse just inside of while loop body and compile to efficient one.

develooper1994 avatar Jan 31 '22 09:01 develooper1994