- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What are the types of Loop Scheduling?
Loops are an important source of parallelism for ILP-processors. Therefore, the regularity of the control structure can speed up computation. Loop scheduling is a central point of instruction schedulers that have been advanced for highly parallel ILP-processors, including VLIWs.
Types of Loop Scheduling
There are two different types of loop scheduling are as follows −
Loop unrolling
The basic concept of loop unrolling is to repeat the loop body multiple times and to discard unnecessary inter-iteration code, including decrementing the loop count, verification for loop end, and branching back conditionally between iterations.
This will result in a shortened implementation time. Loop unrolling can be executed simply when the multiple iterations are already established at compile-time, which appears generally in ‘do’ and ‘for’ loops.
Loop unrolling stores performance time, at the cost of code length, in much the similar method as code inlining or traditional macro expansion. Code inlining is one of the standard compiler optimization approaches, used for short, occasionally used subroutines.
Code inlining represents adding the entire subroutine body each time the subroutine is known ‘at the point of call’. Rather than saving the subroutine body independently and calling it from the main code if required.
Simple unrolling is not applicable when a loop has to be implemented a huge number of times, or when the number of iterations is not fixed at compile time. In such cases, a simple loop of uncontrolling has to be extended. The usual method is to unroll the loop a given number of times, say three times, and to set up a loop for the resulting group of unrolled loops. Then the decrementing, testing for loop end, and conditional branching back code are only necessary for each group of unrolled loops.
Software pipelining
Software pipelining is that consecutive loop iterations are implemented as if they were a hardware pipeline as displayed in the following table. Let us see cycles c+4, c+5, and c+6. These are the ones displaying the real advantage of software pipelining. The important point is that for these cycles the available parallelism between subsequent loop iterations is fully used. For instance, in cycle c+4 the parallel operations are as follows −
It can be storing the result of iteration 1 (that is, a(1)), auto-incrementing the index.
It can be decrementing the loop count, which is maintained in r200 by 1.
It can be performing the floating-point multiplication with the operands belonging to cycle 4, that is (2.0 * b(4));
It can be loading the operand for iteration 5 that is b(5).
Most parallel execution of the given loop on an ILP-processor with multiple pipelined execution units
Cycle | Iteration Number | ||||||
---|---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 | |
C | load | ||||||
c+1 | fmul | load | |||||
c+2 | decr | fmul | Load | ||||
c+3 | nop | decr | fmul | Load | |||
c+4 | store | Nop | Decr | Fmul | load | ||
c+5 | store | Nop | Decr | fmul | load | ||
c+6 | store | Nop | decr | fmul | Load | ||
c+7 | store | nop | decr | fmul | |||
c+8 | store | nop | Decr | ||||
c+9 | store | Nop | |||||
c+10 | store |
The cycles c+4 to c+6 have a repetitive design of schedule. It can be restored by an equivalent loop. Each iteration of this new loop includes several operations related to multiple iterations of the initial loop −
loop:storei;decri+2;fmuli+3;loadi+4;bc loop; //the loop has to be executed for i = 1 to 3
- Related Articles
- What are different types of CPU scheduling and the scheduling criteria?
- What are the types of process scheduling algorithms and which algorithms lead to starvation?
- What are the approaches of Instruction Scheduling?
- What are Scheduling Queues?
- What are the functions of Scheduling Model in computer architecture?
- What are the different levels of Code Scheduling in computer architecture?
- What are the types of ICMP message types?
- What are the types of Compilers?
- What are the types of Xylem?
- What are the types of Steganography?
- What are the types of combustion?
- What are the types of autotrophs?
- What are the types of wool?
- What are the types of soil?
- What are the types of fractions?
