Previous | Next --- Slide 19 of 63
Back to Lecture Thumbnails
cassiez

The two-pass 3x3 blur is only possibly an improvement to the original straight-forward approach (for each element, average 8 surrounding pixels, without using a tmp buffer) if the original approach is compute bound. Since the two-pass blur in this slide has lower arithmetic intensity than the original approach, if the original approach is already memory bandwidth bound, the performance of the two-pass approach will be worse than original.

juliewang

As mentioned in class, this two pass 3x3 blur reduces the arithmetic intensity of the program at the benefit of doing fewer operations overall. you would only want to use this implementation if the original program was compute bound, if the original program was memory bound, you wouldn't want to switch to this algorithm.

yarrow2

For those deep learning folks, this reminds me a lot of Mobilenet's usage of depth wise separable convolutions to reduce the arithmetic intensity of a vision model.

qwerty

If the original program was compute bound, you've reduced the total number of math operations, which means you're less reliant on compute now. The total amount of work done per output pixel has been reduced from N^2 to 2N. So this modification is good. However, you have added more memory usage. Before, you were just reading the input once and writing the output once. Here, you are reading the input , writing to tmp (memory), and reading all that data back from memory. So if you are bandwidth bound, this modification would make things worse.

jasonalouda

Does the implementation of blur that is used switch depending not the device you’re on, i.e. whether it is compute bound or bandwidth bound?

ammaar

@jasonalouda this is a question that I think I find myself asking often when thinking of issues of compute-bound and memory-bound programs. I think that the programmer would have to reason about which device the blur would be used on, such as a mobile phone which may be memory-bound. More insight into this would be helpful.

Please log in to leave a comment.