DSPRelated.com
Forums

What is ZERO-OVERHEAD LOOP in DSPs?

Started by Sandeep Chikkerur August 26, 2003
Hi,

One of the features of DSP processors is to provide the zero-overhead
loops.

i.e., it comes into picture during the conditional branching.

So, what is ZERO-OVERHEAD LOOPING ?

Is it w.r.t the no. of cycles it takes to decide the branching (i.e.,
it takes same count of cycles on either conditions )?
sandeep_mc81@yahoo.com (Sandeep Chikkerur) wrote in message news:<d5d88eb5.0308252148.4569b181@posting.google.com>...
> Hi, > > One of the features of DSP processors is to provide the zero-overhead > loops. > > i.e., it comes into picture during the conditional branching. > > So, what is ZERO-OVERHEAD LOOPING ? > > Is it w.r.t the no. of cycles it takes to decide the branching (i.e., > it takes same count of cycles on either conditions )?
means the looping comes as no cycle cost. Some architectures even ensure that the loop instruction does'nt take any processor execution block (like ALU) for performaning the decrement of the loop counter. For example , the ZSP 400 is a processor that provides 0-overhead looping. The code fragment: label: mac.a r4,r5 agn0 label The above loop takes one cycle to execute, i.e in 10 cycles 10 MAC's are executed. The Loop comes at zero cost, so there is no difference even if the loop is unrolled. Vinod Rex
sandeep_mc81@yahoo.com (Sandeep Chikkerur) wrote in message 

Zero Overhead loop is only applicable where you know the number of
iterations before the start of the loop e.g.

for( i = 0; i < SOME_CONSTANT; i++)
{
  SOME_STATEMENT;
}


The above code can be put in a hardware loop and it would be repeated
a predetermined number of time. There is no branching anywhere if
hardware loops is used (which would be there at the end of each
iteration if such
instructions weren't there).

As for zero overhead, since there are no explicit comparisons to be
made in loop counters and no branching to loop_start address,
therefore there is no overhead etc. No pipeline stalls too. e.g. if
SOME_STATEMENT above takes 1 cycle the whole loop would take X cycles.
No overheads :-)

Regards
Piyush

news:<d5d88eb5.0308252148.4569b181@posting.google.com>...
> Hi, > > One of the features of DSP processors is to provide the zero-overhead > loops. > > i.e., it comes into picture during the conditional branching. > > So, what is ZERO-OVERHEAD LOOPING ? > > Is it w.r.t the no. of cycles it takes to decide the branching (i.e., > it takes same count of cycles on either conditions )?
piyushkaul@yahoo.com (Piyush Kaul) wrote in message news:<2e20232a.0308260228.67580e07@posting.google.com>...
> sandeep_mc81@yahoo.com (Sandeep Chikkerur) wrote in message > > Zero Overhead loop is only applicable where you know the number of > iterations before the start of the loop e.g. > > for( i = 0; i < SOME_CONSTANT; i++) > { > SOME_STATEMENT; > }
Untrue. There are machines which support zero overhead conditional control in loops. Some require loops longer than the one above, and require you to explicitly deal with the pipeline effects. They certainly allow zero overhead conditional looping, though. Regards, Steve
> Untrue. There are machines which support zero overhead conditional > control in loops. Some require loops longer than the one above, and > require you to explicitly deal with the pipeline effects. They > certainly allow zero overhead conditional looping, though. > > Regards, > Steve
I guess, if you do conditional looping, it may not be possible to keep the pipeline filled all the time. And consequently some overhead. Maybe "explicitly dealing with pipeline" is some kind of solution, though I don't have a clue to what that means in loop context. Some pointers would help. Regards Piyush
Hi Piyush,

piyushkaul@yahoo.com (Piyush Kaul) wrote in message news:<2e20232a.0308262042.4dd64108@posting.google.com>...
> > Untrue. There are machines which support zero overhead conditional > > control in loops. Some require loops longer than the one above, and > > require you to explicitly deal with the pipeline effects. They > > certainly allow zero overhead conditional looping, though. > > > > Regards, > > Steve > > I guess, if you do conditional looping, it may not be possible to keep > the pipeline filled all the time. And consequently some overhead. > > Maybe "explicitly dealing with pipeline" is some kind of solution, > though I don't have a clue to what that means in loop context. Some > pointers would help.
Some machines require you to explicitly deal with pipelining yourself. That is you read from memory. X cycles later you compute from the data which has now arrived from memory. Y cycles later you store the result from the computation which is now complete. In many of those explicitly pipelined machined a conditional truly zero overheap loop is possible, if the loop is longer than the pipeline. I think most vector oriented machines (by which I do not mean DSPs - most of those are polynomial oriented) can do this. Regards, Steve