Lecture 19: Memory Hierarchy Five Ways to Reduce Miss Penalty (Second Level Cache) Admin

Similar documents
Improving Cache Performance. Dr. Yitzhak Birk Electrical Engineering Department, Technion

Memory Hierarchy 3 Cs and 6 Ways to Reduce Misses

Types of Cache Misses: The Three C s

Classification Steady-State Cache Misses: Techniques To Improve Cache Performance:

Lecture 9: Improving Cache Performance: Reduce miss rate Reduce miss penalty Reduce hit time

Reducing Miss Penalty: Read Priority over Write on Miss. Improving Cache Performance. Non-blocking Caches to reduce stalls on misses

Lecture 7: Memory Hierarchy 3 Cs and 7 Ways to Reduce Misses Professor David A. Patterson Computer Science 252 Fall 1996

CS 152 Computer Architecture and Engineering. Lecture 8 - Memory Hierarchy-III

Improving Cache Performance. Reducing Misses. How To Reduce Misses? 3Cs Absolute Miss Rate. 1. Reduce the miss rate, Classifying Misses: 3 Cs

Chapter-5 Memory Hierarchy Design

Cache Performance! ! Memory system and processor performance:! ! Improving memory hierarchy performance:! CPU time = IC x CPI x Clock time

Cache Performance! ! Memory system and processor performance:! ! Improving memory hierarchy performance:! CPU time = IC x CPI x Clock time

Cache performance Outline

CS 152 Computer Architecture and Engineering. Lecture 8 - Memory Hierarchy-III

Lecture 18: Memory Hierarchy Main Memory and Enhancing its Performance Professor Randy H. Katz Computer Science 252 Spring 1996

Some material adapted from Mohamed Younis, UMBC CMSC 611 Spr 2003 course slides Some material adapted from Hennessy & Patterson / 2003 Elsevier

CS 152 Computer Architecture and Engineering. Lecture 8 - Memory Hierarchy-III

Lecture 20: Memory Hierarchy Main Memory and Enhancing its Performance. Grinch-Like Stuff

CISC 662 Graduate Computer Architecture Lecture 18 - Cache Performance. Why More on Memory Hierarchy?

NOW Handout Page # Why More on Memory Hierarchy? CISC 662 Graduate Computer Architecture Lecture 18 - Cache Performance

Virtual memory why? Virtual memory parameters Compared to first-level cache Parameter First-level cache Virtual memory. Virtual memory concepts

Recap: The Big Picture: Where are We Now? The Five Classic Components of a Computer. CS152 Computer Architecture and Engineering Lecture 20.

Lec 11 How to improve cache performance

Page 1. Review: Who Cares About the Memory Hierarchy? Review: Cache performance. Review: Reducing Misses. Review: Miss Rate Reduction

Lecture 16: Memory Hierarchy Misses, 3 Cs and 7 Ways to Reduce Misses. Professor Randy H. Katz Computer Science 252 Fall 1995

Outline. 1 Reiteration. 2 Cache performance optimization. 3 Bandwidth increase. 4 Reduce hit time. 5 Reduce miss penalty. 6 Reduce miss rate

COSC 6385 Computer Architecture. - Memory Hierarchies (II)

EITF20: Computer Architecture Part4.1.1: Cache - 2

Memory Hierarchy Design. Chapter 5

DECstation 5000 Miss Rates. Cache Performance Measures. Example. Cache Performance Improvements. Types of Cache Misses. Cache Performance Equations

Lecture 11. Virtual Memory Review: Memory Hierarchy

Lecture 16: Memory Hierarchy Misses, 3 Cs and 7 Ways to Reduce Misses Professor Randy H. Katz Computer Science 252 Spring 1996

Memory Hierarchy Computing Systems & Performance MSc Informatics Eng. Memory Hierarchy (most slides are borrowed)

Lecture-18 (Cache Optimizations) CS422-Spring

Memory Hierarchy Computing Systems & Performance MSc Informatics Eng. Memory Hierarchy (most slides are borrowed)

CMSC 611: Advanced Computer Architecture. Cache and Memory

Lecture 11 Reducing Cache Misses. Computer Architectures S

EITF20: Computer Architecture Part 5.1.1: Virtual Memory

Memory Hierarchy Basics. Ten Advanced Optimizations. Small and Simple

LRU. Pseudo LRU A B C D E F G H A B C D E F G H H H C. Copyright 2012, Elsevier Inc. All rights reserved.

