CS252 Graduate Computer Architecture Lecture 12 Multithreading / Vector Processing March 2 nd, 2011 John Kubiatowicz Electrical Engineering and Computer.

Slides:



Advertisements
Similar presentations
Computer Organization and Architecture
Advertisements

CS136, Advanced Architecture Limits to ILP Simultaneous Multithreading.
Multithreading processors Adapted from Bhuyan, Patterson, Eggers, probably others.
Microprocessor Microarchitecture Multithreading Lynn Choi School of Electrical Engineering.
/ Computer Architecture and Design Instructor: Dr. Michael Geiger Summer 2014 Lecture 6: Speculation.
CSE 490/590, Spring 2011 CSE 490/590 Computer Architecture Multithreading II Steve Ko Computer Sciences and Engineering University at Buffalo.
CS252 Graduate Computer Architecture Lecture 11 Limits to ILP / Multithreading March 1 st, 2010 John Kubiatowicz Electrical Engineering and Computer Sciences.
CS 252 Graduate Computer Architecture Lecture 13: Multithreading Krste Asanovic Electrical Engineering and Computer Sciences University of California,
1 COMP 206: Computer Architecture and Implementation Montek Singh Mon, Dec 5, 2005 Topic: Intro to Multiprocessors and Thread-Level Parallelism.
April 6, 2010CS152, Spring 2010 CS 152 Computer Architecture and Engineering Lecture 18: Multithreading Krste Asanovic Electrical Engineering and Computer.
CS 152 Computer Architecture and Engineering Lecture 18: Multithreading Krste Asanovic Electrical Engineering and Computer Sciences University of California,
CS 162 Computer Architecture Lecture 10: Multithreading Instructor: L.N. Bhuyan Adopted from Internet.
Multithreading and Dataflow Architectures CPSC 321 Andreas Klappenecker.
Simultaneous Multithreading:Maximising On-Chip Parallelism Dean Tullsen, Susan Eggers, Henry Levy Department of Computer Science, University of Washington,Seattle.
Krste Asanovic Electrical Engineering and Computer Sciences
CPE 731 Advanced Computer Architecture Thread Level Parallelism Dr. Gheith Abandah Adapted from the slides of Prof. David Patterson, University of California,
CSE 502 Graduate Computer Architecture Lec 10 –Simultaneous Multithreading Larry Wittie Computer Science, StonyBrook University
CPE 631: Multithreading: Thread-Level Parallelism Within a Processor Electrical and Computer Engineering University of Alabama in Huntsville Aleksandar.
Limits to ILP How much ILP is available using existing mechanisms with increasing HW budgets? Do we need to invent new HW/SW mechanisms to keep on processor.
1 Multi-core processors 12/1/09. 2 Multiprocessors inside a single chip It is now possible to implement multiple processors (cores) inside a single chip.
POLITECNICO DI MILANO Parallelism in wonderland: are you ready to see how deep the rabbit hole goes? Multithreaded and multicore processors Marco D. Santambrogio:
CS252 Graduate Computer Architecture Lecture 12 Multithreading / Vector Processing February 29 th, 2012 John Kubiatowicz Electrical Engineering and Computer.
Hardware Multithreading. Increasing CPU Performance By increasing clock frequency By increasing Instructions per Clock Minimizing memory access impact.
Larry Wittie Computer Science, StonyBrook University and ~lw
© Krste Asanovic, 2015CS252, Spring 2015, Lecture 13 CS252 Graduate Computer Architecture Fall 2015 Lecture 13: Multithreading Krste Asanovic
Chapter 8 CPU and Memory: Design, Implementation, and Enhancement The Architecture of Computer Hardware and Systems Software: An Information Technology.
Thread Level Parallelism Since ILP has inherent limitations, can we exploit multithreading? –a thread is defined as a separate process with its own instructions.
12/14 Multi-Hyper thread.1 Mutli-threading, Hyperthreading & Chip Multiprocessing (CMP) Beyond ILP: thread level parallelism (TLP) Multithreaded microarchitectures.
On-chip Parallelism Alvin R. Lebeck CPS 221 Week 13, Lecture 2.
Csci 211 Computer System Architecture Limits on ILP and Simultaneous Multithreading Xiuzhen Cheng Department of Computer Sciences The George Washington.
Chapter 3.4: Loop-Level Parallelism and Thread-Level Parallelism
Advanced Computer Architecture pg 1 Embedded Computer Architecture 5SAI0 Chip Multi-Processors (ch 8) Henk Corporaal
Jan. 5, 2000Systems Architecture II1 Machine Organization (CS 570) Lecture 1: Overview of High Performance Processors * Jeremy R. Johnson Wed. Sept. 27,
Computer Structure 2015 – Intel ® Core TM μArch 1 Computer Structure Multi-Threading Lihu Rappoport and Adi Yoaz.
On-chip Parallelism Alvin R. Lebeck CPS 220/ECE 252.
High Performance Computing1 High Performance Computing (CS 680) Lecture 2a: Overview of High Performance Processors * Jeremy R. Johnson *This lecture was.
1 Chapter 3: Limits on ILP Limits to ILP (another perspective) Thread Level Parallelism Multithreading Simultaneous Multithreading Power 4 vs. Power 5.
Advanced Computer Architecture 5MD00 / 5Z033 SMT Simultaneously Multi-Threading Henk Corporaal TUEindhoven.
Ch3. Limits on Instruction-Level Parallelism 1. ILP Limits 2. SMT (Simultaneous Multithreading) ECE562/468 Advanced Computer Architecture Prof. Honggang.
COMP 740: Computer Architecture and Implementation
Electrical and Computer Engineering
Limits to ILP How much ILP is available using existing mechanisms with increasing HW budgets? Do we need to invent new HW/SW mechanisms to keep on processor.
/ Computer Architecture and Design
Krste Asanovic Electrical Engineering and Computer Sciences
CPE 731 Advanced Computer Architecture Thread Level Parallelism
Simultaneous Multithreading
Multi-core processors
Computer Structure Multi-Threading
Limits on ILP and Multithreading
Chapter 14 Instruction Level Parallelism and Superscalar Processors
Chapter 3: ILP and Its Exploitation
Embedded Computer Architecture 5SAI0 Chip Multi-Processors (ch 8)
/ Computer Architecture and Design
Lec 10 – Example Architectures - Simultaneous Multithreading
Advanced Computer Architecture 5MD00 / 5Z033 SMT Simultaneously Multi-Threading Henk Corporaal TUEindhoven.
John Kubiatowicz Electrical Engineering and Computer Sciences
Electrical and Computer Engineering
Advanced Computer Architecture 5MD00 / 5Z033 SMT Simultaneously Multi-Threading Henk Corporaal TUEindhoven.
Levels of Parallelism within a Single Processor
Limits to ILP Conflicting studies of amount
Hardware Multithreading
CPE 631: Multithreading: Thread-Level Parallelism Within a Processor
/ Computer Architecture and Design
Embedded Computer Architecture 5SAI0 Chip Multi-Processors (ch 8)
CSC3050 – Computer Architecture
Levels of Parallelism within a Single Processor
The University of Adelaide, School of Computer Science
Advanced Computer Architecture 5MD00 / 5Z032 SMT Simultaneously Multi-Threading Henk Corporaal TUEindhoven.
Chapter 3: Limits of Instruction-Level Parallelism
Presentation transcript:

CS252 Graduate Computer Architecture Lecture 12 Multithreading / Vector Processing March 2 nd, 2011 John Kubiatowicz Electrical Engineering and Computer Sciences University of California, Berkeley

3/2/2011 cs252-S11, Lecture 12 2 Performance beyond single thread ILP There can be much higher natural parallelism in some applications –e.g., Database or Scientific codes –Explicit Thread Level Parallelism or Data Level Parallelism Thread: instruction stream with own PC and data –thread may be a process part of a parallel program of multiple processes, or it may be an independent program –Each thread has all the state (instructions, data, PC, register state, and so on) necessary to allow it to execute Thread Level Parallelism (TLP): –Exploit the parallelism inherent between threads to improve performance Data Level Parallelism (DLP): –Perform identical operations on data, and lots of data

3/2/2011 cs252-S11, Lecture 12 3 One approach to exploiting threads: Multithreading (TLP within processor) Multithreading: multiple threads to share the functional units of 1 processor via overlapping –processor must duplicate independent state of each thread e.g., a separate copy of register file, a separate PC, and for running independent programs, a separate page table –memory shared through the virtual memory mechanisms, which already support multiple processes –HW for fast thread switch; much faster than full process switch  100s to 1000s of clocks When switch? –Alternate instruction per thread (fine grain) –When a thread is stalled, perhaps for a cache miss, another thread can be executed (coarse grain)

3/2/2011 cs252-S11, Lecture 12 4 Fine-Grained Multithreading Switches between threads on each instruction, causing the execution of multiples threads to be interleaved –Usually done in a round-robin fashion, skipping any stalled threads –CPU must be able to switch threads every clock Advantage: –can hide both short and long stalls, since instructions from other threads executed when one thread stalls Disadvantage: –slows down execution of individual threads, since a thread ready to execute without stalls will be delayed by instructions from other threads Used on Sun’s Niagra (recent), several research multiprocessors, Tera

