Chapter 5. Multiprocessors and Thread-Level Parallelism

Similar documents
Chapter 5. Multiprocessors and Thread-Level Parallelism

Computer Architecture. A Quantitative Approach, Fifth Edition. Chapter 5. Multiprocessors and Thread-Level Parallelism

Multiprocessor Cache Coherence. Chapter 5. Memory System is Coherent If... From ILP to TLP. Enforcing Cache Coherence. Multiprocessor Types

Multiple Issue and Static Scheduling. Multiple Issue. MSc Informatics Eng. Beyond Instruction-Level Parallelism

EN2910A: Advanced Computer Architecture Topic 05: Coherency of Memory Hierarchy Prof. Sherief Reda School of Engineering Brown University

Chapter 8. Multiprocessors. In-Cheol Park Dept. of EE, KAIST

Multiprocessors & Thread Level Parallelism

Thread- Level Parallelism. ECE 154B Dmitri Strukov

MULTIPROCESSORS AND THREAD LEVEL PARALLELISM

Chapter-4 Multiprocessors and Thread-Level Parallelism

EN2910A: Advanced Computer Architecture Topic 05: Coherency of Memory Hierarchy

Chapter 5 Thread-Level Parallelism. Abdullah Muzahid

Handout 3 Multiprocessor and thread level parallelism

MULTIPROCESSORS AND THREAD-LEVEL PARALLELISM (PART 1)

Review: Multiprocessor. CPE 631 Session 21: Multiprocessors (Part 2) Potential HW Coherency Solutions. Bus Snooping Topology

COEN-4730 Computer Architecture Lecture 08 Thread Level Parallelism and Coherence

MULTIPROCESSORS AND THREAD-LEVEL. B649 Parallel Architectures and Programming

Multiprocessors and Thread-Level Parallelism. Department of Electrical & Electronics Engineering, Amrita School of Engineering

MULTIPROCESSORS AND THREAD-LEVEL PARALLELISM. B649 Parallel Architectures and Programming

Page 1. Lecture 12: Multiprocessor 2: Snooping Protocol, Directory Protocol, Synchronization, Consistency. Bus Snooping Topology

5008: Computer Architecture

Chapter 5. Thread-Level Parallelism

Introduction to Multiprocessors (Part II) Cristina Silvano Politecnico di Milano

Shared Symmetric Memory Systems

1. Memory technology & Hierarchy

Computer Architecture

Computer Architecture Lecture 10: Thread Level Parallelism II (Chapter 5) Chih Wei Liu 劉志尉 National Chiao Tung University

Cache Coherence. Bryan Mills, PhD. Slides provided by Rami Melhem

Parallel Architecture. Hwansoo Han

10 Parallel Organizations: Multiprocessor / Multicore / Multicomputer Systems

CS654 Advanced Computer Architecture Lec 14 Directory Based Multiprocessors

Aleksandar Milenkovic, Electrical and Computer Engineering University of Alabama in Huntsville. Review: Small-Scale Shared Memory

Computer Systems Architecture

Multiprocessor Synchronization

