Getting CPI under 1: Outline

Similar documents
NOW Handout Page 1. Review from Last Time #1. CSE 820 Graduate Computer Architecture. Lec 8 Instruction Level Parallelism. Outline

CSE 820 Graduate Computer Architecture. week 6 Instruction Level Parallelism. Review from Last Time #1

5008: Computer Architecture

EEC 581 Computer Architecture. Instruction Level Parallelism (3.6 Hardware-based Speculation and 3.7 Static Scheduling/VLIW)

EEC 581 Computer Architecture. Lec 7 Instruction Level Parallelism (2.6 Hardware-based Speculation and 2.7 Static Scheduling/VLIW)

ESE 545 Computer Architecture Instruction-Level Parallelism (ILP): Speculation, Reorder Buffer, Exceptions, Superscalar Processors, VLIW

Hardware-Based Speculation

TDT 4260 lecture 7 spring semester 2015

CISC 662 Graduate Computer Architecture Lecture 13 - CPI < 1

Donn Morrison Department of Computer Science. TDT4255 ILP and speculation

Computer Science 246 Computer Architecture

Lecture 8 Dynamic Branch Prediction, Superscalar and VLIW. Computer Architectures S

Four Steps of Speculative Tomasulo cycle 0

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

CS425 Computer Systems Architecture

Computer Architecture A Quantitative Approach, Fifth Edition. Chapter 3. Instruction-Level Parallelism and Its Exploitation

Exploiting ILP with SW Approaches. Aleksandar Milenković, Electrical and Computer Engineering University of Alabama in Huntsville

Instruction-Level Parallelism (ILP)

Copyright 2012, Elsevier Inc. All rights reserved.

Hardware-Based Speculation

UNIT 8 1. Explain in detail the hardware support for preserving exception behavior during Speculation.

EE 4683/5683: COMPUTER ARCHITECTURE

Adapted from David Patterson s slides on graduate computer architecture

Multi-cycle Instructions in the Pipeline (Floating Point)

HY425 Lecture 09: Software to exploit ILP

Hardware-based Speculation

HY425 Lecture 09: Software to exploit ILP

Computer Science 146. Computer Architecture

Lecture 9: Multiple Issue (Superscalar and VLIW)

Handout 2 ILP: Part B

CPI < 1? How? What if dynamic branch prediction is wrong? Multiple issue processors: Speculative Tomasulo Processor

Outline EEL 5764 Graduate Computer Architecture. Chapter 2 - Instruction Level Parallelism. Recall from Pipelining Review

Load1 no Load2 no Add1 Y Sub Reg[F2] Reg[F6] Add2 Y Add Reg[F2] Add1 Add3 no Mult1 Y Mul Reg[F2] Reg[F4] Mult2 Y Div Reg[F6] Mult1

Computer Systems Architecture

Static vs. Dynamic Scheduling

Super Scalar. Kalyan Basu March 21,

Chapter 3: Instruction Level Parallelism (ILP) and its exploitation. Types of dependences

EI 338: Computer Systems Engineering (Operating Systems & Computer Architecture)

EECC551 - Shaaban. 1 GHz? to???? GHz CPI > (?)

Hiroaki Kobayashi 12/21/2004

Advanced issues in pipelining

TDT 4260 TDT ILP Chap 2, App. C

Page 1. CISC 662 Graduate Computer Architecture. Lecture 8 - ILP 1. Pipeline CPI. Pipeline CPI (I) Pipeline CPI (II) Michela Taufer

Administrivia. CMSC 411 Computer Systems Architecture Lecture 14 Instruction Level Parallelism (cont.) Control Dependencies

CPI IPC. 1 - One At Best 1 - One At best. Multiple issue processors: VLIW (Very Long Instruction Word) Speculative Tomasulo Processor

Page # CISC 662 Graduate Computer Architecture. Lecture 8 - ILP 1. Pipeline CPI. Pipeline CPI (I) Michela Taufer

ILP: Instruction Level Parallelism

Outline Review: Basic Pipeline Scheduling and Loop Unrolling Multiple Issue: Superscalar, VLIW. CPE 631 Session 19 Exploiting ILP with SW Approaches

Instruction-Level Parallelism and Its Exploitation

Several Common Compiler Strategies. Instruction scheduling Loop unrolling Static Branch Prediction Software Pipelining

Computer Science 146. Computer Architecture

CS433 Midterm. Prof Josep Torrellas. October 19, Time: 1 hour + 15 minutes

Page 1. Recall from Pipelining Review. Lecture 16: Instruction Level Parallelism and Dynamic Execution #1: Ideas to Reduce Stalls