3/2/2011 cs252-S11, Lecture 12 5 Course-Grained Multithreading Switches threads only on costly stalls, such as L2 cache misses Advantages –Relieves need to have very fast thread-switching –Doesn’t slow down thread, since instructions from other threads issued only when the thread encounters a costly stall Disadvantage is hard to overcome throughput losses from shorter stalls, due to pipeline start-up costs –Since CPU issues instructions from 1 thread, when a stall occurs, the pipeline must be emptied or frozen –New thread must fill pipeline before instructions can complete Because of this start-up overhead, coarse-grained multithreading is better for reducing penalty of high cost stalls, where pipeline refill << stall time Used in IBM AS/400, Sparcle (for Alewife)

3/2/2011 cs252-S11, Lecture 12 6 Simultaneous Multithreading (SMT): Do both ILP and TLP TLP and ILP exploit two different kinds of parallel structure in a program Could a processor oriented at ILP to exploit TLP? –functional units are often idle in data path designed for ILP because of either stalls or dependences in the code Could the TLP be used as a source of independent instructions that might keep the processor busy during stalls? Could TLP be used to employ the functional units that would otherwise lie idle when insufficient ILP exists?

3/2/2011 cs252-S11, Lecture 12 7 Justification: For most apps, most execution units lie idle From: Tullsen, Eggers, and Levy, “Simultaneous Multithreading: Maximizing On-chip Parallelism, ISCA For an 8-way superscalar.

3/2/2011 cs252-S11, Lecture 12 8 Simultaneous Multi-threading MMFX FP BRCC Cycle One thread, 8 units M = Load/Store, FX = Fixed Point, FP = Floating Point, BR = Branch, CC = Condition Codes MMFX FP BRCC Cycle Two threads, 8 units

3/2/2011 cs252-S11, Lecture 12 9 Simultaneous Multithreading Details Simultaneous multithreading (SMT): insight that dynamically scheduled processor already has many HW mechanisms to support multithreading –Large set of virtual registers that can be used to hold the register sets of independent threads –Register renaming provides unique register identifiers, so instructions from multiple threads can be mixed in datapath without confusing sources and destinations across threads –Out-of-order completion allows the threads to execute out of order, and get better utilization of the HW Just adding a per thread renaming table and keeping separate PCs –Independent commitment can be supported by logically keeping a separate reorder buffer for each thread Source: Micrprocessor Report, December 6, 1999 “Compaq Chooses SMT for Alpha”

3/2/2011 cs252-S11, Lecture Design Challenges in SMT Since SMT makes sense only with fine-grained implementation, impact of fine-grained scheduling on single thread performance? –A preferred thread approach sacrifices neither throughput nor single-thread performance? –Unfortunately, with a preferred thread, the processor is likely to sacrifice some throughput, when preferred thread stalls Larger register file needed to hold multiple contexts Clock cycle time, especially in: –Instruction issue - more candidate instructions need to be considered –Instruction completion - choosing which instructions to commit may be challenging Ensuring that cache and TLB conflicts generated by SMT do not degrade performance

3/2/2011 cs252-S11, Lecture Power 4 Single-threaded predecessor to Power 5. 8 execution units in out-of-order engine, each may issue an instruction each cycle.

3/2/2011 cs252-S11, Lecture Power 4 Power 5 2 fetch (PC), 2 initial decodes 2 commits (architected register sets)

3/2/2011 cs252-S11, Lecture Power 5 data flow... Why only 2 threads? With 4, one of the shared resources (physical registers, cache, memory bandwidth) would be prone to bottleneck

3/2/2011 cs252-S11, Lecture Power 5 thread performance... Relative priority of each thread controllable in hardware. For balanced operation, both threads run slower than if they “owned” the machine.

3/2/2011 cs252-S11, Lecture Changes in Power 5 to support SMT Increased associativity of L1 instruction cache and the instruction address translation buffers Added per thread load and store queues Increased size of the L2 (1.92 vs MB) and L3 caches Added separate instruction prefetch and buffering per thread Increased the number of virtual registers from 152 to 240 Increased the size of several issue queues The Power5 core is about 24% larger than the Power4 core because of the addition of SMT support

3/2/2011 cs252-S11, Lecture Initial Performance of SMT Pentium 4 Extreme SMT yields 1.01 speedup for SPECint_rate benchmark and 1.07 for SPECfp_rate –Pentium 4 is dual threaded SMT –SPECRate requires that each SPEC benchmark be run against a vendor-selected number of copies of the same benchmark Running on Pentium 4 each of 26 SPEC benchmarks paired with every other (26 2 runs) speed-ups from 0.90 to 1.58; average was 1.20 Power 5, 8 processor server 1.23 faster for SPECint_rate with SMT, 1.16 faster for SPECfp_rate Power 5 running 2 copies of each app speedup between 0.89 and 1.41 –Most gained some –Fl.Pt. apps had most cache conflicts and least gains

3/2/2011 cs252-S11, Lecture Multithreaded Categories Time (processor cycle) SuperscalarFine-GrainedCoarse-Grained Multiprocessing Simultaneous Multithreading Thread 1 Thread 2 Thread 3 Thread 4 Thread 5 Idle slot

