Appendix C Practice Problem Set 1

Slides:



Advertisements
Similar presentations
ILP: IntroductionCSCE430/830 Instruction-level parallelism: Introduction CSCE430/830 Computer Architecture Lecturer: Prof. Hong Jiang Courtesy of Yifeng.
Advertisements

Instruction-Level Parallel Processors {Objective: executing two or more instructions in parallel} 4.1 Evolution and overview of ILP-processors 4.2 Dependencies.
Pipeline Exceptions & ControlCSCE430/830 Pipelining in MIPS MIPS architecture was designed to be pipelined –Simple instruction format (makes IF, ID easy)
COMP381 by M. Hamdi 1 (Recap) Pipeline Hazards. COMP381 by M. Hamdi 2 I n s t r. O r d e r add r1,r2,r3 sub r4,r1,r3 and r6,r1,r7 or r8,r1,r9 xor r10,r1,r11.
CSC 370 (Blum)1 Instruction-Level Parallelism. CSC 370 (Blum)2 Instruction-Level Parallelism Instruction-level Parallelism (ILP) is when a processor has.
Superscalar processors Review. Dependence graph S1S2 Nodes: instructions Edges: ordered relations among the instructions Any ordering-based transformation.
Optimizing single thread performance Dependence Loop transformations.
Advanced Pipelining Optimally Scheduling Code Optimally Programming Code Scheduling for Superscalars (6.9) Exceptions (5.6, 6.8)
Data Dependence Types and Associated Pipeline Hazards Chapter 4 — The Processor — 1 Sections 4.7.
EECC551 - Shaaban #1 Fall 2003 lec# Pipelining and Exploiting Instruction-Level Parallelism (ILP) Pipelining increases performance by overlapping.
Instruction Set Issues MIPS easy –Instructions are only committed at MEM  WB transition Other architectures are more difficult –Instructions may update.
Pipeline Computer Organization II 1 Hazards Situations that prevent starting the next instruction in the next cycle Structural hazards – A required resource.
Intro to Computer Org. Pipelining, Part 2 – Data hazards + Stalls.
Review: Pipelining. Pipelining Laundry Example Ann, Brian, Cathy, Dave each have one load of clothes to wash, dry, and fold Washer takes 30 minutes Dryer.
Instruction-Level Parallelism (ILP)
Computer Architecture Pipelines & Superscalars. Pipelines Data Hazards Code: lw $4, 0($1) add $15, $1, $1 sub$2, $1, $3 and $12, $2, $5 or $13, $6, $2.
1 IF IDEX MEM L.D F4,0(R2) MUL.D F0, F4, F6 ADD.D F2, F0, F8 L.D F2, 0(R2) WB IF IDM1 MEM WBM2M3M4M5M6M7 stall.
1 Lecture 4: Advanced Pipelines Data hazards, control hazards, multi-cycle in-order pipelines (Appendix A.4-A.10)
Chapter 12 Pipelining Strategies Performance Hazards.
CSCE 212 Quiz 9 – 3/30/11 1.What is the clock cycle time based on for single-cycle and for pipelining? 2.What two actions can be done to resolve data hazards?
King Fahd University of Petroleum and Minerals King Fahd University of Petroleum and Minerals Computer Engineering Department Computer Engineering Department.
1 Lecture 4: Advanced Pipelines Data hazards, control hazards, multi-cycle in-order pipelines (Appendix A.4-A.10)
1 Lecture 4: Advanced Pipelines Control hazards, multi-cycle in-order pipelines, static ILP (Appendix A.4-A.10, Sections )
CSCE 212 Quiz 9a – 4/1/11 For the following questions, assume the clock cycle times given above and the following set of instructions: lw $5, -16($5) sw.
Data Dependencies A dependency type that can cause a stall.
Quiz $s0 – lw -> sw RAW $s1 – sub -> addRAW $s0 – lw -> add WAW $s0 – sw -> add WAR Identify the dependencies lw $s0, 0($t0) sw $s0, 100($t2) sub $s1,
ENGS 116 Lecture 51 Pipelining and Hazards Vincent H. Berk September 30, 2005 Reading for today: Chapter A.1 – A.3, article: Patterson&Ditzel Reading for.
Pipeline Hazard CT101 – Computing Systems. Content Introduction to pipeline hazard Structural Hazard Data Hazard Control Hazard.
Chapter 2 Summary Classification of architectures Features that are relatively independent of instruction sets “Different” Processors –DSP and media processors.
1 Appendix A Pipeline implementation Pipeline hazards, detection and forwarding Multiple-cycle operations MIPS R4000 CDA5155 Spring, 2007, Peir / University.
EEL5708 Lotzi Bölöni EEL 5708 High Performance Computer Architecture Pipelining.
Computer Architecture Pipelines & Superscalars Sunset over the Pacific Ocean Taken from Iolanthe II about 100nm north of Cape Reanga.
CMPE 421 Parallel Computer Architecture
CA406 Computer Architecture Pipelines... continued.
5/13/99 Ashish Sabharwal1 Pipelining and Hazards n Hazards occur because –Don’t have enough resources (ALU’s, memory,…) Structural Hazard –Need a value.
Introduction to Computer Organization Pipelining.
1 Pipelining CDA 3101 Discussion Section Question 1 – 6.1 Suppose that time for an ALU operation can be shortened by 25% in the following figure.
1 Lecture: Pipelining Extensions Topics: control hazards, multi-cycle instructions, pipelining equations.
EECS 370 Discussion smbc-comics.com.
Chapter Six.
Speed up on cycle time Stalls – Optimizing compilers for pipelining
CS2100 Computer Organization
CDA3101 Recitation Section 8
Review: Instruction Set Evolution
Pipelining: Hazards Ver. Jan 14, 2014
Pipelining Chapter 6.
Test 2 review Lectures 5-10.
Appendix A - Pipelining
The fetch-execute cycle
Computer Architecture Lecture 3 – Part 1 11th May, 2006
Lecture 10: Out-of-order Processors
Lecture 11: Out-of-order Processors
Lecture: Out-of-order Processors
Pipelining Chapter 6.
CS 704 Advanced Computer Architecture
Chapter Six.
Chapter Six.
Daxia Ge Friday February 9th, 2007
Data Hazard Example (stall).
Pipelining: Basic Concepts
Lecture 4: Advanced Pipelines
Instruction Rescheduling and Loop-Unroll
Reducing pipeline hazards – three techniques
Pipelining.
Pipelining Chapter 6.
Data Hazard Example (no stalls).
Pipelining Chapter 6.
Throughput = #instructions per unit time (seconds/cycles etc.)
Problem ??: (?? marks) Consider executing the following code on the MIPS pipelined datapath: add $t5, $t6, $t8 add $t9, $t5, $t4 lw $t3, 100($t9) sub $t2,
MIPS Assembly.
Presentation transcript:

