taichi.js icon indicating copy to clipboard operation
taichi.js copied to clipboard

Support `for(let i = start; i < begin; i += stride)` in kernels

Open AmesingFlank opened this issue 2 years ago • 0 comments

Taichi.js currently only supports range-for loops:

for(let i of range(n)){
  ...
}

and while-loops:

while(cond){
 ...
}

A top-level range-for loop in a kernel will be parallelised. All while-loops will be serial.

We should also support traditional for loops of the form

for(let i = start; i < begin; i += stride){
...
}

And we should implement them by translating this into a while-loop.

AmesingFlank avatar Apr 22 '22 11:04 AmesingFlank