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

Similar documents
Computer Systems Architecture

Computer Systems Architecture

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

Handout 3 Multiprocessor and thread level parallelism

MULTIPROCESSORS AND THREAD LEVEL PARALLELISM

Chap. 4 Multiprocessors and Thread-Level Parallelism

Computer and Information Sciences College / Computer Science Department CS 207 D. Computer Architecture. Lecture 9: Multiprocessors

Multiprocessors & Thread Level Parallelism

Parallel Processing SIMD, Vector and GPU s cont.

Computer and Information Sciences College / Computer Science Department CS 207 D. Computer Architecture. Lecture 9: Multiprocessors

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

MULTIPROCESSORS AND THREAD-LEVEL. B649 Parallel Architectures and Programming

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

10 Parallel Organizations: Multiprocessor / Multicore / Multicomputer Systems

Chapter 5. Multiprocessors and Thread-Level Parallelism

MULTIPROCESSORS AND THREAD-LEVEL PARALLELISM (PART 1)

Shared Symmetric Memory Systems

THREAD LEVEL PARALLELISM

Computer parallelism Flynn s categories

Parallel Processing. Computer Architecture. Computer Architecture. Outline. Multiple Processor Organization

Chapter-4 Multiprocessors and Thread-Level Parallelism


Multiprocessors. Flynn Taxonomy. Classifying Multiprocessors. why would you want a multiprocessor? more is better? Cache Cache Cache.

EITF20: Computer Architecture Part 5.2.1: IO and MultiProcessor

Multiprocessors 1. Outline

Multi-Processor / Parallel Processing

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

WHY PARALLEL PROCESSING? (CE-401)

Page 1. Instruction-Level Parallelism (ILP) CISC 662 Graduate Computer Architecture Lectures 16 and 17 - Multiprocessors and Thread-Level Parallelism

Lecture 30: Multiprocessors Flynn Categories, Large vs. Small Scale, Cache Coherency Professor Randy H. Katz Computer Science 252 Spring 1996

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

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

COSC4201 Multiprocessors

CS 590: High Performance Computing. Parallel Computer Architectures. Lab 1 Starts Today. Already posted on Canvas (under Assignment) Let s look at it

Multiprocessing and Scalability. A.R. Hurson Computer Science and Engineering The Pennsylvania State University

COSC 6385 Computer Architecture - Thread Level Parallelism (I)

Chapter 5. Multiprocessors and Thread-Level Parallelism

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.

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

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

Multiprocessors and Locking

Course II Parallel Computer Architecture. Week 2-3 by Dr. Putu Harry Gunawan

Module 18: "TLP on Chip: HT/SMT and CMP" Lecture 39: "Simultaneous Multithreading and Chip-multiprocessing" TLP on Chip: HT/SMT and CMP SMT

UNIT I (Two Marks Questions & Answers)

Parallel Processors. The dream of computer architects since 1950s: replicate processors to add performance vs. design a faster processor

Lecture-13 (ROB and Multi-threading) CS422-Spring

INSTITUTO SUPERIOR TÉCNICO. Architectures for Embedded Computing

Flynn s Classification

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING UNIT-1

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

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

SMD149 - Operating Systems - Multiprocessing

Overview. SMD149 - Operating Systems - Multiprocessing. Multiprocessing architecture. Introduction SISD. Flynn s taxonomy

Online Course Evaluation. What we will do in the last week?

Chapter Seven. Idea: create powerful computers by connecting many smaller ones

Lecture 26: Parallel Processing. Spring 2018 Jason Tang

Hardware-Based Speculation

COSC4201. Multiprocessors and Thread Level Parallelism. Prof. Mokhtar Aboelaze York University

CMSC 411 Computer Systems Architecture Lecture 13 Instruction Level Parallelism 6 (Limits to ILP & Threading)

Multithreading: Exploiting Thread-Level Parallelism within a Processor

Computer Science 146. Computer Architecture

Lecture 24: Virtual Memory, Multiprocessors

CISC 662 Graduate Computer Architecture Lectures 15 and 16 - Multiprocessors and Thread-Level Parallelism

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

Outline EEL 5764 Graduate Computer Architecture. Chapter 3 Limits to ILP and Simultaneous Multithreading. Overcoming Limits - What do we need??

COSC 6385 Computer Architecture - Multi Processor Systems

3/13/2008 Csci 211 Lecture %/year. Manufacturer/Year. Processors/chip Threads/Processor. Threads/chip 3/13/2008 Csci 211 Lecture 8 4

Lecture 23: Thread Level Parallelism -- Introduction, SMP and Snooping Cache Coherence Protocol

18-447: Computer Architecture Lecture 30B: Multiprocessors. Prof. Onur Mutlu Carnegie Mellon University Spring 2013, 4/22/2013

