Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

3. We will study how control dependencies present in a given program affect the performance in terms of the CP Suppose we have a processor

image text in transcribed

3. We will study how control dependencies present in a given program affect the performance in terms of the CP Suppose we have a processor with a 5-stage pipeline: Fetch Decode Execute MemoryWrite Back Also suppose that 20% of a given program instructions are branches, and that 50% of all branches are taken. Suppose we know whether branches are taken or not after the Execute stage, and there is no branch prediction implemented in this processor. a) Cycle penalty is the number of cycles spent (i.e. wasted) on processing a set of instructions that later turns out to be NOT the target of the branch instruction. For example, consider the following program snippet 1 2 3 4 add r1 r2 r3 beq rl r3 label add r2 r3 r4 sub r5 r6 r8 9 10 mul r5 r6 r8 label add r7 r5 r6 The two blocks of instructions (one from line 3 until before line 9, and the other one from line 10 from on) are control dependent on the branch instruction in line 2, because if the branch is taken, first block needs to execute, and if the branch is not taken, the second block needs to execute. If the pipeline starts processing lines 3 and 4 but the branch turns out to be not taken, the processor flushes the pipeline and starts fetching from line 10. If a processor finds out whether branch is taken or not in stage 3, then the previous 2 stages of the pipeline are flushed out. In this case, we say there is a cycle penalty of 2 cycles Going back to the 5-stage pipeline processor described above, what is the cycle penalty corresponding to branch resolution? b) We can calculate the CPI of this processor by multiplying the cycle penalty by the portion of program affected by control dependencies. For example, if 40% of a given program are "wrongly" executed due to control dependency and there is a cycle penalty of 3 cycles, then the CPI is equal to 1 (base CPI) 0.4 3 2.2 Going back to the 5-stage pipeline processor described above, what is the CPI based on the properties of the given program and the pipeline? 3. We will study how control dependencies present in a given program affect the performance in terms of the CP Suppose we have a processor with a 5-stage pipeline: Fetch Decode Execute MemoryWrite Back Also suppose that 20% of a given program instructions are branches, and that 50% of all branches are taken. Suppose we know whether branches are taken or not after the Execute stage, and there is no branch prediction implemented in this processor. a) Cycle penalty is the number of cycles spent (i.e. wasted) on processing a set of instructions that later turns out to be NOT the target of the branch instruction. For example, consider the following program snippet 1 2 3 4 add r1 r2 r3 beq rl r3 label add r2 r3 r4 sub r5 r6 r8 9 10 mul r5 r6 r8 label add r7 r5 r6 The two blocks of instructions (one from line 3 until before line 9, and the other one from line 10 from on) are control dependent on the branch instruction in line 2, because if the branch is taken, first block needs to execute, and if the branch is not taken, the second block needs to execute. If the pipeline starts processing lines 3 and 4 but the branch turns out to be not taken, the processor flushes the pipeline and starts fetching from line 10. If a processor finds out whether branch is taken or not in stage 3, then the previous 2 stages of the pipeline are flushed out. In this case, we say there is a cycle penalty of 2 cycles Going back to the 5-stage pipeline processor described above, what is the cycle penalty corresponding to branch resolution? b) We can calculate the CPI of this processor by multiplying the cycle penalty by the portion of program affected by control dependencies. For example, if 40% of a given program are "wrongly" executed due to control dependency and there is a cycle penalty of 3 cycles, then the CPI is equal to 1 (base CPI) 0.4 3 2.2 Going back to the 5-stage pipeline processor described above, what is the CPI based on the properties of the given program and the pipeline

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Upgrading Oracle Databases Oracle Database New Features

Authors: Charles Kim, Gary Gordhamer, Sean Scott

1st Edition

B0BL12WFP6, 979-8359657501

More Books

Students also viewed these Databases questions

Question

General Purpose of Your Speech Analyzing Your Audience

Answered: 1 week ago

Question

Ethical Speaking: Taking Responsibility for Your Speech?

Answered: 1 week ago