The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
x
+2 votes
53 views

What effect does Loop Unrolling have on the ans? What is the ans if we don't use it?

in CO and Architecture by Active (1.7k points) | 53 views
0
I don't think there will be any effect, because these sort of for loops are always unrolled.

1 Answer

0 votes
Loop unrolling is generally done to reduce the number of condition checking and branching. Branching and control instruction create control hazards in the pipelining mechanism. We use several approaches to deal with this control hazard, either we take some branch prediction or we put NOP (stall cycles) in the pipeline. In this particular question, the loop is running two times. If a compiler does not perform any loop unrolling then there will condition check for 3 times, and each of the time either we stall the pipeline or use some branch prediction. Suppose if we are using stall mechanism then 3 times we need to stall the pipeline. But due to unrolling, this condition check, hence the number of control hazard reduces. As the loop is running only two times and unrolling is done we do not need to consider any control hazards and directly can compute the number of cycles required.
by (25 points)

Related questions

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
50,093 questions
55,333 answers
190,852 comments
86,257 users