Computing architectures Part 2 TMA4280 Introduction to Supercomputing

Introduction to parallel computers and parallel programming. Introduction to parallel computersand parallel programming p. 1

Advanced Topics in Computer Architecture

! Readings! ! Room-level, on-chip! vs.!

Parallel Architectures

CISC 662 Graduate Computer Architecture Lecture 13 - Limits of ILP

CSCI 4717 Computer Architecture

Aleksandar Milenkovich 1

Computer Architecture Lecture 27: Multiprocessors. Prof. Onur Mutlu Carnegie Mellon University Spring 2015, 4/6/2015

Serial. Parallel. CIT 668: System Architecture 2/14/2011. Topics. Serial and Parallel Computation. Parallel Computing

Thread- Level Parallelism. ECE 154B Dmitri Strukov

Computer Organization. Chapter 16

Module 5 Introduction to Parallel Processing Systems

Lecture Topics. Announcements. Today: Advanced Scheduling (Stallings, chapter ) Next: Deadlock (Stallings, chapter

Introduction II. Overview

Lecture 25: Board Notes: Threads and GPUs

CS425 Computer Systems Architecture

06-Dec-17. Credits:4. Notes by Pritee Parwekar,ANITS 06-Dec-17 1

Comp. Org II, Spring

Parallel Computing: Parallel Architectures Jin, Hai

Computer Architecture Spring 2016

Multiprocessor Cache Coherency. What is Cache Coherence?

Parallel Processing & Multicore computers

Issues in Multiprocessors

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

1. Memory technology & Hierarchy

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

Comp. Org II, Spring

Lecture 9: MIMD Architecture

Issues in Multiprocessors

Lecture 7: Parallel Processing

Transcription:

Multiprocessors and Thread-Level Parallelism

Multithreading Increasing performance by ILP has the great advantage that it is reasonable transparent to the programmer, ILP can be quite limited or hard to exploit in some applications When the processor is stalled waiting on a cache miss, the utilization of functional units drops Other forms of parallelism multithreading Multithreading allows multiple threads to share the functional units of a single processor in an overlapping fashion. General method to exploit thread-level parallelism (TLP) is with a multiprocessor that has multiple independent threads operating at once and in parallel. Multithreading shares processor core among a set of threads duplicating registers and program counter.

Multithreading For sharing, the processor must duplicate the independent state of each thread In addition the hardware must support the ability to change to a different thread relatively quickly Three main hardware approaches to multithreading Fine-grained multithreading Coarse-grained multithreading Simultaneous multithreading

Fine-grained multithreading It switches between threads on each instruction, causing the execution of multiple threads to be interleaved. Round-robin fashion skipping any thread that are stalled at that time CPU must be able to switch threads on every clock cycle It can hide the throughput losses that arise from both short and long stalls, since instructions from other threads can be executed when one thread stalls It slows down the execution of the individual threads, since a thread that is ready to execute without stalls will be delayed by instructions from other threads

Coarse-grained multithreading Switches threads only on costly stalls, such as level two or three cache misses Relieves the need to have thread switching likely to slow the processor down, since the instructions form other threads will only be issued when a thread encounters a costly stall It is limited in its ability to overcome throughput losses, especially from shorter stalls There is a pipeline start up cost, because a CPU with CGM issues instruction form a single thread, when a stall occurs, the pipeline must be emptied. Next thread must fill the pipeline before instructions will be able to complete. More useful in reducing penalty of high cost stalls where pipeline fill is negligible compared to stall time

Simultaneous multithreading Simultaneous multithreading (SMT) is a variation on multithreading that uses the resources of a multiple issue, dynamically-scheduled processor to exploit TLP at the same time it exploits ILP. Modern multiple- issue processors often have more functional unit parallelism available than a single thread. With register renaming and dynamic scheduling, multiple instructions from independent threads can be issued without regard to the dependences among them; the resolution of the dependences can be handled by the dynamic scheduling capability.

Superscalar Processor Superscalar with no multithreading Superscalar with coarse-grained multithreading Superscalar with fine-grained multithreading Superscalar with Simultaneous multithreading

Multiprocessing Other than ILP, the only scalable and general purpose way to increase performance faster is through multiprocessing Increased importance of miultiprocessing Growing interest in high-end servers as cloud computing and software-as-a-service become more important Growth in data-intensive applications driven by the availability of massive amounts of data on the internet. Multiprocessors exploit thread level parallelism through two different software models Tightly coupled set of threads collaborating on a single task parallel processing Execution of multiple, relatively independent processes from one or more users request level parallelism such as database responding to queries multiprogramming

Multiprocessor Architecture multiple processors increase performance Flynn s proposed a simple model of categorizing all computers looked at the parallelism in the instruction and data streams and placed all the computers into one of the 4 categories: (Flynn s Taxonomy)

SISD uniprocessor SIMD The same instruction is executed by multiple processors using different data streams Exploit data level parallelism by applying the same operations to multiple items of data in parallel Each processor has its own data memory, but there is a single instruction memory and control processor, which fetches and dispatches the instruction The multimedia extension, vector architecture are the largest class of SIMD architectures. 11

MISD No commercial multiprocessor of this type has been built to date MIMD Each processor fetches its own instruction and operated on its own data They exploit TLP, bz. multiple threads operate in parallel In general, TLP is more flexible than DLP They offers flexibility. With the correct hardware and software, they can function as single user multiprocessors focusing on high performance for one application, as multi programmed multiprocessors running many tasks simultaneously, or as some combination of these functions. 12

With MIMD, each processor is executing its own instruction stream or process. A process is a segment of code that may be run independently The state of the process contains all the information necessary to execute that program on a processor It is also useful to be able to have multiple processors executing a single program and sharing the code and most of their address space When multiple process share code and data in this way, they are often called threads. To take advantage of an MIMD multiprocessors with n processors, we must have at least n threads or processes to execute. 13

The important qualitative distinction of TLP from ILP is that TLP is identified at a high level by the software system and that the threads consist of hundreds to millions of instructions that may be executed in parallel. Threads can also be used to exploit DLP, but with higher overhead The grain size (the amount of computation assigned to a thread) must be sufficiently large to exploit the parallelism efficiently. 14

MIMD MIMD multiprocessors fall into two classes, depending on the number of processors involved, which in turn dictates a memory organization and interconnect strategy Centralized shared memory architecture Small number of cores Share single memory with uniform memory latency Symmetric relationship to all processors uniform access time often called as Symmetric multiprocessors (SMPs) Distributed shared memory architecture Physically distributed memory Non-uniform memory access/latency (NUMA) Processors connected via direct (switched) and non-direct (multi-hop) interconnection networks

MIMD Centralized shared memory Distributed shared memory

Distributed shared memory Most of the access are to the local memory in the node Reduces latency for access to the memory Scales memory bandwidth

Models for communication and memory architecture A large multi processor must use multiple memories that are physically distributed with the processors There are two alternative architectural approaches that differ in the method used for communicating data among processors: Distributed shared-memory (DSM) architecture Communication occurs through a shared address space, as it does in a symmetric shared-memory architecture The physically separate memories can be addressed as one logically shared address space Memory reference can be made by any processor to any memory location Shared-memory refers to the shared address space The same physical address on two processors refers to the same location in memory Shared memory does not mean that there is a single centralized memory In contrast to symmetric shared memory multiprocessors which is also know as UMAs, the DSM multiprocessors are also known as NUMAs, since the access time depends on the location of a data word in memory

Centralized Shared-Memory Architectures Use of large, multilevel caches substantially reduce the memory bandwidth demands of a processor If memory bandwidth is reduced, multiple processors may be able to share the same memory Because of the small size of the processor and the significant reduction in bus bandwidth achieved by large caches, symmetric processors were extremely cost effective, provided that a sufficient amount of memory bandwidth existed. Symmetric shared-memory machines usually support the caching of both shared and private data

Private data are used by a single processor Shared data are used by multiple processors, essentially providing communication among the processors through reads and writes of the shared data When a private item is cached, its location is migrated to the cache, reducing the average access time as well as the memory bandwidth required (uniprocessor) When shared data are cached, the shared value may be replicated in multiple caches In addition to reduction in access latency and required memory band width, replication also provides a reduction in contention that may exist for shared data items that are being read by multiple processors simultaneously Caching of shared data introduces a new problem: cache coherence

Multiprocessor Cache Coherence Caching shared data introduces a new problem because the view of memory held by two different processors is through their individual caches, which with out any additional precautions, could end up seeing two different values cache coherence problem

Memory system is coherent if any read of a data item returns the most recently written value of that data item. Two different aspects of memory system Coherence, defines what values can be returned by a read Consistency, determines when a written value will be returned by a read

A memory system is coherent if: A read by a processor P to a location X that follows a write by P to X, with no writes of X by another processor occurring between the write and the read by P, always returns the value written by P. preserves program order A read by a processor to location X that follows a write by another processor to X return the written value if the read and write are sufficiently separated in time and no other writes to X occur between the two accesses. coherence Write to the same location are serialized, that is two writes to the same location by any two processors are seen in the same order by all processors. If the value 1 and 2 are written to a location, processors can never read the value of the location as 2 and then later read it as 1. serialization

Question of when a written value will be seen is also important The issue of exactly when a written value must be seen by a reader is defined by a memory consistency model Coherence and consistency are complementary Coherence defines the behavior of reads and writes to the same memory location, while consistency defines the behavior of reads and writes with respect to accesses to other memory locations Make following assumptions: A write does not complete until all processors have seen the effect of that write The processor does not change the order of any write w.r.t. any other memory access These assumptions means that if a processor write location A followed by B, any processor that sees the new value of B must also see the new value of A These restrictions allow the processor to reorder the reads, but forces the processor to finish a write in program order

Basic Schemes for Enforcing Coherence A program running on multi processors will have copies of the same data in several caches. In a coherent multi processor, the caches provide both migration and replication of shared data items. Coherent caches provides migration - data item can be moved to a local cache and used there in a transparent fashion, reducing both the latency and the BW demand on the shared data Coherent caches also provide replication for shared data that are being simultaneously read, since the caches make a copy of the data item in the local cache, reducing both latency and contention for a read shared data item. Supporting this migration and replication is critical to performance in accessing shared data Small scale multi processors adopt a hardware solution by introducing a protocol to maintain coherent caches

Basic Schemes for Enforcing Coherence The protocol to maintain coherence for multiple processors are called cache coherence protocols. Key to implementing a cache coherence protocol is tracking the state of any sharing of data block. There are two classes of protocols: Directory based - the sharing status of a block of physical memory is kept in just one location, called the directory Snooping - every cache that has a copy of the data from a block of physical memory also has a copy of the sharing status of the block, but no centralized status is kept. These caches are all accessible via some broadcast medium and all cache controllers monitor or snoop on the medium to determine whether or not they have a copy of a block that is requested on a bus Snooping Protocols Write invalidate protocol Write update or write broadcast protocol

Snooping Protocols Write invalidate Protocol to ensure that a processor has exclusive access to a data item before it writes that item because it invalidates other copies on a write. Exclusive access ensures that no other readable or writable copies of an item exist when the write occurs. All other cache copies of the item are invalidated.

Snooping Protocols Consider a write followed by a read by another processor: since the write requires exclusive access, any copy held by the reading processor must be invalidated. When the read occurs, it misses in the cache and is forced to fetch the new copy of the data For a write, prevent any other processor from being able to write simultaneously If two processors try to write the same data simultaneously, one of them will win, causing the other processor s copy to be invalidated. For the other processor to complete its write, it must obtain a new copy of the data, which must now contain the updated value. Therefore this protocol enforces write serialization

Snooping Protocols Write update or write broadcast protocol - update all the cached copies of a data item when that item is written. A write update protocol must broadcast all writes to shared cache lines, it consumes considerably more bandwidth. For this reason, all recent multiprocessors have opted to implement a write invalidate protocol.

Basic Implementation Techniques The key to implementing an invalidate protocol is the use of the bus, or another broadcast medium, to perform invalidates. To perform an invalidate, the processor acquires bus access and broadcasts the address to be invalidated on the bus The processors check whether the address on the bus is in their cache. If so, the corresponding data in the cache are invalidated When a write to a block that is shared occurs, the writing processor must acquire bus access to broadcast its invalidation If two processors attempt to write shared blocks at the same time, their attempts to broadcast an invalidate operation will be serialized when they arbitrate for the bus

The first processor to obtain bus access will cause any other copies of the block it is writing to be invalidated If the processors were attempting to write to the same block, the serialization enforced by the bus also serializes their writes All coherence schemes require some sort of serializing access to the communication medium or another shared structure In addition to invalidating outstanding copies of a cache block that is being written into, it is required to locate a data item when a cache miss occurs In a write-through cache, it is easy to find the recent value of the data item, since all written data are always sent to the memory, from which most recent value of data can be fetched. In a design with adequate memory bandwidth to support the write traffic, using write-through simplifies the implementation of cache coherence

For a write-back cache, finding the most recent value is harder, since the most recent value can be in a cache rather than in memory Write-back cache can use the same snooping scheme both for cache miss and for writes Each processor snoops every address placed on the bus If a processor finds that it has a dirty copy of the requested cache, it provides that cache block in response to the read request and causes the memory access to be aborted. The additional complexity comes from having to retrieve the cache block from the processor s cache, which often take longer time than retrieving form shared memory if the processor are in separate chips. Since write-back caches generate lower requirements for memory bandwidth, they support larger number of faster processors and used in most multiprocessors.

For a write-back cache, finding the most recent value is harder, since the most recent value can be in a cache rather than in memory Write-back cache can use the same snooping scheme both for cache miss and for writes Each processor snoops every address placed on the bus If a processor finds that it has a dirty copy of the requested cache, it provides that cache block in response to the read request and causes the memory access to be aborted. The additional complexity comes from having to retrieve the cache block from the processor s cache, which often take longer time than retrieving form shared memory if the processor are in separate chips. Since write-back caches generate lower requirements for memory bandwidth, they support larger number of faster processors and used in most multiprocessors.