L2 cache provides additional on-chip caching space. L2 cache captures misses from L1 cache. Summary

CPE 631 Lecture 06: Cache Design

Aleksandar Milenkovich 1

EITF20: Computer Architecture Part4.1.1: Cache - 2

CSE 502 Graduate Computer Architecture. Lec Advanced Memory Hierarchy

Memory Hierarchy Basics

Memory Hierarchies 2009 DAT105

Lecture 9: Case Study MIPS R4000 and Introduction to Advanced Pipelining Professor Randy H. Katz Computer Science 252 Spring 1996

COSC 6385 Computer Architecture - Memory Hierarchy Design (III)

CSE 502 Graduate Computer Architecture. Lec Advanced Memory Hierarchy and Application Tuning

Advanced Caching Techniques (2) Department of Electrical Engineering Stanford University

Caching Basics. Memory Hierarchies

Advanced Caching Techniques

CS 152 Computer Architecture and Engineering

Topics. Digital Systems Architecture EECE EECE Need More Cache?

Announcements. ! Previous lecture. Caches. Inf3 Computer Architecture

A Cache Hierarchy in a Computer System

TDT Coarse-Grained Multithreading. Review on ILP. Multi-threaded execution. Contents. Fine-Grained Multithreading

High Performance Computer Architecture Prof. Ajit Pal Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur

LECTURE 11. Memory Hierarchy

Computer Architecture Spring 2016

Q3: Block Replacement. Replacement Algorithms. ECE473 Computer Architecture and Organization. Memory Hierarchy: Set Associative Cache

Advanced Caching Techniques

Advanced cache optimizations. ECE 154B Dmitri Strukov

CSE 431 Computer Architecture Fall Chapter 5A: Exploiting the Memory Hierarchy, Part 1

Chapter 5. Topics in Memory Hierachy. Computer Architectures. Tien-Fu Chen. National Chung Cheng Univ.

CS 61C: Great Ideas in Computer Architecture. Direct Mapped Caches

CS 152 Computer Architecture and Engineering

CS3350B Computer Architecture

Memory Cache. Memory Locality. Cache Organization -- Overview L1 Data Cache

EEC 170 Computer Architecture Fall Cache Introduction Review. Review: The Memory Hierarchy. The Memory Hierarchy: Why Does it Work?

CS 61C: Great Ideas in Computer Architecture. Cache Performance, Set Associative Caches

Page 1. Multilevel Memories (Improving performance using a little cash )

CSF Cache Introduction. [Adapted from Computer Organization and Design, Patterson & Hennessy, 2005]

Review: Evaluating Branch Alternatives. Lecture 3: Introduction to Advanced Pipelining. Review: Evaluating Branch Prediction

Computer Architecture Spring 2016

Adapted from David Patterson s slides on graduate computer architecture

Memory Hierarchies. Instructor: Dmitri A. Gusev. Fall Lecture 10, October 8, CS 502: Computers and Communications Technology

CS 152 Computer Architecture and Engineering

Why memory hierarchy? Memory hierarchy. Memory hierarchy goals. CS2410: Computer Architecture. L1 cache design. Sangyeun Cho

Predict Not Taken. Revisiting Branch Hazard Solutions. Filling the delay slot (e.g., in the compiler) Delayed Branch

Name: 1. Caches a) The average memory access time (AMAT) can be modeled using the following formula: AMAT = Hit time + Miss rate * Miss penalty

Donn Morrison Department of Computer Science. TDT4255 Memory hierarchies

Chapter 5 Memory Hierarchy Design. In-Cheol Park Dept. of EE, KAIST

COSC4201. Chapter 5. Memory Hierarchy Design. Prof. Mokhtar Aboelaze York University

Time 11/03/99 UCB Fall 1999

COEN6741. Computer Architecture and Design

COSC4201. Chapter 4 Cache. Prof. Mokhtar Aboelaze York University Based on Notes By Prof. L. Bhuyan UCR And Prof. M. Shaaban RIT

Topics. Computer Organization CS Improving Performance. Opportunity for (Easy) Points. Three Generic Data Hazards

COSC 6385 Computer Architecture - Memory Hierarchies (II)

LECTURE 5: MEMORY HIERARCHY DESIGN

Memory Technology. Caches 1. Static RAM (SRAM) Dynamic RAM (DRAM) Magnetic disk. Ideal memory. 0.5ns 2.5ns, $2000 $5000 per GB