3/2/2011 cs252-S11, Lecture Administrivia Exam: Wednesday 3/30 Location: 320 Soda TIME: 2:30-5:30 –This info is on the Lecture page (has been) –Get on 8 ½ by 11 sheet of notes (both sides) –Meet at LaVal’s afterwards for Pizza and Beverages CS252 First Project proposal due by Friday 3/4 –Need two people/project (although can justify three for right project) –Complete Research project in 9 weeks »Typically investigate hypothesis by building an artifact and measuring it against a “base case” »Generate conference-length paper/give oral presentation »Often, can lead to an actual publication.

3/2/2011 cs252-S11, Lecture Discussion of SPARCLE paper Example of close coupling between processor and memory controller (CMMU) –All of features mentioned in this paper implemented by combination of processor and memory controller –Some functions implemented as special “coprocessor” instructions –Others implemented as “Tagged” loads/stores/swaps Course Grained Multithreading –Using SPARC register windows –Automatic synchronous trap on cache miss –Fast handling of all other traps/interrupts (great for message interface!) –Multithreading half in hardware/half software (hence 14 cycles) Fine Grained Synchronization –Full-Empty bit/32 bit word (effectively 33 bits) »Groups of 4 words/cache line  F/E bits put into memory TAG –Fast TRAP on bad condition –Multiple instructions. Examples: »LDT (load/trap if empty) »LDET (load/set empty/trap if empty) »STF (Store/set full) »STFT (store/set full/trap if full)

3/2/2011 cs252-S11, Lecture Discussion of Papers: Sparcle (Con’t) Message Interface –Closely couple with processor »Interface at speed of first-level cache –Atomic message launch: »Describe message (including DMA ops) with simple stio insts »Atomic launch instruction (ipilaunch) –Message Reception »Possible interrupt on message receive: use fast context switch »Examine message with simple ldio instructions »Discard in pieces, possibly with DMA »Free message (ipicst, i.e “coherent storeback”) We will talk about message interface in greater detail

3/2/2011 cs252-S11, Lecture Supercomputers Definition of a supercomputer: Fastest machine in world at given task A device to turn a compute-bound problem into an I/O bound problem Any machine costing $30M+ Any machine designed by Seymour Cray CDC6600 (Cray, 1964) regarded as first supercomputer

3/2/2011 cs252-S11, Lecture Vector Supercomputers Epitomized by Cray-1, 1976: Scalar Unit + Vector Extensions Load/Store Architecture Vector Registers Vector Instructions Hardwired Control Highly Pipelined Functional Units Interleaved Memory System No Data Caches No Virtual Memory

3/2/2011 cs252-S11, Lecture Cray-1 (1976)

3/2/2011 cs252-S11, Lecture Cray-1 (1976) Single Port Memory 16 banks of 64-bit words + 8-bit SECDED 80MW/sec data load/store 320MW/sec instruction buffer refill 4 Instruction Buffers 64-bitx16 NIP LIP CIP (A 0 ) ( (A h ) + j k m ) 64 T Regs (A 0 ) ( (A h ) + j k m ) 64 B Regs S0 S1 S2 S3 S4 S5 S6 S7 A0 A1 A2 A3 A4 A5 A6 A7 SiSi T jk AiAi B jk FP Add FP Mul FP Recip Int Add Int Logic Int Shift Pop Cnt SjSj SiSi SkSk Addr Add Addr Mul AjAj AiAi AkAk memory bank cycle 50 ns processor cycle 12.5 ns (80MHz) V0 V1 V2 V3 V4 V5 V6 V7 VkVk VjVj ViVi V. Mask V. Length 64 Element Vector Registers

3/2/2011 cs252-S11, Lecture [0][1][VLR-1] Vector Arithmetic Instructions ADDV v3, v1, v2 v3 v2 v1 Scalar Registers r0 r15 Vector Registers v0 v15 [0][1][2][VLRMAX-1] VLR Vector Length Register v1 Vector Load and Store Instructions LV v1, r1, r2 Base, r1Stride, r2 Memory Vector Register Vector Programming Model

3/2/2011 cs252-S11, Lecture Multithreading and Vector Summary Explicitly parallel (Data level parallelism or Thread level parallelism) is next step to performance Coarse grain vs. Fine grained multihreading –Only on big stall vs. every clock cycle Simultaneous Multithreading if fine grained multithreading based on OOO superscalar microarchitecture –Instead of replicating registers, reuse rename registers Vector is alternative model for exploiting ILP –If code is vectorizable, then simpler hardware, more energy efficient, and better real-time model than Out-of-order machines –Design issues include number of lanes, number of functional units, number of vector registers, length of vector registers, exception handling, conditional operations Fundamental design issue is memory bandwidth –With virtual address translation and caching