Question: 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

 3. We will study how control dependencies present in a given

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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!