Loop perforation
Loop perforation is an approximate computing technique that allows to regularly skip some iterations of a loop.[1]
It relies on one parameter: the skip factor. The skip factor can either be interpreted as the number of iteration to skip each time or the number of iterations to perform before skipping one.
Code examples
The examples that follows provide the result of loop perforation applied on this C-like source code
for (int i = 0; i < N; i++) {
// do things
}
Skip n iterations each time
for (int i = 0; i < N; i++) {
// do things
i = i + skip_factor;
}
Skip one iteration after n
int count = 0;
for (int i = 0; i < N; i++) {
if (count == skip_factor) {
count = 0;
} else {
// do things
count ++;
}
}
References
- Mittal, Sparsh (May 2016). "A Survey of Techniques for Approximate Computing". ACM Comput. Surv. ACM. 48 (4): 62:1–62:33. doi:10.1145/2893356.
This article is issued from Wikipedia. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.