Chapter 2 (cont) Instructor: Josep Torrellas CS433. Copyright Josep Torrellas 1999, 2001, 2002,

Memory. Lecture 22 CS301

Cache Optimization. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

CS61C : Machine Structures

Pollard s Attempt to Explain Cache Memory

CSF Improving Cache Performance. [Adapted from Computer Organization and Design, Patterson & Hennessy, 2005]

CS61C Review of Cache/VM/TLB. Lecture 26. April 30, 1999 Dave Patterson (http.cs.berkeley.edu/~patterson)

3Introduction. Memory Hierarchy. Chapter 2. Memory Hierarchy Design. Computer Architecture A Quantitative Approach, Fifth Edition

Transcription:

Lecture 19: Memory Hierarchy Five Ways to Reduce Miss Penalty (Second Level Cache) Professor Alvin R. Lebeck Computer Science 220 Fall 1999 Exam Average 76 90-100 4 80-89 3 70-79 3 60-69 5 < 60 1 Admin CPS 220 2 Page 1 1

Review: Summary CPUtime = IC x (CPIexecution + Mem Access per instruction x Miss Rate x Miss penalty) x clock cycle time 3 Cs: Compulsory, Capacity, Conflict Program transformations to reduce cache misses CPS 220 3 1. Reducing Miss Penalty: Read Priority over Write on Miss Write back with write buffers offer RAW conflicts with main memory reads on cache misses If simply wait for write buffer to empty might increase read miss penalty by 50% (old MIPS 1000) Check write buffer contents before read; if no conflicts, let the memory access continue Write Back? Read miss replacing dirty block Normal: Write dirty block to memory, and then do the read Instead copy the dirty block to a write buffer, then do the read, and then do the write CPU stall less since restarts as soon as read completes CPS 220 4 Page 2 2

2. Subblock Placement to Reduce Miss Penalty Don t have to load full block on a miss Have bits per subblock to indicate valid (Originally invented to reduce tag storage) 100 200 300 1 1 1 0 0 1 0 1 0 0 0 1 Valid Bits CPS 220 5 3. Early Restart and Critical Word First Don t wait for full block to be loaded before restarting CPU Early restart As soon as the requested word of the block arrrives, send it to the CPU and let the CPU continue execution Critical Word First Request the missed word first from memory and send it to the CPU as soon as it arrives; let the CPU continue execution while filling the rest of the words in the block. Also called wrapped fetch and requested word first Generally useful only in large blocks, Spatial locality a problem; tend to want next sequential word, so not clear if benefit by early restart CPS 220 6 Page 3 3

4. Non-blocking Caches to reduce stalls on misses Non-blocking cache or lockup-free cache allowing the data cache to continue to supply cache hits during a miss hit under miss reduces the effective miss penalty by being helpful during a miss instead of ignoring the requests of the CPU hit under multiple miss or miss under miss may further lower the effective miss penalty by overlapping multiple misses Significantly increases the complexity of the cache controller as there can be multiple outstanding memory accesses CPS 220 7 Value of Hit Under Miss for SPEC Hit Under i Misses 1.8 1.6 2 1.4 1.2 1 0.8 0.6 0.4 0.2 0 0->1 1->2 2->64 Base Hit under i Misses eqntott espresso xlisp compress mdljsp2 ear fpppp tomcatv swm256 Integer Floating Point FP programs on average: AMAT= 0.68 -> 0.52 -> 0.34 -> 0.26 Int programs on average: AMAT= 0.24 -> 0.20 -> 0.19 -> 0.19 8 KB Data Cache, Direct Mapped, 32B block, 16 cycle miss doduc su2cor wave5 mdljdp2 hydro2d alvinn nasa7 spice2g6 ora CPS 220 8 Page 4 4

5th Miss Penalty Reduction: Second Level Cache L2 Equations AMAT = Hit Time L1 + Miss Rate L1 x Miss Penalty L1 Miss Penalty L1 = Hit Time L2 + Miss Rate L2 x Miss Penalty L2 AMAT = Hit Time L1 + Miss Rate L1 x (Hit Time L2 + Miss Rate L2 + Miss Penalty L2 ) Definitions: Local miss rate misses in this cache divided by the total number of memory accesses to this cache (Miss rate L2 ) Global miss rate misses in this cache divided by the total number of memory accesses generated by the CPU (Miss Rate L1 x Miss Rate L2 ) CPS 220 9 Comparing Local and Global Miss Rates 32 KByte 1st level cache; Increasing 2nd level cache Global miss rate close to single level cache rate provided L2 >> L1 Don t use local miss rate L2 not tied to CPU clock cycle Cost & A.M.A.T. Generally Fast Hit Times and fewer misses Since hits are few, target miss reduction CPS 220 10 Page 5 5

Reducing Misses: Which apply to L2 Cache? Reducing Miss Rate 1. Reduce Misses via Larger Block Size 2. Reduce Conflict Misses via Higher Associativity 3. Reducing Conflict Misses via Victim Cache 4. Reducing Conflict Misses via Pseudo-Associativity 5. Reducing Misses by HW Prefetching Instr, Data 6. Reducing Misses by SW Prefetching Data 7. Reducing Capacity/Conf. Misses by Compiler Optimizations CPS 220 11 L2 cache block size & A.M.A.T. 32KB L1, 8 byte path to memory Relative CPU Time 2 1.9 1.8 1.7 1.6 1.5 1.4 1.3 1.2 1.1 1 1.95 1.54 1.36 1.28 1.27 1.34 16 32 64 128 256 512 Block Size CPS 220 12 Page 6 6

Summary: Reducing Miss Penalty Five techniques Read priority over write on miss Subblock placement Early Restart and Critical Word First on miss Non-blocking Caches (Hit Under Miss) Second Level Cache Can be applied recursively to Multilevel Caches Danger is that time to DRAM will grow with multiple levels in between CPS 220 13 Review: Improving Cache Performance 1. Reduce the miss rate, 2. Reduce the miss penalty, or 3. Reduce the time to hit in the cache. CPS 220 14 Page 7 7

1. Fast Hit times via Small and Simple Caches Why Alpha 21164 has 8KB Instruction and 8KB data cache + 96KB second level cache Direct Mapped, on chip Impact of dynamic scheduling? Alpha 21264 has 64KB 2-way L1 Data and Inst Cache CPS 220 15 2. Fast Hit Times Via Pipelined Writes Pipeline Tag Check and Update Cache as separate stages; current write tag check & previous write cache update Only Write in the pipeline; empty during a miss Shaded is Delayed Write Buffer; must be checked on reads; either complete write or read from buffer CPS 220 16 Page 8 8

3. Fast Writes on Misses Via Small Subblocks If most writes are 1 word, subblock size is 1 word, & write through then always write subblock & tag immediately Tag match and valid bit already set: Writing the block was proper, & nothing lost by setting valid bit on again. Tag match and valid bit not set: The tag match means that this is the proper block; writing the data into the subblock makes it appropriate to turn the valid bit on. Tag mismatch: This is a miss and will modify the data portion of the block. As this is a write-through cache, however, no harm was done; memory still has an up-to-date copy of the old value. Only the tag to the address of the write and the valid bits of the other subblock need be changed because the valid bit for this subblock has already been set Doesn t work with write back due to last case CPS 220 17 5 & 6?? Why are loads slower than registers? How can we get some of the advantages of registers for caches? How can we apply basic ideas of branch prediction to loads? 18 Page 9 9

5. Multiport Cache Allow more than one memory access per cycle Replicate the cache (2 read ports, 1 write port) Dual port the cache (2 ports for either read or write) Multiple Banks (different addresses to different caches) 19 6. Load Value Prediction Predict result of load Use PC to index value prediction table 20 Page 10 10

Cache Optimization Summary Technique MR MP HT Complexity Larger Block Size + 0 Higher Associativity + 1 Victim Caches + 2 Pseudo-Associative Caches + 2 HW Prefetching of Instr/Data + 2 Compiler Controlled Prefetching + 3 Compiler Reduce Misses + 0 Priority to Read Misses + 1 Subblock Placement + + 1 Early Restart & Critical Word 1st + 2 Non-Blocking Caches + 3 Second Level Caches + 2 Small & Simple Caches + 0 Avoiding Address Translation + 2 Pipelining Writes + 1 Multiple Ports + 2 Load Value Prediction + 2 CPS 220 21 What is the Impact of What You ve Learned About Caches? 1960-1985: Speed = ƒ(no. operations) 1997 Pipelined Execution & Fast Clock Rate Out-of-Order completion Superscalar Instruction Issue 1000 100 10 1 CPU DRAM 1998: Speed = ƒ(non-cached memory accesses) 1980 1981 1982 1983 What does this mean for Compilers?,Operating Systems?, Algorithms?, Data Structures? 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 CPS 220 22 Page 11 11