Previous | Next --- Slide 45 of 72
Back to Lecture Thumbnails
kapalani

In this example, the shaded lines are in cache because to compute the red dot we need the cells above below and to the left and right of the red dot. Since each each line holds 4 grid elements, the access to the top element loads the top blue line, the left and right elements both are in the same cache line and one of them loads the middle blue line and the bottom element access loads the last blue line

efang

I sometimes wonder if road major traversal of grids like this is the objectively best way to organize grids and arrays. Are there are organizational methods that have other advantages? Or is row/col traversal objectively superior in every way?

coffee7

@efang I think looking at this slide will help give some idea of other ways to traverse the grid. Ultimately you want to consider your memory access patterns and find the best way to make use of the cache.