Lecture-14 (Memory Hierarchy) CS422-Spring

Similar documents
CS 152 Computer Architecture and Engineering. Lecture 6 - Memory

Computer Architecture

Agenda. EE 260: Introduction to Digital Design Memory. Naive Register File. Agenda. Memory Arrays: SRAM. Memory Arrays: Register File

Multilevel Memories. Joel Emer Computer Science and Artificial Intelligence Laboratory Massachusetts Institute of Technology

Lecture 6 - Memory. Dr. George Michelogiannakis EECS, University of California at Berkeley CRD, Lawrence Berkeley National Laboratory

EEM 486: Computer Architecture. Lecture 9. Memory

Computer Architecture Lecture 19: Memory Hierarchy and Caches. Prof. Onur Mutlu Carnegie Mellon University Spring 2013, 3/19/2014

18-447: Computer Architecture Lecture 17: Memory Hierarchy and Caches. Prof. Onur Mutlu Carnegie Mellon University Spring 2012, 3/26/2012

The University of Adelaide, School of Computer Science 13 September 2018

Advanced Computer Architecture

18-447: Computer Architecture Lecture 22: Memory Hierarchy and Caches. Prof. Onur Mutlu Carnegie Mellon University Spring 2013, 3/27/2013

CS 152 Computer Architecture and Engineering. Lecture 6 - Memory. Last =me in Lecture 5

Chapter 5B. Large and Fast: Exploiting Memory Hierarchy

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

Internal Memory. Computer Architecture. Outline. Memory Hierarchy. Semiconductor Memory Types. Copyright 2000 N. AYDIN. All rights reserved.

CS 61C: Great Ideas in Computer Architecture (Machine Structures) Caches Part 1

CSC D70: Compiler Optimization Memory Optimizations

Chapter Seven. Memories: Review. Exploiting Memory Hierarchy CACHE MEMORY AND VIRTUAL MEMORY

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

Caches. Samira Khan March 21, 2017

EC 513 Computer Architecture

ECE468 Computer Organization and Architecture. Memory Hierarchy

Recap: Machine Organization

Chapter 5 Large and Fast: Exploiting Memory Hierarchy (Part 1)

Memory Hierarchy. Slides contents from:

Memory Hierarchy. 2/18/2016 CS 152 Sec6on 5 Colin Schmidt

Summary of Computer Architecture

Chapter 5. Large and Fast: Exploiting Memory Hierarchy

Donn Morrison Department of Computer Science. TDT4255 Memory hierarchies

ECE 152 Introduction to Computer Architecture

CENG4480 Lecture 09: Memory 1

Computer Organization and Structure. Bing-Yu Chen National Taiwan University

Memory Hierarchy Technology. The Big Picture: Where are We Now? The Five Classic Components of a Computer

CS252 Spring 2017 Graduate Computer Architecture. Lecture 11: Memory

EECS151/251A Spring 2018 Digital Design and Integrated Circuits. Instructors: John Wawrzynek and Nick Weaver. Lecture 19: Caches EE141

CPE300: Digital System Architecture and Design

Cycle Time for Non-pipelined & Pipelined processors

Question?! Processor comparison!

Cache Memory COE 403. Computer Architecture Prof. Muhamed Mudawar. Computer Engineering Department King Fahd University of Petroleum and Minerals

Memory Hierarchy Y. K. Malaiya

Memory Hierarchy. Slides contents from:

ECE232: Hardware Organization and Design

The Memory Hierarchy & Cache Review of Memory Hierarchy & Cache Basics (from 350):

