Skip to content

Instantly share code, notes, and snippets.

@navyxliu
Created January 5, 2026 19:55
Show Gist options
  • Select an option

  • Save navyxliu/548369dc17d983c32be770ef7947d89c to your computer and use it in GitHub Desktop.

Select an option

Save navyxliu/548369dc17d983c32be770ef7947d89c to your computer and use it in GitHub Desktop.
In SIMD programming, we express loops like pac-man.

In each loop iteration, the induction variable x increases BITE.

for (int x = 0; x < xsize; x+=BITE) {
   size_t x_size = min(xsize-x, BITE); 
   ...
}

It's just SIMD style programming. We want to use SIMD engine, but there are always remainder that is not aligned with VLEN.

'BITE' could be a variant. It means that it's configureable for VLEN.

The code style is branchless. variable 'x' is state how many data has been processed. x_size is the data we need to process.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment