Memory Hierarchy. Announcement. Computer system model. Reference
|
|
- Harriet Neal
- 5 years ago
- Views:
Transcription
1 Announcement Memory Hierarchy Computer Organization and Assembly Languages Yung-Yu Chuang 26//5 Grade for hw#4 is online Please DO submit homework if you haen t Please sign up a demo time on /6 or /7 at the following page Hand in your report to TA at your demo time The length of report depends on your project type. It can be html, pdf, doc, ppt with slides by CMU5-23 Reference Chapter 6 from Computer System: A Programmer s Perspectie Computer system model We assume memory is a linear array which holds both instruction and data, and CPU can access memory in a constant time. data bus registers Central Processor Unit (CPU) Memory Storage Unit I/O Deice # I/O Deice #2 ALU CU clock control bus address bus
2 SRAM s DRAM Tran. Access Needs per bit time refresh? Cost Applications SRAM 4 or 6 X No X cache memories DRAM X Yes X Main memories, frame buffers ns The CPU-Memory gap The gap widens between DRAM, disk, and CPU speeds.,,,,,,,,, Access time (cycles) year register cache - memory 5- Disk seek time DRAM access time SRAM access time CPU cycle time disk 2,, Memory hierarchies Memory system in practice Some fundamental and enduring properties of hardware and software: Fast storage technologies cost more per byte, hae less capacity, and require more power (heat!). The gap between CPU and main memory speed is widening. Well-written programs tend to exhibit good locality. They suggest an approach for organizing memory and storage systems known as a memory hierarchy. Smaller, faster, and more expensie (per byte) storage deices Larger, slower, and cheaper (per byte) storage deices L4: L3: L2: L: registers L: on-chip L cache (SRAM) off-chip L2 cache (SRAM) main memory (DRAM) local secondary storage (local disks) L5: remote secondary storage (tapes, distributed file systems, Web serers)
3 Why it works? Most programs tend to access the storage at any particular leel more frequently than the storage at the lower leel. Locality: tend to access the same set of data items oer and oer again or tend to access sets of nearby data items. Why learn it? A programmer needs to understand this because the memory hierarchy has a big impact on performance. You can optimize your program so that its data is more frequently stored in the higher leel of the hierarchy. For example, the difference of running time for matrix multiplication could up to a factor of 6 een if the same amount of arithmetic instructions are performed. Locality Principle of Locality: programs tend to reuse data and instructions near those they hae used recently, or that were recently referenced themseles. Temporal locality: recently referenced items are likely to be referenced in the near future. Spatial locality: items with nearby addresses tend to be referenced close together in time. In general, programs with good locality run faster then programs with poor locality Locality is the reason why cache and irtual memory are designed in architecture and operating system. Another example is web browser caches recently isited webpages. Locality example sum = ; for (i = ; i < n; i++) sum += a[i]; return sum; Data Reference array elements in succession (stride- reference pattern): Spatial locality Reference sum each iteration: Temporal locality Instructions Reference instructions in sequence: Spatial locality Cycle through loop repeatedly: Temporal locality
4 Locality example Being able to look at code and get a qualitatie sense of its locality is important. Does this function hae good locality? int sum_array_rows(int a[m][n]) { int i, j, sum = ; for (i = ; i < M; i++) for (j = ; j < N; j++) sum += a[i][j]; return sum; stride- reference pattern Locality example Does this function hae good locality? int sum_array_cols(int a[m][n]) { int i, j, sum = ; for (j = ; j < N; j++) for (i = ; i < M; i++) sum += a[i][j]; return sum; stride-n reference pattern Locality example Memory hierarchies typedef struct { float [3]; float a[3]; point ; point p[n]; for (i=; i<n; i++) { for (j=; j<3; j++) { p[i].[j]=; p[i].a[j]=; B for (i=; i<n; i++) { for (j=; j<3; j++) p[i].[j]=; for (j=; j<3; j++) p[i].a[j]=; A for (j=; j<3; j++) { for (i=; i<n; i++) p[i].[j]=; for (i=; i<n; i++) p[i].a[j]=; C Smaller, faster, and more expensie (per byte) storage deices Larger, slower, and cheaper (per byte) storage deices L4: L5: L3: L2: L: registers L: on-chip L cache (SRAM) off-chip L2 cache (SRAM) main memory (DRAM) local secondary storage (local disks) remote secondary storage (tapes, distributed file systems, Web serers)
5 Caches Cache: a smaller, faster storage deice that acts as a sing area for a subset of the data in a larger, slower deice. Fundamental idea of a memory hierarchy: For each k, the faster, smaller deice at leel k seres as a cache for the larger, slower deice at leel k+. Why do memory hierarchies work? Programs tend to access the data at leel k more often than they access the data at leel k+. Thus, the storage at leel k+ can be slower, and thus larger and cheaper per bit. Caching in a memory hierarchy leel k leel k Smaller, faster, more Expensie deice at leel k caches a subset of the blocks from leel k+ Data is copied between leels in block-sized transfer units Larger, slower, cheaper Storage deice at leel k+ is partitioned into blocks. General caching concepts Type of cache misses leel k leel k+ 4 2 Request * * Request * Program needs object d, which is stored in some block b. Cache hit Program finds b in the cache at leel k. E.g., block 4. Cache miss b is not at leel k, so leel k cache must fetch it from leel k+. E.g., block 2. If leel k cache is full, then some current block must be replaced (eicted). Which one is the ictim? Placement policy: where can the new block go? E.g., b mod 4 Replacement policy:which block should be eicted? E.g., LRU Cold (compulsory) miss: occurs because the cache is empty. Capacity miss: occurs when the actie cache blocks (working set) is larger than the cache. Conflict miss Most caches limit blocks at leel k+ to a small subset of the block positions at leel k, e.g. block i at leel k+ must be placed in block (i mod 4) at leel k. Conflict misses occur when the leel k cache is large enough, but multiple data objects all map to the same leel k block, e.g. Referencing blocks, 8,, 8,, 8,... would miss eery time.
6 Cache memories Cache memories are small, fast SRAM-based memories managed automatically in hardware. CPU looks first for data in L, then in L2, then in main memory. Typical system structure: SRAM Port L2 data L cache CPU chip register file bus interface ALU system bus I/O bridge memory bus main memory General organization of a cache Cache is an array of sets. Each set contains one or more lines. Each line holds a block of data. S = 2 s sets bit per line set : set : set S-: t bits per line B = 2 b bytes per B B B B B B Cache size: C = B x E x S data bytes E lines per set Addressing caches Address A: t bits s bits b bits Addressing caches Address A: t bits s bits b bits set : B B m- <> <set index> <block offset> set : B B m- <> <set index> <block offset> set : B B set : B B set S-: B B The word at address A is in the cache if the bits in one of the <> lines in set <set index> match <>. The word contents begin at offset <block offset> bytes from the beginning of the block. set S-: B B. Locate the set based on <set index> 2. Locate the line in the set based on <> 3. Check that the line is 4. Locate the data in the line based on <block offset>
7 Direct-mapped cache Simplest kind of cache, easy to build (only compare required per access) Characterized by exactly one line per set. set : set : set S-: E= lines per set Accessing direct-mapped caches Set selection Use the set index bits to determine the set of interest. selected set set : set : set S-: Cache size: C = B x S data bytes m- t bits s bits b bits set index block offset Accessing direct-mapped caches Line matching and word selection Line matching: Find a line in the selected set with a matching Word selection: Then extract the word =? () The bit must be set selected set (i): w w w 2 w 3 Accessing direct-mapped caches Line matching and word selection Line matching: Find a line in the selected set with a matching Word selection: Then extract the word selected set (i): w w w 2 w 3 (2) The bits in the cache line must =? match the bits in the address t bits m- If () and (2), then cache hit s bits b bits i set index block offset (3) If cache hit, block offset selects starting byte. m- t bits s bits b bits i set index block offset
8 Direct-mapped cache simulation What s wrong with direct-mapped? t= s=2 b= x xx x M=6 byte addresses, B=2 bytes/block, S=4 sets, E= entry/set Address trace (reads): [ 2 ], [ 2 ], 7 [ 2 ], 8 [ 2 ], [ 2 ] data? M[8-9] M[-]? M[6-7] miss hit miss miss miss float dotprod(float x[8], y[8]) { float sum=.; for (int i=; i<8; i++) sum+= x[i]*y[i]; return sum; block size=6 bytes element address set element address set x[] y[] 32 x[] 4 y[] 36 x[2] 8 y[2] 4 x[3] 2 y[3] 44 x[4] 6 y[4] 48 x[5] 2 y[5] 52 x[6] 24 y[6] 56 x[7] 28 y[7] 6 Solution? padding float dotprod(float x[2], y[8]) { float sum=.; for (int i=; i<8; i++) sum+= x[i]*y[i]; return sum; element address set element x[] x[] x[2] x[3] x[4] x[5] x[6] x[7] y[] y[] y[2] y[3] y[4] y[5] y[6] y[7] Address set Set associatie caches Characterized by more than one line per set set : set : set S-: E=2 lines per set E-way associatie cache
9 Accessing set associatie caches Set selection identical to direct-mapped cache set : Accessing set associatie caches Line matching and word selection must compare the in each line in the selected set. =? () The bit must be set selected set set : set S-: t bits s bits b bits m- set index block offset selected set (i): (2) The bits in one of the cache lines must match the bits in the address m w w w 2 w 3 t bits =? If () and (2), then cache hit s bits b bits i set index block offset Accessing set associatie caches 2-Way associatie cache simulation Line matching and word selection Word selection is the same as in a direct mapped cache selected set (i): m w w w 2 w 3 (3) If cache hit, block offset selects starting byte. t bits s bits b bits i set index block offset t=2 s= b= xx x x M=6 byte addresses, B=2 bytes/block, S=2 sets, E=2 entry/set Address trace (reads): [ 2 ], [ 2 ], 7 [ 2 ], 8 [ 2 ], [ 2 ] data? M[-]? M[8-9] M[6-7] miss hit miss miss hit
10 Why use middle bits as index? What about writes? 4-line Cache High-order bit indexing adjacent memory lines would map to same cache entry poor use of spatial locality High-Order Bit Indexing Middle-Order Bit Indexing Multiple copies of data exist: L L2 Main Memory Disk What to do when we write? Write-through Write-back (need a dirty bit) What to do on a replacement? Depends on whether it is write through or write back Multi-leel caches Intel Pentium III cache hierarchy Options: separate data and instruction caches, or a unified cache Processor size: speed: $/Mbyte: line size: Regs 2 B 3 ns L d-cache L i-cache 8-64 KB 3 ns Unified Unified L2 L2 Cache Cache 8 B 32 B 32 B larger, slower, cheaper -4MB SRAM 6 ns $/MB Memory 28 MB DRAM 6 ns $.5/MB 8 KB disk disk 3 GB 8 ms $.5/MB Regs. L Data cycle latency 6 KB 4-way assoc Write-through 32B lines L Instruction 6 KB, 4-way 32B lines Processor Processor Chip Chip L2 L2 Unified 28KB--2 MB MB 4-way 4-way assoc assoc Write-back Write Write allocate 32B 32B lines lines Main Memory Up Up to to 4GB 4GB
11 Writing cache friendly code Repeated references to ariables are good (temporal locality) Stride- reference are good (spatial locality) Examples: cold cache, 4-byte words, 4-word cache blocks int sum_array_rows(int a[4][8]) { int i, j, sum = ; for (i = ; i < M; i++) for (j = ; j < N; j++) sum += a[i][j]; return sum; int sum_array_cols(int a[4][8]) { int i, j, sum = ; for (j = ; j < N; j++) for (i = ; i < M; i++) sum += a[i][j]; return sum; Miss rate = /4 = 25% Miss rate = % The memory mountain Read throughput: number of bytes read from memory per second (MB/s) Memory mountain Measured read throughput as a function of spatial and temporal locality. Compact way to characterize memory system performance. oid test(int elems, int stride) { int i, result = ; olatile int sink; for (i = ; i < elems; i += stride) result += data[i]; /* So compiler doesn't optimize away the loop */ sink = result; The memory mountain Throughput (MB/sec) Slopes of Spatial Locality s s3 s5 s7 Stride (words) s9 s mem s3 xe L2 s5 8m L Pentium III 55 MHz 6 KB on-chip L d-cache 6 KB on-chip L i-cache 52 KB off-chip unified L2 cache 2m 52k 28k 32k 8k Ridges of Temporal Locality Working set size (bytes) 2k Ridges of temporal locality Slice through the memory mountain (stride=) illuminates read throughputs of different caches and memory read througput (MB/s) m main memory region 4m 2m 24k 52k 256k L2 cache region 28k 64k 32k working set size (bytes) 6k 8k L cache region 4k 2k k
12 A slope of spatial locality Slice through memory mountain (size=256kb) read throughput (MB/s) shows size one access per cache line s s2 s3 s4 s5 s6 s7 s8 s9 s s s2 s3 s4 s5 s6 stride (words) Matrix multiplication example Major cache effects to consider Total cache size Exploit temporal locality and keep the working set small (e.g., use blocking) Block size /* /* ijk ijk */ */ Exploit spatial locality for (i=; i<n; i++) { Description: Multiply N x N matrices O(N 3 ) total operations Accesses N reads per source element N alues summed per destination but may be able to hold in register Variable sum held in register for (i=; i<n; i++) { for for (j=; (j=; j<n; j<n; j++) j++) { sum sum =.;.; for for (k=; (k=; k<n; k<n; k++) k++) sum sum += += a[i][k] * b[k][j]; c[i][j] = sum; sum; Miss rate analysis for matrix multiply Matrix multiplication (ijk) Assume: Line size = 32B (big enough for four 64-bit words) Matrix dimension (N) is ery large Approximate /N as. Cache is not een big enough to hold multiple rows Analysis method: Look at access pattern of inner loop i k A k j B i j C /* /* ijk ijk */ */ for for (i=; (i=; i<n; i<n; i++) i++) { for for (j=; (j=; j<n; j<n; j++) j++) { sum sum =.;.; for for (k=; (k=; k<n; k<n; k++) k++) sum sum += += a[i][k] * b[k][j]; c[i][j] = sum; sum; Misses per Inner Loop Iteration:.25.. Inner loop: (*,j) (i,j) (i,*) Row-wise Columnwise Fixed
13 Matrix multiplication (jik) Matrix multiplication (kij) /* /* jik jik */ */ for for (j=; (j=; j<n; j<n; j++) j++) { for for (i=; (i=; i<n; i<n; i++) i++) { sum sum =.;.; for for (k=; (k=; k<n; k<n; k++) k++) sum sum += += a[i][k] * b[k][j]; c[i][j] = sum sum Misses per Inner Loop Iteration:.25.. Inner loop: (*,j) (i,j) (i,*) Row-wise Columnwise Fixed /* /* kij kij */ */ for for (k=; (k=; k<n; k<n; k++) k++) { for for (i=; (i=; i<n; i<n; i++) i++) { r = a[i][k]; for for (j=; (j=; j<n; j<n; j++) j++) c[i][j] += += r * b[k][j]; Misses per Inner Loop Iteration: Inner loop: (i,k) (k,*) (i,*) Fixed Row-wise Row-wise Matrix multiplication (ikj) Matrix multiplication (jki) /* /* ikj ikj */ */ for for (i=; (i=; i<n; i<n; i++) i++) { for for (k=; (k=; k<n; k<n; k++) k++) { r = a[i][k]; for for (j=; (j=; j<n; j<n; j++) j++) c[i][j] += += r * b[k][j]; Misses per Inner Loop Iteration: Inner loop: (i,k) (k,*) (i,*) Fixed Row-wise Row-wise /* /* jki jki */ */ for for (j=; (j=; j<n; j<n; j++) j++) { for for (k=; (k=; k<n; k<n; k++) k++) { r = b[k][j]; for for (i=; (i=; i<n; i<n; i++) i++) c[i][j] += += a[i][k] * r; r; Misses per Inner Loop Iteration:... Inner loop: (*,k) (k,j) (*,j) Column - wise Fixed Columnwise
14 Matrix multiplication (kji) Summary of matrix multiplication /* /* kji kji */ */ for for (k=; (k=; k<n; k<n; k++) k++) { for for (j=; (j=; j<n; j<n; j++) j++) { r = b[k][j]; for for (i=; (i=; i<n; i<n; i++) i++) c[i][j] += += a[i][k] * r; r; Misses per Inner Loop Iteration:... Inner loop: (*,k) (k,j) (*,j) Fixed Columnwise Columnwise for (i=; i<n; i++) { for (j=; j<n; j++) { sum =.; for (k=; k<n; k++) sum += a[i][k] * b[k][j]; c[i][j] = sum; for (k=; k<n; k++) { for (i=; i<n; i++) { r = a[i][k]; for (j=; j<n; j++) c[i][j] += r * b[k][j]; for (j=; j<n; j++) { for (k=; k<n; k++) { r = b[k][j]; for (i=; i<n; i++) c[i][j] += a[i][k] * r; ijk (& jik): 2 loads, stores misses/iter =.25 kij (& ikj): 2 loads, store misses/iter =.5 jki (& kji): 2 loads, store misses/iter = 2. Pentium matrix multiply performance Miss rates are helpful but not perfect predictors. Cycles/iteration 6Code scheduling matters, too kji & jki kij & ikj jik & ijk kji jki kij ikj jik ijk Improing temporal locality by blocking Example: Blocked matrix multiplication Here, block does not mean. Instead, it mean a sub-block within the matrix. Example: N = 8; sub-block size = 4 A A 2 A 2 A 22 X B B 2 B 2 B 22 C = A B + A 2 B 2 C 2 = A B 2 + A 2 B 22 C 2 = A 2 B + A 22 B 2 C 22 = A 2 B 2 + A 22 B 22 = C C 2 C 2 C 22 Key idea: Sub-blocks (i.e., A xy ) can be treated just like scalars Array size (n)
15 Blocked matrix multiply (bijk) for (jj=; jj<n; jj+=bsize) { for (i=; i<n; i++) for (j=jj; j < min(jj+bsize,n); j++) c[i][j] =.; for (kk=; kk<n; kk+=bsize) { for (i=; i<n; i++) { for (j=jj; j < min(jj+bsize,n); j++) { sum =. for (k=kk; k < min(kk+bsize,n); k++) { sum += a[i][k] * b[k][j]; c[i][j] += sum; Blocked matrix multiply analysis Innermost loop pair multiplies a X bsize slier of A by a bsize X bsize block of B and accumulates into X bsize slier of C Loop oer i steps through n row sliers of A & C, using same B Innermost Loop Pair for (i=; i<n; i++) { for (j=jj; j < min(jj+bsize,n); j++) { sum =. for (k=kk; k < min(kk+bsize,n); k++) { sum += a[i][k] * b[k][j]; c[i][j] += sum; kk i kk jj row slier accessed Update successie bsize times block reused n elements of slier times in succession jj i Blocked matrix multiply performance Blocking (bijk and bikj) improes performance by a factor of two oer unblocked ersions (ijk and jik) Cycles/iteration relatiely insensitie to array size Array size (n) kji jki kij ikj jik ijk bijk (bsize = 25) bikj (bsize = 25) Concluding obserations Programmer can optimize for cache performance How data structures are organized How data are accessed Nested loop structure Blocking is a general technique All systems faor cache friendly code Getting absolute optimum performance is ery platform specific Cache sizes, line sizes, associatiities, etc. Can get most of the adane with generic code Keep working set reasonably small (temporal locality) Use small strides (spatial locality)
Cache Memories. Cache Memories Oct. 10, Inserting an L1 Cache Between the CPU and Main Memory. General Org of a Cache Memory
5-23 The course that gies CMU its Zip! Topics Cache Memories Oct., 22! Generic cache memory organization! Direct mapped caches! Set associatie caches! Impact of caches on performance Cache Memories Cache
More informationν Hold frequently accessed blocks of main memory 2 CISC 360, Fa09 Cache is an array of sets. Each set contains one or more lines.
Topics CISC 36 Cache Memories Dec, 29 ν Generic cache memory organization ν Direct mapped caches ν Set associatie caches ν Impact of caches on performance Cache Memories Cache memories are small, fast
More informationCache memories The course that gives CMU its Zip! Cache Memories Oct 11, General organization of a cache memory
5-23 The course that gies CMU its Zip! Cache Memories Oct, 2 Topics Generic cache memory organization Direct mapped caches Set associatie caches Impact of caches on performance Cache memories Cache memories
More informationCISC 360. Cache Memories Nov 25, 2008
CISC 36 Topics Cache Memories Nov 25, 28 Generic cache memory organization Direct mapped caches Set associative caches Impact of caches on performance Cache Memories Cache memories are small, fast SRAM-based
More informationCache Memories October 8, 2007
15-213 Topics Cache Memories October 8, 27 Generic cache memory organization Direct mapped caches Set associative caches Impact of caches on performance The memory mountain class12.ppt Cache Memories Cache
More informationGiving credit where credit is due
CSCE 23J Computer Organization Cache Memories Dr. Steve Goddard goddard@cse.unl.edu http://cse.unl.edu/~goddard/courses/csce23j Giving credit where credit is due Most of slides for this lecture are based
More informationCache Memories. EL2010 Organisasi dan Arsitektur Sistem Komputer Sekolah Teknik Elektro dan Informatika ITB 2010
Cache Memories EL21 Organisasi dan Arsitektur Sistem Komputer Sekolah Teknik Elektro dan Informatika ITB 21 Topics Generic cache memory organization Direct mapped caches Set associative caches Impact of
More informationSystems I. Optimizing for the Memory Hierarchy. Topics Impact of caches on performance Memory hierarchy considerations
Systems I Optimizing for the Memory Hierarchy Topics Impact of caches on performance Memory hierarchy considerations Cache Performance Metrics Miss Rate Fraction of memory references not found in cache
More information211: Computer Architecture Summer 2016
211: Computer Architecture Summer 2016 Liu Liu Topic: Assembly Programming Storage - Assembly Programming: Recap - Call-chain - Factorial - Storage: - RAM - Caching - Direct - Mapping Rutgers University
More informationLast class. Caches. Direct mapped
Memory Hierarchy II Last class Caches Direct mapped E=1 (One cache line per set) Each main memory address can be placed in exactly one place in the cache Conflict misses if two addresses map to same place
More informationCache Memories. Topics. Next time. Generic cache memory organization Direct mapped caches Set associative caches Impact of caches on performance
Cache Memories Topics Generic cache memory organization Direct mapped caches Set associative caches Impact of caches on performance Next time Dynamic memory allocation and memory bugs Fabián E. Bustamante,
More informationMemory Hierarchy. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University
Memory Hierarchy Jin-Soo Kim (jinsookim@skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu Time (ns) The CPU-Memory Gap The gap widens between DRAM, disk, and CPU speeds
More informationThe course that gives CMU its Zip! Memory System Performance. March 22, 2001
15-213 The course that gives CMU its Zip! Memory System Performance March 22, 2001 Topics Impact of cache parameters Impact of memory reference patterns memory mountain range matrix multiply Basic Cache
More informationToday Cache memory organization and operation Performance impact of caches
Cache Memories 1 Today Cache memory organization and operation Performance impact of caches The memory mountain Rearranging loops to improve spatial locality Using blocking to improve temporal locality
More informationCache memories are small, fast SRAM based memories managed automatically in hardware.
Cache Memories Cache memories are small, fast SRAM based memories managed automatically in hardware. Hold frequently accessed blocks of main memory CPU looks first for data in caches (e.g., L1, L2, and
More informationDenison University. Cache Memories. CS-281: Introduction to Computer Systems. Instructor: Thomas C. Bressoud
Cache Memories CS-281: Introduction to Computer Systems Instructor: Thomas C. Bressoud 1 Random-Access Memory (RAM) Key features RAM is traditionally packaged as a chip. Basic storage unit is normally
More informationAgenda Cache memory organization and operation Chapter 6 Performance impact of caches Cache Memories
Agenda Chapter 6 Cache Memories Cache memory organization and operation Performance impact of caches The memory mountain Rearranging loops to improve spatial locality Using blocking to improve temporal
More informationToday. Cache Memories. General Cache Concept. General Cache Organization (S, E, B) Cache Memories. Example Memory Hierarchy Smaller, faster,
Today Cache Memories CSci 2021: Machine Architecture and Organization November 7th-9th, 2016 Your instructor: Stephen McCamant Cache memory organization and operation Performance impact of caches The memory
More informationCache Memories /18-213/15-513: Introduction to Computer Systems 12 th Lecture, October 5, Today s Instructor: Phil Gibbons
Cache Memories 15-213/18-213/15-513: Introduction to Computer Systems 12 th Lecture, October 5, 2017 Today s Instructor: Phil Gibbons 1 Today Cache memory organization and operation Performance impact
More informationMemory Hierarchy. Computer Systems Organization (Spring 2017) CSCI-UA 201, Section 3. Instructor: Joanna Klukowska
Memory Hierarchy Computer Systems Organization (Spring 2017) CSCI-UA 201, Section 3 Instructor: Joanna Klukowska Slides adapted from Randal E. Bryant and David R. O Hallaron (CMU) Mohamed Zahran (NYU)
More informationMemory Hierarchy. Cache Memory Organization and Access. General Cache Concept. Example Memory Hierarchy Smaller, faster,
Memory Hierarchy Computer Systems Organization (Spring 2017) CSCI-UA 201, Section 3 Cache Memory Organization and Access Instructor: Joanna Klukowska Slides adapted from Randal E. Bryant and David R. O
More informationCS 33. Caches. CS33 Intro to Computer Systems XVIII 1 Copyright 2017 Thomas W. Doeppner. All rights reserved.
CS 33 Caches CS33 Intro to Computer Systems XVIII 1 Copyright 2017 Thomas W. Doeppner. All rights reserved. Cache Performance Metrics Miss rate fraction of memory references not found in cache (misses
More informationComputer Organization: A Programmer's Perspective
Computer Architecture and The Memory Hierarchy Oren Kapah orenkapah.ac@gmail.com Typical Computer Architecture CPU chip PC (Program Counter) register file AL U Main Components CPU Main Memory Input/Output
More informationCarnegie Mellon. Cache Memories. Computer Architecture. Instructor: Norbert Lu1enberger. based on the book by Randy Bryant and Dave O Hallaron
Cache Memories Computer Architecture Instructor: Norbert Lu1enberger based on the book by Randy Bryant and Dave O Hallaron 1 Today Cache memory organiza7on and opera7on Performance impact of caches The
More informationCarnegie Mellon. Cache Memories
Cache Memories Thanks to Randal E. Bryant and David R. O Hallaron from CMU Reading Assignment: Computer Systems: A Programmer s Perspec4ve, Third Edi4on, Chapter 6 1 Today Cache memory organiza7on and
More informationCache Memories : Introduc on to Computer Systems 12 th Lecture, October 6th, Instructor: Randy Bryant.
Cache Memories 15-213: Introduc on to Computer Systems 12 th Lecture, October 6th, 2016 Instructor: Randy Bryant 1 Today Cache memory organiza on and opera on Performance impact of caches The memory mountain
More informationLecture 12. Memory Design & Caches, part 2. Christos Kozyrakis Stanford University
Lecture 12 Memory Design & Caches, part 2 Christos Kozyrakis Stanford University http://eeclass.stanford.edu/ee108b 1 Announcements HW3 is due today PA2 is available on-line today Part 1 is due on 2/27
More informationExample. How are these parameters decided?
Example How are these parameters decided? Comparing cache organizations Like many architectural features, caches are evaluated experimentally. As always, performance depends on the actual instruction mix,
More informationCache Memories. Andrew Case. Slides adapted from Jinyang Li, Randy Bryant and Dave O Hallaron
Cache Memories Andrew Case Slides adapted from Jinyang Li, Randy Bryant and Dave O Hallaron 1 Topics Cache memory organiza3on and opera3on Performance impact of caches 2 Cache Memories Cache memories are
More informationLocality. CS429: Computer Organization and Architecture. Locality Example 2. Locality Example
Locality CS429: Computer Organization and Architecture Dr Bill Young Department of Computer Sciences University of Texas at Austin Principle of Locality: Programs tend to reuse data and instructions near
More information+ Random-Access Memory (RAM)
+ Memory Subsystem + Random-Access Memory (RAM) Key features RAM is traditionally packaged as a chip. Basic storage unit is normally a cell (one bit per cell). Multiple RAM chips form a memory. RAM comes
More informationCache Memories. From Bryant and O Hallaron, Computer Systems. A Programmer s Perspective. Chapter 6.
Cache Memories From Bryant and O Hallaron, Computer Systems. A Programmer s Perspective. Chapter 6. Today Cache memory organization and operation Performance impact of caches The memory mountain Rearranging
More informationHigh-Performance Parallel Computing
High-Performance Parallel Computing P. (Saday) Sadayappan Rupesh Nasre Course Overview Emphasis on algorithm development and programming issues for high performance No assumed background in computer architecture;
More informationChapter 6 Caches. Computer System. Alpha Chip Photo. Topics. Memory Hierarchy Locality of Reference SRAM Caches Direct Mapped Associative
Chapter 6 s Topics Memory Hierarchy Locality of Reference SRAM s Direct Mapped Associative Computer System Processor interrupt On-chip cache s s Memory-I/O bus bus Net cache Row cache Disk cache Memory
More informationLecture 15: Caches and Optimization Computer Architecture and Systems Programming ( )
Systems Group Department of Computer Science ETH Zürich Lecture 15: Caches and Optimization Computer Architecture and Systems Programming (252-0061-00) Timothy Roscoe Herbstsemester 2012 Last time Program
More informationCSCI-UA.0201 Computer Systems Organization Memory Hierarchy
CSCI-UA.0201 Computer Systems Organization Memory Hierarchy Mohamed Zahran (aka Z) mzahran@cs.nyu.edu http://www.mzahran.com Programmer s Wish List Memory Private Infinitely large Infinitely fast Non-volatile
More informationRoadmap. Java: Assembly language: OS: Machine code: Computer system:
Roadmap C: car *c = malloc(sizeof(car)); c->miles = 100; c->gals = 17; float mpg = get_mpg(c); free(c); Assembly language: Machine code: get_mpg: pushq movq... popq ret %rbp %rsp, %rbp %rbp 0111010000011000
More informationMemory hierarchies: caches and their impact on the running time
Memory hierarchies: caches and their impact on the running time Irene Finocchi Dept. of Computer and Science Sapienza University of Rome A happy coincidence A fundamental property of hardware Different
More informationMemory Hierarchy. Instructor: Adam C. Champion, Ph.D. CSE 2431: Introduction to Operating Systems Reading: Chap. 6, [CSAPP]
Memory Hierarchy Instructor: Adam C. Champion, Ph.D. CSE 2431: Introduction to Operating Systems Reading: Chap. 6, [CSAPP] Motivation Up to this point we have relied on a simple model of a computer system
More informationCache memories are small, fast SRAM-based memories managed automatically in hardware. Hold frequently accessed blocks of main memory
Cache Memories Cache memories are small, fast SRAM-based memories managed automatically in hardware. Hold frequently accessed blocks of main memory CPU looks first for data in caches (e.g., L1, L2, and
More informationSystems Programming and Computer Architecture ( ) Timothy Roscoe
Systems Group Department of Computer Science ETH Zürich Systems Programming and Computer Architecture (252-0061-00) Timothy Roscoe Herbstsemester 2016 AS 2016 Caches 1 16: Caches Computer Architecture
More informationProblem: Processor Memory BoJleneck
Today Memory hierarchy, caches, locality Cache organiza:on Program op:miza:ons that consider caches CSE351 Inaugural Edi:on Spring 2010 1 Problem: Processor Memory BoJleneck Processor performance doubled
More informationCS 240 Stage 3 Abstractions for Practical Systems
CS 240 Stage 3 Abstractions for Practical Systems Caching and the memory hierarchy Operating systems and the process model Virtual memory Dynamic memory allocation Victory lap Memory Hierarchy: Cache Memory
More informationProblem: Processor- Memory Bo<leneck
Storage Hierarchy Instructor: Sanjeev Se(a 1 Problem: Processor- Bo
More informationRead-only memory (ROM): programmed during production Programmable ROM (PROM): can be programmed once SRAM (Static RAM)
Memory Hierarchy Computer Systems Organization (Spring 2017) CSCI-UA 201, Section 3 Storage: Memory and Disk (and other I/O Devices) Instructor: Joanna Klukowska Slides adapted from Randal E. Bryant and
More informationCS3350B Computer Architecture
CS3350B Computer Architecture Winter 2015 Lecture 3.1: Memory Hierarchy: What and Why? Marc Moreno Maza www.csd.uwo.ca/courses/cs3350b [Adapted from lectures on Computer Organization and Design, Patterson
More informationF28HS Hardware-Software Interface: Systems Programming
F28HS Hardware-Software Interface: Systems Programming Hans-Wolfgang Loidl School of Mathematical and Computer Sciences, Heriot-Watt University, Edinburgh Semester 2 2016/17 0 No proprietary software has
More informationCache Memories. Lecture, Oct. 30, Bryant and O Hallaron, Computer Systems: A Programmer s Perspective, Third Edition
Cache Memories Lecture, Oct. 30, 2018 1 General Cache Concept Cache 84 9 14 10 3 Smaller, faster, more expensive memory caches a subset of the blocks 10 4 Data is copied in block-sized transfer units Memory
More informationCaches Spring 2016 May 4: Caches 1
May 4: Caches 1 Roadmap C: car *c = malloc(sizeof(car)); c->miles = 100; c->gals = 17; float mpg = get_mpg(c); free(c); Assembly language: Machine code: Computer system: get_mpg: pushq movq... popq ret
More informationSE-292 High Performance Computing. Memory Hierarchy. R. Govindarajan Memory Hierarchy
SE-292 High Performance Computing Memory Hierarchy R. Govindarajan govind@serc Memory Hierarchy 2 1 Memory Organization Memory hierarchy CPU registers few in number (typically 16/32/128) subcycle access
More informationCMSC 313 COMPUTER ORGANIZATION & ASSEMBLY LANGUAGE PROGRAMMING LECTURE 26, SPRING 2013
CMSC 313 COMPUTER ORGANIZATION & ASSEMBLY LANGUAGE PROGRAMMING LECTURE 26, SPRING 2013 TOPICS TODAY End of the Semester Stuff Homework 5 Memory Hierarchy Storage Technologies (RAM & Disk) Caching END OF
More informationCMSC 313 COMPUTER ORGANIZATION & ASSEMBLY LANGUAGE PROGRAMMING LECTURE 26, FALL 2012
CMSC 313 COMPUTER ORGANIZATION & ASSEMBLY LANGUAGE PROGRAMMING LECTURE 26, FALL 2012 TOPICS TODAY Homework 5 RAM in Circuits Memory Hierarchy Storage Technologies (RAM & Disk) Caching HOMEWORK 5 RAM IN
More informationCS241 Computer Organization Spring Principle of Locality
CS241 Computer Organization Spring 2015 Principle of Locality 4-21 2015 Outline! Optimization! Memory Hierarchy Locality temporal spatial Cache Readings: CSAPP2: Chapter 5, sections 5.1-5.6; 5.13 CSAPP2:
More informationComputer Systems CSE 410 Autumn Memory Organiza:on and Caches
Computer Systems CSE 410 Autumn 2013 10 Memory Organiza:on and Caches 06 April 2012 Memory Organiza?on 1 Roadmap C: car *c = malloc(sizeof(car)); c->miles = 100; c->gals = 17; float mpg = get_mpg(c); free(c);
More informationCS 33. Architecture and Optimization (3) CS33 Intro to Computer Systems XVI 1 Copyright 2018 Thomas W. Doeppner. All rights reserved.
CS 33 Architecture and Optimization (3) CS33 Intro to Computer Systems XVI 1 Copyright 2018 Thomas W. Doeppner. All rights reserved. Hyper Threading Instruction Control Instruction Control Retirement Unit
More informationComputer Systems. Memory Hierarchy. Han, Hwansoo
Computer Systems Memory Hierarchy Han, Hwansoo Random-Access Memory (RAM) Key features RAM is traditionally packaged as a chip. Basic storage unit is normally a cell (one bit per cell). Multiple RAM chips
More informationComputer Organization: A Programmer's Perspective
A Programmer's Perspective Computer Architecture and The Memory Hierarchy Gal A. Kaminka galk@cs.biu.ac.il Typical Computer Architecture CPU chip PC (Program Counter) register file ALU Main Components
More informationCS356: Discussion #9 Memory Hierarchy and Caches. Marco Paolieri Illustrations from CS:APP3e textbook
CS356: Discussion #9 Memory Hierarchy and Caches Marco Paolieri (paolieri@usc.edu) Illustrations from CS:APP3e textbook The Memory Hierarchy So far... We modeled the memory system as an abstract array
More informationCMPSC 311- Introduction to Systems Programming Module: Caching
CMPSC 311- Introduction to Systems Programming Module: Caching Professor Patrick McDaniel Fall 2016 Reminder: Memory Hierarchy L0: Registers CPU registers hold words retrieved from L1 cache Smaller, faster,
More informationHow to Write Fast Numerical Code
How to Write Fast Numerical Code Lecture: Memory hierarchy, locality, caches Instructor: Markus Püschel TA: Daniele Spampinato & Alen Stojanov Left alignment Attractive font (sans serif, avoid Arial) Calibri,
More informationComputer Architecture and System Software Lecture 09: Memory Hierarchy. Instructor: Rob Bergen Applied Computer Science University of Winnipeg
Computer Architecture and System Software Lecture 09: Memory Hierarchy Instructor: Rob Bergen Applied Computer Science University of Winnipeg Announcements Midterm returned + solutions in class today SSD
More informationGiving credit where credit is due
CSCE 230J Computer Organization The Memory Hierarchy Dr. Steve Goddard goddard@cse.unl.edu http://cse.unl.edu/~goddard/courses/csce230j Giving credit where credit is due Most of slides for this lecture
More informationAdvanced Architecture
Advanced Architecture Computer Organization and Assembly Languages g Yung-Yu Chuang with slides by S. Dandamudi, Peng-Sheng Chen, Kip Irvine, Robert Sedgwick and Kevin Wayne Basic architecture Basic microcomputer
More informationEE108B Lecture 13. Caches Wrap Up Processes, Interrupts, and Exceptions. Christos Kozyrakis Stanford University
EE108B Lecture 13 Caches Wrap Up Processes, Interrupts, and Exceptions Christos Kozyrakis Stanford University http://eeclass.stanford.edu/ee108b 1 Announcements Lab3 and PA2.1 are due ton 2/27 Don t forget
More informationCISC 360. The Memory Hierarchy Nov 13, 2008
CISC 360 The Memory Hierarchy Nov 13, 2008 Topics Storage technologies and trends Locality of reference Caching in the memory hierarchy class12.ppt Random-Access Memory (RAM) Key features RAM is packaged
More informationGeneral Cache Mechanics. Memory Hierarchy: Cache. Cache Hit. Cache Miss CPU. Cache. Memory CPU CPU. Cache. Cache. Memory. Memory
Hierarchy: hierarchy basics Locality organization -aware programming General Mechanics CP 8 9 4 Data is moved in units 4 5 6 7 8 9 4 5 Block: unit of data in cache and memory. (a.k.a. line) Smaller, faster,
More informationCISC 360. Cache Memories Exercises Dec 3, 2009
Topics ν CISC 36 Cache Memories Exercises Dec 3, 29 Review of cache memory mapping Cache Memories Cache memories are small, fast SRAM-based memories managed automatically in hardware. ν Hold frequently
More informationwrite-through v. write-back write-through v. write-back write-through v. write-back option 1: write-through write 10 to 0xABCD CPU RAM Cache ABCD: FF
write-through v. write-back option 1: write-through 1 write 10 to 0xABCD CPU Cache ABCD: FF RAM 11CD: 42 ABCD: FF 1 2 write-through v. write-back option 1: write-through write-through v. write-back option
More informationCache Performance II 1
Cache Performance II 1 cache operation (associative) 111001 index offset valid tag valid tag data data 1 10 1 00 00 11 AA BB tag 1 11 1 01 B4 B5 33 44 = data (B5) AND = AND OR is hit? (1) 2 cache operation
More informationAnnouncements. EE108B Lecture 13. Caches Wrap Up Processes, Interrupts, and Exceptions. Measuring Performance. Memory Performance
Announcements EE18B Lecture 13 Caches Wrap Up Processes, Interrupts, and Exceptions Lab3 and PA2.1 are due ton 2/27 Don t forget to study the textbook Don t forget the review sessions Christos Kozyrakis
More informationRandom-Access Memory (RAM) Systemprogrammering 2007 Föreläsning 4 Virtual Memory. Locality. The CPU-Memory Gap. Topics
Systemprogrammering 27 Föreläsning 4 Topics The memory hierarchy Motivations for VM Address translation Accelerating translation with TLBs Random-Access (RAM) Key features RAM is packaged as a chip. Basic
More informationHow to Write Fast Numerical Code
How to Write Fast Numerical Code Lecture: Memory hierarchy, locality, caches Instructor: Markus Püschel TA: Alen Stojanov, Georg Ofenbeck, Gagandeep Singh Organization Temporal and spatial locality Memory
More informationRandom-Access Memory (RAM) Systemprogrammering 2009 Föreläsning 4 Virtual Memory. Locality. The CPU-Memory Gap. Topics! The memory hierarchy
Systemprogrammering 29 Föreläsning 4 Topics! The memory hierarchy! Motivations for VM! Address translation! Accelerating translation with TLBs Random-Access (RAM) Key features! RAM is packaged as a chip.!
More informationCMPSC 311- Introduction to Systems Programming Module: Caching
CMPSC 311- Introduction to Systems Programming Module: Caching Professor Patrick McDaniel Fall 2014 Lecture notes Get caching information form other lecture http://hssl.cs.jhu.edu/~randal/419/lectures/l8.5.caching.pdf
More informationRandom-Access Memory (RAM) CISC 360. The Memory Hierarchy Nov 24, Conventional DRAM Organization. SRAM vs DRAM Summary.
CISC 36 Random-ccess Memory (RM) The Memory Hierarchy Nov 24, 29 class12.ppt 2 CISC 36 Fa9 SRM vs DRM Summary Conventional DRM Organization Tran. ccess per bit time Persist?Sensitive? Cost pplications
More informationComputer Organization - Overview
Computer Organization - Overview Hyunyoung Lee CSCE 312 1 Course Overview Topics: Theme Five great realities of computer systems Computer system overview Summary NOTE: Most slides are from the textbook
More informationAdvanced Memory Organizations
CSE 3421: Introduction to Computer Architecture Advanced Memory Organizations Study: 5.1, 5.2, 5.3, 5.4 (only parts) Gojko Babić 03-29-2018 1 Growth in Performance of DRAM & CPU Huge mismatch between CPU
More information211: Computer Architecture Summer 2016
211: Computer Architecture Summer 2016 Liu Liu Topic: Storage Project3 Digital Logic - Storage: Recap - Direct - Mapping - Fully Associated - 2-way Associated - Cache Friendly Code Rutgers University Liu
More informationCS 61C: Great Ideas in Computer Architecture. Direct Mapped Caches
CS 61C: Great Ideas in Computer Architecture Direct Mapped Caches Instructor: Justin Hsia 7/05/2012 Summer 2012 Lecture #11 1 Review of Last Lecture Floating point (single and double precision) approximates
More informationRoadmap. Java: Assembly language: OS: Machine code: Computer system:
Roadmap C: car *c = malloc(sizeof(car)); c->miles = 100; c->gals = 17; float mpg = get_mpg(c); free(c); Assembly language: Machine code: get_mpg: pushq movq... popq ret %rbp %rsp, %rbp %rbp 0111010000011000
More informationMemory Management! Goals of this Lecture!
Memory Management! Goals of this Lecture! Help you learn about:" The memory hierarchy" Why it works: locality of reference" Caching, at multiple levels" Virtual memory" and thereby " How the hardware and
More informationKey features. ! RAM is packaged as a chip.! Basic storage unit is a cell (one bit per cell).! Multiple RAM chips form a memory.
class12.ppt 15-213 The course that gives CMU its Zip! The Memory Hierarchy Oct. 3, 22 Topics! Storage technologies and trends! Locality of reference! Caching in the hierarchy Random-ccess Memory (RM) Key
More informationThe Memory Hierarchy /18-213/15-513: Introduction to Computer Systems 11 th Lecture, October 3, Today s Instructor: Phil Gibbons
The Memory Hierarchy 15-213/18-213/15-513: Introduction to Computer Systems 11 th Lecture, October 3, 2017 Today s Instructor: Phil Gibbons 1 Today Storage technologies and trends Locality of reference
More informationTypes of Cache Misses. The Hardware/So<ware Interface CSE351 Winter Cache Read. General Cache OrganizaJon (S, E, B) Memory and Caches II
Types of Cache Misses The Hardware/So
More informationCSCI 402: Computer Architectures. Performance of Multilevel Cache
CSCI 402: Computer Architectures Memory Hierarchy (5) Fengguang Song Department of Computer & Information Science IUPUI Performance of Multilevel Cache Main Memory CPU L1 cache L2 cache Given CPU base
More informationThe Memory Hierarchy Sept 29, 2006
15-213 The Memory Hierarchy Sept 29, 2006 Topics Storage technologies and trends Locality of reference Caching in the memory hierarchy class10.ppt Random-Access Memory (RAM) Key features RAM is traditionally
More informationCaches Concepts Review
Caches Concepts Review What is a block address? Why not bring just what is needed by the processor? What is a set associative cache? Write-through? Write-back? Then we ll see: Block allocation policy on
More informationLecture 17: Memory Hierarchy and Cache Coherence Concurrent and Mul7core Programming
Lecture 17: Memory Hierarchy and Cache Coherence Concurrent and Mul7core Programming Department of Computer Science and Engineering Yonghong Yan yan@oakland.edu www.secs.oakland.edu/~yan 1 Parallelism
More informationDonn Morrison Department of Computer Science. TDT4255 Memory hierarchies
TDT4255 Lecture 10: Memory hierarchies Donn Morrison Department of Computer Science 2 Outline Chapter 5 - Memory hierarchies (5.1-5.5) Temporal and spacial locality Hits and misses Direct-mapped, set associative,
More informationRandom-Access Memory (RAM) Lecture 13 The Memory Hierarchy. Conventional DRAM Organization. SRAM vs DRAM Summary. Topics. d x w DRAM: Key features
Random-ccess Memory (RM) Lecture 13 The Memory Hierarchy Topics Storage technologies and trends Locality of reference Caching in the hierarchy Key features RM is packaged as a chip. Basic storage unit
More informationCaches II CSE 351 Spring #include <yoda.h> int is_try(int do_flag) { return!(do_flag!do_flag); }
Caches II CSE 351 Spring 2018 #include int is_try(int do_flag) { return!(do_flag!do_flag); } Memory Hierarchies Some fundamental and enduring properties of hardware and software systems: Faster
More informationMemory Management. Goals of this Lecture. Motivation for Memory Hierarchy
Memory Management Goals of this Lecture Help you learn about: The memory hierarchy Spatial and temporal locality of reference Caching, at multiple levels Virtual memory and thereby How the hardware and
More informationCS24: INTRODUCTION TO COMPUTING SYSTEMS. Spring 2014 Lecture 14
CS24: INTRODUCTION TO COMPUTING SYSTEMS Spring 2014 Lecture 14 LAST TIME! Examined several memory technologies: SRAM volatile memory cells built from transistors! Fast to use, larger memory cells (6+ transistors
More informationRandom Access Memory (RAM)
Random Access Memory (RAM) Key features RAM is traditionally packaged as a chip. Basic storage unit is normally a cell (one bit per cell). Multiple RAM chips form a memory. Static RAM (SRAM) Each cell
More informationMemory Hierarchy. Reading. Sections 5.1, 5.2, 5.3, 5.4, 5.8 (some elements), 5.9 (2) Lecture notes from MKP, H. H. Lee and S.
Memory Hierarchy Lecture notes from MKP, H. H. Lee and S. Yalamanchili Sections 5.1, 5.2, 5.3, 5.4, 5.8 (some elements), 5.9 Reading (2) 1 SRAM: Value is stored on a pair of inerting gates Very fast but
More informationMemory Management! How the hardware and OS give application pgms:" The illusion of a large contiguous address space" Protection against each other"
Memory Management! Goals of this Lecture! Help you learn about:" The memory hierarchy" Spatial and temporal locality of reference" Caching, at multiple levels" Virtual memory" and thereby " How the hardware
More informationIntroduction to Computer Systems
CSCE 230J Computer Organization Introduction to Computer Systems Dr. Steve Goddard goddard@cse.unl.edu http://cse.unl.edu/~goddard/courses/csce230j Giving credit where credit is due Most of slides for
More informationIntroduction to Computer Systems
CSCE 230J Computer Organization Introduction to Computer Systems Dr. Steve Goddard goddard@cse.unl.edu Giving credit where credit is due Most of slides for this lecture are based on slides created by Drs.
More informationCS 201 The Memory Hierarchy. Gerson Robboy Portland State University
CS 201 The Memory Hierarchy Gerson Robboy Portland State University memory hierarchy overview (traditional) CPU registers main memory (RAM) secondary memory (DISK) why? what is different between these
More information