Docsity

Data Blocking-Embedded Systems-Lecture 10 Slides-Electrical and Computer Engineering, Slides of Embedded Systems

Toggle sidebar
bg1
1
Embedded Systems
Data Blocking and Coding for
Increased Cache Performance
Dr. Jeff Jackson Lecture 10-1Electrical & Computer Engineering – Embedded Systems
Increased
Cache
Performance
Goals
•The goals of a cache aware optimization technique
should be to:
–
Minimize the stride by which data is accessed from memory
Minimize
the
stride
by
which
data
is
accessed
from
memory
•Stride-1 processing would represent the case where data elements
were accessed from consecutive, sequential memory locations
•Stride-2 processing would represent the case where data elements
were accessed from every other memory location
•Stride minimization is a technique for increasing spatial locality of
reference
–
Access data in a block
-
like fashion
Dr. Jeff Jackson Lecture 10-2Electrical & Computer Engineering – Embedded Systems
Access
data
in
a
block
-
like
fashion
•Blocking (also known as strip mining) is an access technique
whereby data is processed in blocks that fit in the cache
•Accessing data in a blocked fashion is a loose attempt to increase
temporal locality of reference
pf3
pf4
pf5

Partial preview of the text

Download Data Blocking-Embedded Systems-Lecture 10 Slides-Electrical and Computer Engineering and more Slides Embedded Systems in PDF only on Docsity!

Embedded Systems

Data Blocking and Coding for Increased Cache Performance

Electrical & Computer Engineering – Embedded Systems Dr. Jeff Jackson Lecture 10-

Increased Cache Performance

Goals

  • The goals of a cache aware optimization technique should be to: - Minimize the stride by which data is accessed from memoryMinimize the stride by which data is accessed from memory - Stride-1 processing would represent the case where data elements were accessed from consecutive, sequential memory locations - Stride-2 processing would represent the case where data elements were accessed from every other memory location - Stride minimization is a technique for increasing spatial locality of reference - Access data in a block-like fashion

Electrical & Computer Engineering – Embedded Systems Dr. Jeff Jackson Lecture 10-

Access data in a block-like fashion

  • Blocking (also known as strip mining) is an access technique whereby data is processed in blocks that fit in the cache
  • Accessing data in a blocked fashion is a loose attempt to increase temporal locality of reference

Data Blocking

  • The concept of data blocking is simple:
    • process the data in small enough chunks that they fit in the cachethe cache
  • Two reasons for blocking larger arrays
    • If some arrays must be processed with a large stride
    • If the data values are used many times
      • In this case, you want to do as many computations as possible with the data while it is in the cache and before it is flushed out by tl d li

Electrical & Computer Engineering – Embedded Systems Dr. Jeff Jackson Lecture 10-

more recently accessed lines

  • This applies even if everything is stride 1
  • If neither condition is true, there is no point in blocking

Code Examples

  • All stride 1
  • No data re-use
  • No point in blocking

Electrical & Computer Engineering – Embedded Systems Dr. Jeff Jackson Lecture 10-

Code Examples (continued)

  • Unavoidable bad stride
  • Significant data re-use
  • Matrix Multiple (C=AB)

Electrical & Computer Engineering – Embedded Systems Dr. Jeff Jackson Lecture 10-

Basic Data Blocking

  • Goal:
    • Restructure code such that array (matrix) access is such that once a block of data is allocated to the cache it isthat once a block of data is allocated to the cache it is used as much as possible before it is discarded

c a b

Electrical & Computer Engineering – Embedded Systems Dr. Jeff Jackson Lecture 10-

= (^) *

Basic Data Blocking (continued)

  • Goal:
    • Restructure code such that array (matrix) access is such that once a block of data is allocated to the cache it isthat once a block of data is allocated to the cache it is used as much as possible before it is discarded

c a b

Calculate a partial product using a block of data

Electrical & Computer Engineering – Embedded Systems Dr. Jeff Jackson Lecture 10-

= (^) *

Data Blocked Example

Electrical & Computer Engineering – Embedded Systems Dr. Jeff Jackson Lecture 10-