Lecture 17 Introduction to Memory Hierarchies" Why it s important " Fundamental lesson(s)" Suggested reading:" (HP Chapter

Memory systems. Memory technology. Memory technology Memory hierarchy Virtual memory

EEC 483 Computer Organization

The memory gap. 1980: no cache in µproc; level cache on Alpha µproc

LECTURE 11. Memory Hierarchy

Chapter 7 Large and Fast: Exploiting Memory Hierarchy. Memory Hierarchy. Locality. Memories: Review

Caches. Hiding Memory Access Times

Let!s go back to a course goal... Let!s go back to a course goal... Question? Lecture 22 Introduction to Memory Hierarchies

CS 61C: Great Ideas in Computer Architecture. The Memory Hierarchy, Fully Associative Caches

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

The Memory Hierarchy. Daniel Sanchez Computer Science & Artificial Intelligence Lab M.I.T. April 3, 2018 L13-1

Caches Part 1. Instructor: Sören Schwertfeger. School of Information Science and Technology SIST

CS 152 Computer Architecture and Engineering. Lecture 7 - Memory Hierarchy-II

Performance! (1/latency)! 1000! 100! 10! Capacity Access Time Cost. CPU Registers 100s Bytes <10s ns. Cache K Bytes ns 1-0.

UNIVERSITY OF MASSACHUSETTS Dept. of Electrical & Computer Engineering. Computer Architecture ECE 568/668

COMPUTER ORGANIZATION AND DESIGN The Hardware/Software Interface

Chapter Seven. Large & Fast: Exploring Memory Hierarchy

The Memory Hierarchy. Silvina Hanono Wachman Computer Science & Artificial Intelligence Lab M.I.T.

Chapter 5. Memory Technology

Chapter 5. Large and Fast: Exploiting Memory Hierarchy

Review: Performance Latency vs. Throughput. Time (seconds/program) is performance measure Instructions Clock cycles Seconds.

Course Administration

Spring 2016 :: CSE 502 Computer Architecture. Caches. Nima Honarmand

CS650 Computer Architecture. Lecture 9 Memory Hierarchy - Main Memory

CSC Memory System. A. A Hierarchy and Driving Forces

CPS101 Computer Organization and Programming Lecture 13: The Memory System. Outline of Today s Lecture. The Big Picture: Where are We Now?

COMPUTER ORGANIZATION AND DESIGN The Hardware/Software Interface. 5 th. Edition. Chapter 5. Large and Fast: Exploiting Memory Hierarchy

ECE 341. Lecture # 16

CS 152 Computer Architecture and Engineering. Lecture 7 - Memory Hierarchy-II

Computer Architecture. Memory Hierarchy. Lynn Choi Korea University

Chapter 5. Large and Fast: Exploiting Memory Hierarchy

10/11/17. New-School Machine Structures. Review: Single Cycle Instruction Timing. Review: Single-Cycle RISC-V RV32I Datapath. Components of a Computer

CSCI-UA.0201 Computer Systems Organization Memory Hierarchy

CPU issues address (and data for write) Memory returns data (or acknowledgment for write)

CENG3420 Lecture 08: Memory Organization

Memory Technology. Chapter 5. Principle of Locality. Chapter 5 Large and Fast: Exploiting Memory Hierarchy 1

The Memory Hierarchy 1

CSE502: Computer Architecture CSE 502: Computer Architecture

Caches 3/23/17. Agenda. The Dataflow Model (of a Computer)

Caches. Samira Khan March 23, 2017

5. Memory Hierarchy Computer Architecture COMP SCI 2GA3 / SFWR ENG 2GA3. Emil Sekerinski, McMaster University, Fall Term 2015/16

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

Administrivia. CMSC 411 Computer Systems Architecture Lecture 8 Basic Pipelining, cont., & Memory Hierarchy. SPEC92 benchmarks

Memory. Lecture 22 CS301

MEMORY HIERARCHY DESIGN

Memory Hierarchy and Caches

HY225 Lecture 12: DRAM and Virtual Memory

The Memory Hierarchy & Cache

Spring 2018 :: CSE 502. Cache Design Basics. Nima Honarmand

LECTURE 4: LARGE AND FAST: EXPLOITING MEMORY HIERARCHY

CS 61C: Great Ideas in Computer Architecture (Machine Structures) Caches Part 1

Concept of Memory. The memory of computer is broadly categories into two categories:

Chapter 5. Large and Fast: Exploiting Memory Hierarchy

Chapter 5A. Large and Fast: Exploiting Memory Hierarchy

CENG 3420 Computer Organization and Design. Lecture 08: Cache Review. Bei Yu

The Memory Hierarchy. Cache, Main Memory, and Virtual Memory (Part 2)

Internal Memory Cache Stallings: Ch 4, Ch 5 Key Characteristics Locality Cache Main Memory

Transcription:

Lecture-14 (Memory Hierarchy) CS422-Spring 2018 Biswa@CSE-IITK

The Ideal World Instruction Supply Pipeline (Instruction execution) Data Supply - Zero-cycle latency - Infinite capacity - Zero cost - Perfect control flow - No pipeline stalls -Perfect data flow (reg/memory dependencies) - Zero-cycle interconnect (operand communication) - Enough functional units - Zero latency compute - Zero-cycle latency - Infinite capacity - Infinite bandwidth - Zero cost CS422: Spring 2018 Biswabandan Panda, CSE@IITK 2

World of Memory Hierarchy. But Why? CS422: Spring 2018 Biswabandan Panda, CSE@IITK 3

Semiconductor Memory Semiconductor memory began to be competitive in early 1970s Intel formed to exploit market for semiconductor memory Early semiconductor memory was Static RAM (SRAM). SRAM cell internals similar to a latch (cross-coupled inverters). First commercial Dynamic RAM (DRAM) was Intel 1103 1Kbit of storage on single chip charge on a capacitor used to hold value Semiconductor memory quickly replaced core in 70s CS422: Spring 2018 Biswabandan Panda, CSE@IITK 4

One-transistor DRAM 1-T DRAM Cell word access transistor V REF bit Storage capacitor (FET gate, trench, stack) CS422: Spring 2018 Biswabandan Panda, CSE@IITK 5

Row Address Decoder DRAM Architecture Col. 1 bit lines Col. 2 M word lines Row 1 N Row 2 N N+M M Column Decoder & Sense Amplifiers Memory cell (one bit) Data D Bits stored in 2-dimensional arrays on chip Modern chips have around 4-8 logical banks on each chip each logical bank physically implemented as many smaller arrays CS422: Spring 2018 Biswabandan Panda, CSE@IITK 6

_bitline DRAM Dynamic random access memory Capacitor charge state indicates stored value Whether the capacitor is charged or discharged indicates storage of 1 or 0 1 capacitor 1 access transistor Capacitor leaks DRAM cell loses charge over time DRAM cell needs to be refreshed row enable CS422: Spring 2018 Biswabandan Panda, CSE@IITK 7

bitline _bitline SRAM Static random access memory Two cross coupled inverters store a single bit Feedback path enables the stored value to persist in the cell 4 transistors for storage 2 transistors for access row select CS422: Spring 2018 Biswabandan Panda, CSE@IITK 8

DRAM vs SRAM DRAM Slower access (capacitor) Higher density (1T 1C cell) Lower cost Requires refresh (power, performance, circuitry) SRAM Faster access (no capacitor) Lower density (6T cell) Higher cost No need for refresh CS422: Spring 2018 Biswabandan Panda, CSE@IITK 9

The Problem? Bigger is slower SRAM, 512 Bytes, sub-nanosec SRAM, KByte~MByte, ~nanosec DRAM, Gigabyte, ~50 nanosec Hard Disk, Terabyte, ~10 millisec Faster is more expensive (dollars and chip area) SRAM, < 10$ per Megabyte DRAM, < 1$ per Megabyte Hard Disk < 1$ per Gigabyte These sample values scale with time Other technologies have their place as well Flash memory, PC-RAM, MRAM, RRAM (not mature yet) CS422: Spring 2018 Biswabandan Panda, CSE@IITK 10

Why Memory Hierarchy? We want both fast and large But we cannot achieve both with a single level of memory Idea: Have multiple levels of storage (progressively bigger and slower as the levels are farther from the processor) and ensure most of the data the processor needs is kept in the fast(er) level(s) CS422: Spring 2018 Biswabandan Panda, CSE@IITK 11

1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 Performance Memory Wall Problem 1000 µproc 60%/year CPU 100 10 1 Processor-Memory Performance Gap: (growing 50%/yr) DRAM DRAM 7%/year Time Four-issue 4GHz superscalar accessing 100ns DRAM could execute instructions during time for one memory access! 1600 CS422: Spring 2018 Biswabandan Panda, CSE@IITK 12

Size Affects Latency CPU CPU Small Memory Big Memory Motivates 3D stacking Signals have further to travel Fan out to more locations CS422: Spring 2018 Biswabandan Panda, CSE@IITK 13

Memory Hierarchy CPU A Small, Fast Memory (RF, SRAM) B Big, Slow Memory (DRAM) holds frequently used data capacity: Register << SRAM << DRAM latency: Register << SRAM << DRAM bandwidth: on-chip >> off-chip On a data access: if data fast memory low latency access (SRAM) if data fast memory high latency access (DRAM) CS422: Spring 2018 Biswabandan Panda, CSE@IITK 14

Memory Address (one dot per access) Access Patterns Donald J. Hatfield, Jeanette Gerald: Program Restructuring for Virtual Memory. IBM Systems Journal 10(3): 168-192 (1971) Time CS422: Spring 2018 Biswabandan Panda, CSE@IITK 15

Examples Address n loop iterations Instruction fetches Stack accesses subroutine call argument access subroutine return Data accesses scalar accesses Time CS422: Spring 2018 Biswabandan Panda, CSE@IITK 16

Locality of Reference Temporal Locality: If a location is referenced it is likely to be referenced again in the near future. Spatial Locality: If a location is referenced it is likely that locations near it will be referenced in the near future. CS422: Spring 2018 Biswabandan Panda, CSE@IITK 17

Memory Address (one dot per access) Again Temporal Locality Spatial Locality Time CS422: Spring 2018 Biswabandan Panda, CSE@IITK 18

Inside a Cache Address Address Processor Data CACHE Data Main Memory copy of main memory location 100 copy of main memory location 101 100 304 Data Byte Data Byte Data Byte Line Address Tag 6848 416 Data Block CS422: Spring 2018 Biswabandan Panda, CSE@IITK 19

Intel i7 Private L1 and L2 L2 is 256KB each. 10 cycle latency 8MB shared L3. ~40 cycles latency CS422: Spring 2018 Biswabandan Panda, CSE@IITK 20

Cache Events Look at Processor Address, search cache tags to find match. Then either Found in cache a.k.a. HIT Not in cache a.k.a. MISS Return copy of data from cache Read block of data from Main Memory Wait Return data to processor and update cache Q: Which line do we replace? CS422: Spring 2018 Biswabandan Panda, CSE@IITK 21

Placement Policy Block Number Memory 0 1 2 3 4 5 6 7 8 9 1 1 1 1 1 1 1 1 1 1 0 1 2 3 4 5 6 7 8 9 2 2 2 2 2 2 2 2 2 2 0 1 2 3 4 5 6 7 8 9 3 3 0 1 Set Number 0 1 2 3 0 1 2 3 4 5 6 7 Cache block 12 can be placed Fully (2-way) Set Direct Associative Associative Mapped anywhere anywhere in only into set 0 block 4 (12 mod 4) (12 mod 8) CS422: Spring 2018 Biswabandan Panda, CSE@IITK 22

Direct Mapped Tag Index Block Offset t V Tag k Data Block b 2 k lines In reality, tag-store is placed separately = t HIT Data Word or Byte CS422: Spring 2018 Biswabandan Panda, CSE@IITK 23

High bits or Low bits k Index V Tag t Tag Block Offset Data Block b 2 k lines = t HIT Data Word or Byte CS422: Spring 2018 Biswabandan Panda, CSE@IITK 24

Set-Associative Tag Index Block Offset b t V Tag k Data Block V Tag Data Block t = = Data Word or Byte HIT CS422: Spring 2018 Biswabandan Panda, CSE@IITK 25

Block Offset Tag Fully-associative V Tag t = Data Block t = HIT b = Data Word or Byte CS422: Spring 2018 Biswabandan Panda, CSE@IITK 26

What s in Tag Store? Valid bit Tag Replacement policy bits Dirty bit? Write back vs. write through caches CS422: Spring 2018 Biswabandan Panda, CSE@IITK 27