Appendix C Practice Problem Set 1

Problem 1 1. Identify data dependencies in the code segment below. # of dependencies: ____________? i: R2  R0 + R1 j: R3  R0 * R2 k: R5  R2 – R3 l: R2  R6 – R7

Data Dependency # First Instruction (i, j, k) Second Instruction i: R2  R0 + R1 j: R3  R0 * R2 k: R5  R2 – R3 l: R2  R6 – R7 Data Dependency # First Instruction (i, j, k) Second Instruction Type (RAW, WAR, WAW) Which Register? 1 i j RAW R2 2 3 4 5

Data Dependency # First Instruction (i, j, k) Second Instruction i: R2  R0 + R1 j: R3  R0 * R2 k: R5  R2 – R3 l: R2  R6 – R7 Data Dependency # First Instruction (i, j, k) Second Instruction Type (RAW, WAR, WAW) Which Register? 1 i j RAW R2 2 k 3 4 5

Data Dependency # First Instruction (i, j, k) Second Instruction i: R2  R0 + R1 j: R3  R0 * R2 k: R5  R2 – R3 l: R2  R6 – R7 Data Dependency # First Instruction (i, j, k) Second Instruction Type (RAW, WAR, WAW) Which Register? 1 i j RAW R2 2 k 3 l WAW 4 5

Data Dependency # First Instruction (i, j, k) Second Instruction i: R2  R0 + R1 j: R3  R0 * R2 k: R5  R2 – R3 l: R2  R6 – R7 Data Dependency # First Instruction (i, j, k) Second Instruction Type (RAW, WAR, WAW) Which Register? 1 i j RAW R2 2 k 3 l WAW R3

Data Dependency # First Instruction (i, j, k) Second Instruction i: R2  R0 + R1 j: R3  R0 * R2 k: R5  R2 – R3 l: R2  R6 – R7 Data Dependency # First Instruction (i, j, k) Second Instruction Type (RAW, WAR, WAW) Which Register? 1 i j RAW R2 2 k 3 l WAW R3

Data Dependency # First Instruction (i, j, k) Second Instruction i: R2  R0 + R1 j: R3  R0 * R2 k: R5  R2 – R3 l: R2  R6 – R7 Data Dependency # First Instruction (i, j, k) Second Instruction Type (RAW, WAR, WAW) Which Register? 1 i j RAW R2 2 k 3 l WAW 4 R3 5 WAR 6

Problem 2 2. For the given sequence of instructions, fill the table below with the pipeline stages for each instruction. The first row is already filled for you. Assuming no memory latency, how many cycles does it take to execute his piece of code?

LW R0, 0(R10) LW R1, 2(R10) ADD R3, R1. R2 SUB R4, R3, R2 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 LW R0, 0(R10) F D E M W LW R1, 2(R10) ADD R3, R1. R2 SUB R4, R3, R2 SW R4, 0(R11) MUL R5, R1, R2 ADD R6, R1, R7 SW R5, 0(R11) SW R6, 0(R11)

LW R0, 0(R10) LW R1, 2(R10) ADD R3, R1. R2 SUB R4, R3, R2 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 LW R0, 0(R10) F D E M W LW R1, 2(R10) ADD R3, R1. R2 SUB R4, R3, R2 SW R4, 0(R11) MUL R5, R1, R2 ADD R6, R1, R7 SW R5, 0(R11) SW R6, 0(R11)

LW R0, 0(R10) LW R1, 2(R10) ADD R3, R1. R2 SUB R4, R3, R2 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 LW R0, 0(R10) F D E M W LW R1, 2(R10) ADD R3, R1. R2 S SUB R4, R3, R2 SW R4, 0(R11) MUL R5, R1, R2 ADD R6, R1, R7 SW R5, 0(R11) SW R6, 0(R11)

LW R0, 0(R10) LW R1, 2(R10) ADD R3, R1. R2 SUB R4, R3, R2 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 LW R0, 0(R10) F D E M W LW R1, 2(R10) ADD R3, R1. R2 S SUB R4, R3, R2 SW R4, 0(R11) MUL R5, R1, R2 ADD R6, R1, R7 SW R5, 0(R11) SW R6, 0(R11)

Problem 3 2. Repeat problem 2 but with some independent instruction inserted to reduce stalls.

This is the original sequence 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 LW R0, 0(R10) F D E M W LW R1, 2(R10) ADD R3, R1. R2 S SUB R4, R3, R2 SW R4, 0(R11) MUL R5, R1, R2 ADD R6, R1, R7 SW R5, 0(R11) SW R6, 0(R11) This is the original sequence

This is the newsequence 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 LW R0, 0(R10) F D E M W LW R1, 2(R10) MUL R5, R1, R2 ADD R6, R1, R3 ADD R3, R1. R2 SW R5, 0(R11) SW R6, 0(R11) SUB R4, R3, R2 S SW R4, 0(R11) This is the newsequence