As the amount of ILP to exploit grows, control dependences rapidly become the limiting factor.

Instruction Level Parallelism

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

CS 2410 Mid term (fall 2015) Indicate which of the following statements is true and which is false.

DYNAMIC AND SPECULATIVE INSTRUCTION SCHEDULING

Recall from Pipelining Review. Lecture 16: Instruction Level Parallelism and Dynamic Execution #1: Ideas to Reduce Stalls

Pipelining and Exploiting Instruction-Level Parallelism (ILP)

Exploitation of instruction level parallelism

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

INSTRUCTION LEVEL PARALLELISM

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

Metodologie di Progettazione Hardware-Software

Hardware-based speculation (2.6) Multiple-issue plus static scheduling = VLIW (2.7) Multiple-issue, dynamic scheduling, and speculation (2.

ILP concepts (2.1) Basic compiler techniques (2.2) Reducing branch costs with prediction (2.3) Dynamic scheduling (2.4 and 2.5)

Lecture 6 MIPS R4000 and Instruction Level Parallelism. Computer Architectures S

Lecture: Static ILP. Topics: predication, speculation (Sections C.5, 3.2)

Computer Architecture 计算机体系结构. Lecture 4. Instruction-Level Parallelism II 第四讲 指令级并行 II. Chao Li, PhD. 李超博士

Instruction Level Parallelism. ILP, Loop level Parallelism Dependences, Hazards Speculation, Branch prediction

NOW Handout Page 1. COSC 5351 Advanced Computer Architecture

EEC 581 Computer Architecture. Lec 4 Instruction Level Parallelism

CMSC411 Fall 2013 Midterm 2 Solutions

Chapter 4 The Processor 1. Chapter 4D. The Processor

計算機結構 Chapter 4 Exploiting Instruction-Level Parallelism with Software Approaches

Instruction Frequency CPI. Load-store 55% 5. Arithmetic 30% 4. Branch 15% 4

Instruction Level Parallelism. Appendix C and Chapter 3, HP5e

UG4 Honours project selection: Talk to Vijay or Boris if interested in computer architecture projects

Lecture 5: VLIW, Software Pipelining, and Limits to ILP. Review: Tomasulo

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

What is ILP? Instruction Level Parallelism. Where do we find ILP? How do we expose ILP?

Page 1. Recall from Pipelining Review. Lecture 15: Instruction Level Parallelism and Dynamic Execution

EECC551 Exam Review 4 questions out of 6 questions

Chapter 3 (CONT II) Instructor: Josep Torrellas CS433. Copyright J. Torrellas 1999,2001,2002,2007,

Instruction-Level Parallelism. Instruction Level Parallelism (ILP)

Compiler Optimizations. Lecture 7 Overview of Superscalar Techniques. Memory Allocation by Compilers. Compiler Structure. Register allocation

Dynamic Scheduling. CSE471 Susan Eggers 1

Chapter 4. Advanced Pipelining and Instruction-Level Parallelism. In-Cheol Park Dept. of EE, KAIST

CS252 Graduate Computer Architecture Lecture 6. Recall: Software Pipelining Example

ELEC 5200/6200 Computer Architecture and Design Fall 2016 Lecture 9: Instruction Level Parallelism

Lecture 5: VLIW, Software Pipelining, and Limits to ILP Professor David A. Patterson Computer Science 252 Spring 1998

Multiple Instruction Issue. Superscalars

Processor (IV) - advanced ILP. Hwansoo Han

Lecture 19: Instruction Level Parallelism

CPE 631 Lecture 09: Instruction Level Parallelism and Its Dynamic Exploitation

Instruction Level Parallelism. Taken from

Lecture 10: Static ILP Basics. Topics: loop unrolling, static branch prediction, VLIW (Sections )

Advanced Pipelining and Instruction- Level Parallelism 4

EITF20: Computer Architecture Part3.2.1: Pipeline - 3

Transcription:

CMSC 411 Computer Systems Architecture Lecture 12 Instruction Level Parallelism 5 (Improving CPI) Getting CPI under 1: Outline More ILP VLIW branch target buffer return address predictor superscalar more register renaming value prediction conditional instructions speculative loads superscalar Limits to ILP Threading fine/coarse simultaneous multithreading CMSC 411-11 (from Patterson) 2 CS252 S05 1

Getting CPI below 1 CPI 1 if issue only 1 instruction every clock cycle Multiple-issue processors come in 3 flavors: Statically-scheduled superscalar processors Dynamically-scheduled superscalar processors VLIW (very long instruction word) processors CMSC 411-11 (from Patterson) 3 Getting CPI below 1 2 types of superscalar processors issue varying numbers of instructions per clock Use in-order execution if they are statically scheduled, or Out-of-order execution if they are dynamically scheduled VLIW processors, in contrast, issue a fixed number of instructions formatted either as one large instruction or as a fixed instruction packet with the parallelism among instructions explicitly indicated by the instruction (Intel/HP Itanium) CMSC 411-11 (from Patterson) 4 CS252 S05 2

VLIW: Very Large Instruction Word Each instruction has explicit coding for multiple operations In IA-64, grouping called a packet In Transmeta, grouping called a molecule (with atoms as ops) Tradeoff instruction space for simple decoding The long instruction word has room for many operations By definition, all the operations the compiler puts in the long instruction word are independent execute in parallel E.g., 2 integer operations, 2 FP ops, 2 Memory refs, 1 branch» 16 to 24 bits per field 7*16 or 112 bits to 7*24 or 168 bits wide Need compiling technique that schedules across several branches CMSC 411-11 (from Patterson) 5 Recall: Unrolled Loop that Minimizes Stalls for Scalar 1 Loop: L.D F0,0(R1) L.D to ADD.D: 1 Cycle 2 L.D F6,-8(R1) ADD.D to S.D: 2 Cycles 3 L.D F10,-16(R1) 4 L.D F14,-24(R1) 5 ADD.D F4,F0,F2 6 ADD.D F8,F6,F2 7 ADD.D F12,F10,F2 8 ADD.D F16,F14,F2 9 S.D 0(R1),F4 10 S.D -8(R1),F8 11 DSUBUI R1,R1,#32 12 S.D -16(R1),F12 13 BNEZ R1,LOOP 14 S.D 8(R1),F16 ; 8-32 = -24 14 clock cycles, or 3.5 per iteration CMSC 411-11 (from Patterson) 6 CS252 S05 3

Loop Unrolling in VLIW Memory Memory FP FP Int. op/ Clock reference 1 reference 2 operation 1 op. 2 branch L.D F0,0(R1) L.D F6,-8(R1) 1 L.D F10,-16(R1) L.D F14,-24(R1) 2 L.D F18,-32(R1) L.D F22,-40(R1) ADD.D F4,F0,F2 ADD.D F8,F6,F2 3 L.D F26,-48(R1) ADD.D F12,F10,F2 ADD.D F16,F14,F2 4 ADD.D F20,F18,F2 ADD.D F24,F22,F2 5 S.D 0(R1),F4 S.D -8(R1),F8 ADD.D F28,F26,F2 6 S.D -16(R1),F12 S.D -24(R1),F16 DSUBUI R1,R1,#48 7 S.D 16(R1),F20 S.D 8(R1),F24 8 S.D -0(R1),F28 BNEZ R1,LOOP 9 Unrolled 7 times to avoid delays 7 results in 9 clocks, or 1.3 clocks per iteration (1.8X) Average: 2.5 ops per clock, 50% efficiency Note: Need more registers in VLIW (15 vs. 6 in SS) CMSC 411-11 (from Patterson) 7 Problems with 1st Generation VLIW Increase in code size Generating enough operations in a straight-line code fragment requires ambitiously unrolling loops Whenever VLIW instructions are not full, unused functional units translate to wasted bits in instruction encoding CMSC 411-11 (from Patterson) 8 CS252 S05 4

Problems with 1st Generation VLIW Operated in lock-step; no hazard detection HW Stall in any functional unit pipeline caused entire processor to stall, since all functional units must be kept synchronized Caches hard to predict Binary code compatibility Pure VLIW different numbers of functional units and unit latencies require different versions of the code CMSC 411-11 (from Patterson) 9 Intel/HP IA-64 Explicitly Parallel Instruction Computer (EPIC) IA-64: instruction set architecture 128 64-bit integer regs + 128 82-bit floating point regs Not separate register files per functional unit as in old VLIW Hardware checks dependencies (interlocks binary compatibility over time) Predicated execution (select 1 out of 64 1-bit flags) 40% fewer mispredictions? CMSC 411-11 (from Patterson) 10 CS252 S05 5

Intel/HP IA-64 Explicitly Parallel Instruction Computer (EPIC) Itanium was first implementation (2001) Highly parallel and deeply pipelined hardware at 800Mhz 6-wide, 10-stage pipeline at 800Mhz on 0.18 µ process Itanium 2 is name of 2nd implementation (2005) 6-wide, 8-stage pipeline at 1666Mhz on 0.13 µ process Caches: 32 KB I, 32 KB D, 128 KB L2I, 128 KB L2D, 9216 KB L3 CMSC 411-11 (from Patterson) 11 IF BW: Return Address Predictor Small buffer of return addresses acts as a stack Caches most recent return addresses Call Push a return address on stack Return Pop an address off stack & predict as new PC Misprediction frequency 70% 60% 50% 40% 30% 20% 10% 0% Figure 2.25 SPEC95 go m88ksim cc1 compress xlisp ijpeg perl vortex 0 1 2 4 8 16 Return address buffer entries CMSC 411-11 (from Patterson) 12 CS252 S05 6

More Instruction Fetch Bandwidth Integrated branch prediction branch predictor is part of instruction fetch unit and is constantly predicting branches Instruction prefetch Instruction fetch units prefetch to deliver multiple instruct. per clock, integrating it with branch prediction Instruction memory access and buffering Fetching multiple instructions per cycle:» May require accessing multiple cache blocks (prefetch to hide cost of crossing cache blocks)» Provides buffering, acting as on-demand unit to provide instructions to issue stage as needed and in quantity needed CMSC 411-11 (from Patterson) 13 Speculation: Register Renaming vs. ROB Alternative to ROB is a larger physical set of registers combined with register renaming Extended registers replace function of both ROB and reservation stations Instruction issue maps names of architectural registers to physical register numbers in extended register set On issue, allocates a new unused register for the destination (which avoids WAW and WAR hazards) Speculation recovery easy because a physical register holding an instruction destination does not become the architectural register until the instruction commits Most Out-of-Order processors today use extended registers with renaming CMSC 411-11 (from Patterson) 14 CS252 S05 7

Value Prediction Attempts to predict value produced by instruction E.g., Loads a value that changes infrequently Value prediction is useful only if it significantly increases ILP Focus of research has been on loads; so-so results, no processor uses value prediction Related topic is address aliasing prediction RAW for load and store or WAW for 2 stores Address alias prediction is both more stable and simpler since need not actually predict the address values, only whether such values conflict Has been used by a few processors CMSC 411-11 (from Patterson) 15 Conditional (Predicated) Instructions Condition is evaluated as part of the instruction execution if condition true, normal execution if condition false, instruction turned into a no-op IA-64 has a form of these Example: conditional move Move a value from one register to another if condition is true Can eliminate a branch in simple code sequences CMSC 411-11 (from Patterson) 16 CS252 S05 8

Example: Conditional Move For code: if (A==0) { S=T; } Assume R1, R2, R3 hold values of A, S, T With branch: L: BNEZ R1, L ADDU R2, R3, R0 With conditional move (if 3 rd operand equals zero): CMOVZ R2, R3, R1 Converts the control dependence into a data dependence For a pipeline, moves the dependence from near beginning of pipeline (branch resolution) to end (register write) CMSC 411-11 (from Patterson) 17 Limitations of Conditional Instructions Predicated instructions that are squashed still use processor resources Doesn t matter if resources would have been idle anyway Most useful when predicate can be evaluated early Want to avoid data hazards replacing control hazards Hard to do for complex control flow For example, moving across multiple branches Conditional instructions may have higher cycle count or slower clock rate than unconditional ones CMSC 411-11 (from Patterson) 18 CS252 S05 9

Compiler Speculation w/ Hardware Support To move speculated instructions not just before branch, but before condition evaluation Compiler can help find instructions that can be speculatively moved and not affect program data flow Hard part is preserving exception behavior A speculated instruction that is mispredicted should not cause an exception It can be done, but details are rather complex CMSC 411-11 (from Patterson) 19 Memory Reference Speculation w/ Hardware Support To move loads across stores, when compiler can t be sure it is legal Use a speculative load instruction Hardware saves address of memory location If a subsequent store changes that location before the check (to end the speculation), then the speculation failed, otherwise it succeeded On failure, need to redo load and re-execute all speculated instructions after the speculative load CMSC 411-11a (from Patterson) 20 CS252 S05 10

Superscalar Execution Predication helps with scheduling Example: superscalar that can issue 1 memory reference and 1 ALU op per cycle, or just 1 branch 1 st instruction 2 nd instruction LW R1,40(R2) ADD R3,R4,R5 ADD R6,R3,R7 BEQZ R10,L LW R8,0(R10) LW R9,0(R8) LWC loads if 3 rd operand not 0 1 st instruction 2 nd instruction LW R1,40(R2) ADD R3,R4,R5 LWC R8,0(R10),R10 ADD R6,R3,R7 BEQZ R10,L LW R9,0(R8) CMSC 411-11a (from Patterson) 21 CS252 S05 11