Lecture 18: Coherence and Synchronization. Topics: directory-based coherence protocols, synchronization primitives (Sections

Cache Coherence. Introduction to High Performance Computing Systems (CS1645) Esteban Meneses. Spring, 2014

EC 513 Computer Architecture

Introduction. Coherency vs Consistency. Lec-11. Multi-Threading Concepts: Coherency, Consistency, and Synchronization

CMSC 611: Advanced. Distributed & Shared Memory

Overview: Shared Memory Hardware. Shared Address Space Systems. Shared Address Space and Shared Memory Computers. Shared Memory Hardware

Overview: Shared Memory Hardware

Suggested Readings! What makes a memory system coherent?! Lecture 27" Cache Coherency! ! Readings! ! Program order!! Sequential writes!! Causality!

Thread-Level Parallelism

CSE502: Computer Architecture CSE 502: Computer Architecture

Chapter - 5 Multiprocessors and Thread-Level Parallelism

Module 9: Addendum to Module 6: Shared Memory Multiprocessors Lecture 17: Multiprocessor Organizations and Cache Coherence. The Lecture Contains:

Multiprocessors II: CC-NUMA DSM. CC-NUMA for Large Systems

Portland State University ECE 588/688. Directory-Based Cache Coherence Protocols

CPE 631 Lecture 21: Multiprocessors

Lecture 25: Multiprocessors. Today s topics: Snooping-based cache coherence protocol Directory-based cache coherence protocol Synchronization

Parallel Computer Architecture Spring Distributed Shared Memory Architectures & Directory-Based Memory Coherence

Lecture 25: Multiprocessors

Lecture: Coherence, Synchronization. Topics: directory-based coherence, synchronization primitives (Sections )

CMSC 611: Advanced Computer Architecture

Cache Coherence and Atomic Operations in Hardware

Computer Science 146. Computer Architecture

Lecture 17: Multiprocessors: Size, Consitency. Review: Networking Summary

M4 Parallelism. Implementation of Locks Cache Coherence

Aleksandar Milenkovich 1

Computer Architecture

Module 9: "Introduction to Shared Memory Multiprocessors" Lecture 16: "Multiprocessor Organizations and Cache Coherence" Shared Memory Multiprocessors

COSC 6385 Computer Architecture - Multi Processor Systems

Chapter 6. Parallel Processors from Client to Cloud Part 2 COMPUTER ORGANIZATION AND DESIGN. Homogeneous & Heterogeneous Multicore Architectures

Lecture 33: Multiprocessors Synchronization and Consistency Professor Randy H. Katz Computer Science 252 Spring 1996

Aleksandar Milenkovic, Electrical and Computer Engineering University of Alabama in Huntsville

Parallel Computers. CPE 631 Session 20: Multiprocessors. Flynn s Tahonomy (1972) Why Multiprocessors?

CSE 502 Graduate Computer Architecture Lec 19 Directory-Based Shared-Memory Multiprocessors & MP Synchronization

Lecture 24: Multiprocessing Computer Architecture and Systems Programming ( )

ECSE 425 Lecture 30: Directory Coherence

Interconnect Routing

EEC 581 Computer Architecture. Lec 11 Synchronization and Memory Consistency Models (4.5 & 4.6)

Lecture: Coherence and Synchronization. Topics: synchronization primitives, consistency models intro (Sections )

CMSC 411 Computer Systems Architecture Lecture 21 Multiprocessors 3

Module 5: Performance Issues in Shared Memory and Introduction to Coherence Lecture 10: Introduction to Coherence. The Lecture Contains:

UNIT I (Two Marks Questions & Answers)

Chapter 9 Multiprocessors

INSTITUTO SUPERIOR TÉCNICO. Architectures for Embedded Computing

Introduction to Multiprocessors (Part I) Prof. Cristina Silvano Politecnico di Milano

Lecture 19: Coherence and Synchronization. Topics: synchronization primitives (Sections )

Computer Systems Architecture

Cache Coherence. (Architectural Supports for Efficient Shared Memory) Mainak Chaudhuri

Today s Outline: Shared Memory Review. Shared Memory & Concurrency. Concurrency v. Parallelism. Thread-Level Parallelism. CS758: Multicore Programming

ESE 545 Computer Architecture Symmetric Multiprocessors and Snoopy Cache Coherence Protocols CA SMP and cache coherence

Chapter 6: Multiprocessors and Thread-Level Parallelism

Processor Architecture

Lecture 10: Cache Coherence: Part I. Parallel Computer Architecture and Programming CMU , Spring 2013

Non-uniform memory access machine or (NUMA) is a system where the memory access time to any region of memory is not the same for all processors.

Shared Memory SMP and Cache Coherence (cont) Adapted from UCB CS252 S01, Copyright 2001 USB

Lecture 5: Directory Protocols. Topics: directory-based cache coherence implementations

Flynn s Classification

PCS - Part Two: Multiprocessor Architectures

Limitations of parallel processing

Foundations of Computer Systems

Memory Hierarchy in a Multiprocessor

Cache Coherence. CMU : Parallel Computer Architecture and Programming (Spring 2012)

Midterm Exam 02/09/2009

Lecture 24: Virtual Memory, Multiprocessors

Lecture 18: Coherence Protocols. Topics: coherence protocols for symmetric and distributed shared-memory multiprocessors (Sections

Advanced OpenMP. Lecture 3: Cache Coherency

Multiprocessors and Locking

Transcription:

Computer Architecture A Quantitative Approach, Fifth Edition Chapter 5 Multiprocessors and Thread-Level Parallelism 1

Introduction Thread-Level parallelism Have multiple program counters Uses MIMD model Targeted for tightly-coupled shared-memory multiprocessors Introduction For n processors, need n threads Amount of computation assigned to each thread = grain size Threads can be used for data-level parallelism, but the overheads may outweigh the benefit 2

Types Symmetric multiprocessors (SMP) Small number of cores Share single memory with uniform memory latency Distributed shared memory (DSM) Memory distributed among processors Non-uniform memory access/latency (NUMA) Processors connected via direct (switched) and nondirect (multi-hop) interconnection networks Introduction 3

Cache Coherence Processors may see different values through their caches: Centralized Shared-Memory Architectures 4

Cache Coherence Coherence All reads by any processor must return the most recently written value Writes to the same location by any two processors are seen in the same order by all processors Consistency When a written value will be returned by a read If a processor writes location A followed by location B, any processor that sees the new value of B must also see the new value of A Centralized Shared-Memory Architectures 5

Enforcing Coherence Coherent caches provide: Migration: movement of data Replication: multiple copies of data Cache coherence protocols Directory based Sharing status of each block kept in one location Snooping Each core tracks sharing status of each block Centralized Shared-Memory Architectures 6

Snoopy Coherence Protocols Write invalidate On write, invalidate all other copies Use bus itself to serialize Write cannot complete until bus access is obtained Centralized Shared-Memory Architectures Write update On write, update all copies 7

Snoopy Coherence Protocols Locating an item when a read miss occurs In write-back cache, the updated value must be sent to the requesting processor Cache lines marked as shared or exclusive/modified Only writes to shared lines need an invalidate broadcast After this, the line is marked as exclusive Centralized Shared-Memory Architectures 8

Snoopy Coherence Protocols Centralized Shared-Memory Architectures 9

Snoopy Coherence Protocols Centralized Shared-Memory Architectures 10

Snoopy Coherence Protocols Complications for the basic MSI protocol: Operations are not atomic E.g. detect miss, acquire bus, receive a response Creates possibility of deadlock and races One solution: processor that sends invalidate can hold bus until other processors receive the invalidate Extensions: Add exclusive state to indicate clean block in only one cache (MESI protocol) Prevents needing to write invalidate on a write Owned state Centralized Shared-Memory Architectures 11

Coherence Protocols: Extensions Shared memory bus and snooping bandwidth is bottleneck for scaling symmetric multiprocessors Duplicating tags Place directory in outermost cache Use crossbars or pointto-point networks with banked memory Centralized Shared-Memory Architectures 12

Coherence Protocols AMD Opteron: Memory directly connected to each multicore chip in NUMA-like organization Implement coherence protocol using point-to-point links Use explicit acknowledgements to order operations Centralized Shared-Memory Architectures 13

Performance Coherence influences cache miss rate Coherence misses True sharing misses Write to shared block (transmission of invalidation) Read an invalidated block False sharing misses Read an unmodified word in an invalidated block Performance of Symmetric Shared-Memory Multiprocessors 14

Performance of Symmetric Shared-Memory Multiprocessors 15 Performance Study: Commercial Workload

Performance of Symmetric Shared-Memory Multiprocessors 16 Performance Study: Commercial Workload

Performance of Symmetric Shared-Memory Multiprocessors 17 Performance Study: Commercial Workload

Performance of Symmetric Shared-Memory Multiprocessors 18 Performance Study: Commercial Workload

Directory Protocols Directory keeps track of every block Which caches have each block Dirty status of each block Implement in shared L3 cache Keep bit vector of size = # cores for each block in L3 Not scalable beyond shared L3 Implement in a distributed fashion: Distributed Shared Memory and Directory-Based Coherence 19

Directory Protocols For each block, maintain state: Shared One or more nodes have the block cached, value in memory is up-to-date Set of node IDs Uncached Modified Exactly one node has a copy of the cache block, value in memory is out-of-date Owner node ID Directory maintains block states and sends invalidation messages Distributed Shared Memory and Directory-Based Coherence 20

Distributed Shared Memory and Directory-Based Coherence 21 Messages

Distributed Shared Memory and Directory-Based Coherence 22 Directory Protocols

Directory Protocols For uncached block: Read miss Requesting node is sent the requested data and is made the only sharing node, block is now shared Write miss The requesting node is sent the requested data and becomes the sharing node, block is now exclusive For shared block: Read miss The requesting node is sent the requested data from memory, node is added to sharing set Write miss The requesting node is sent the value, all nodes in the sharing set are sent invalidate messages, sharing set only contains requesting node, block is now exclusive Distributed Shared Memory and Directory-Based Coherence 23

Directory Protocols For exclusive block: Read miss The owner is sent a data fetch message, block becomes shared, owner sends data to the directory, data written back to memory, sharers set contains old owner and requestor Data write back Block becomes uncached, sharer set is empty Write miss Message is sent to old owner to invalidate and send the value to the directory, requestor becomes new owner, block remains exclusive Distributed Shared Memory and Directory-Based Coherence 24

Synchronization Basic building blocks: Atomic exchange Swaps register with memory location Test-and-set Sets under condition Fetch-and-increment Reads original value from memory and increments it in memory Requires memory read and write in uninterruptable instruction Synchronization load linked/store conditional If the contents of the memory location specified by the load linked are changed before the store conditional to the same address, the store conditional fails 25

Implementing Locks Spin lock If no coherence: DADDUI R2,R0,#1 lockit: EXCH R2,0(R1) ;atomic exchange BNEZ R2,lockit ;already locked? Synchronization If coherence: lockit: LD R2,0(R1) ;load of lock BNEZ R2,lockit ;not available-spin DADDUI R2,R0,#1 ;load locked value EXCH R2,0(R1) ;swap BNEZ R2,lockit ;branch if lock wasn t 0 26

Implementing Locks Advantage of this scheme: reduces memory traffic Synchronization 27

Models of Memory Consistency Processor 1: A=0 A=1 if (B==0) Processor 2: B=0 B=1 if (A==0) Should be impossible for both if-statements to be evaluated as true Delayed write invalidate? Sequential consistency: Result of execution should be the same as long as: Accesses on each processor were kept in order Accesses on different processors were arbitrarily interleaved Models of Memory Consistency: An Introduction 28

Implementing Locks To implement, delay completion of all memory accesses until all invalidations caused by the access are completed Reduces performance! Alternatives: Program-enforced synchronization to force write on processor to occur before read on the other processor Requires synchronization object for A and another for B Unlock after write Lock after read Models of Memory Consistency: An Introduction 29

Relaxed Consistency Models Rules: X Y Operation X must complete before operation Y is done Sequential consistency requires: R W, R R, W R, W W Relax W R Total store ordering Relax W W Partial store order Models of Memory Consistency: An Introduction Relax R W and R R Weak ordering and release consistency 30

Relaxed Consistency Models Consistency model is multiprocessor specific Programmers will often implement explicit synchronization Speculation gives much of the performance advantage of relaxed models with sequential consistency Basic idea: if an invalidation arrives for a result that has not been committed, use speculation recovery Models of Memory Consistency: An Introduction 31