You are on page 1of 22

Instruction Level parallelism

Simple Example
• Main()
• {
• Inputs;
• Some statements;
• Few loops;
• Function 1();
• ..............
• Function10();
• Other Statements;
• Few loops;
• Outputs;
• }
• Function1()//body
• {
• Some statements;
• Few loops;
• }
• ............
• Function10()//body
• {
• Some statements;
• Few loops;
• }
Basics
• For parallel processing a program is need to
divide into smaller segments known as grain.
• Grain: It is a program segment that is chosen
for parallel processing.
• Grain size or granularity: It is a measure of
the amount of computation involved in a
software process.
• Latency: It is computation overhead between
machine subsystems.
Level of parallelism:
Level of parallelism:

• Level 1-Instruction level parallelism: The number of instructions is


very few (eg 20).
• Level 2-Loop level parallelism: Loops are collections of
statements. Grain size is approximately 500.
• Level 3-Procedure level parallelism: Procedure is basically
collection of level 2. Here grain size approximately less than 2000.
• Level 4-Subprogram level parallelism: Subprograms are basically
collection of different procedures. Here grain size is thousands of
instructions.
• Level 5-Program level parallelism: Programs are basically
collection of different Subprograms. Here grain size is tens
thousands of instructions.
• NB: Depending on program size, the machine in which program
are running grain size at different levels may have different values.
Level of parallelism:

• Depending on grain size parallelism is classified into


three categories.
• Fine Grain Parallelism: For this type the grain size is
less. Instruction level parallelism and loop level
parallelisms are fine grain parallelism.
• Medium Grain Parallelism: For this type the grain size
has medium value. Procedure level parallelism and
subprogram level parallelisms are medium grain
parallelism.
• Coarse Grain Parallelism: In this type of parallelism
grain size is very large. Program level parallelism is
coarse grain parallelism.
Grain Packing
In order to achieve higher degree of parallelism
fine grain is applied first. Then we combine
multiple fine grains into medium grain and
multiples of medium grain to coarse grain. The
process of combining the grain is known as
grain packing.
Example 1
• Consider the following program. So fine grain
program before grain packing. Convert it into
coarse grain after grain packing. (Fine grain:
grain size<=2, otherwise coarse grain)
Example 1
Contd
• The structure of a program is represented by a
program graph. Each node in this graph
represents a computational unit in the
program. The grain size is measured by the
number of basic machine cycles. It is
represented as shown in the figure below
Contd
• (n,s) deotes the (node number, grain size)
• (x,i) denotes (input, delay)
• (z,k) denotes (output, delay)
• (y, j) and (g,h) denote other inputs and
outputs

Fine Grain Parallelism
Coarse grain parallelism
Example 2
• There is no specific rule for drawing this
graph. Inside “A” we can only consider from 1
to 6. Assuming fine grain size<=2 the graph
can be drawn in the following way also.
Fine Grain Parallelism
Coarse grain parallelism
Example 3
• Examples 1 and 2 show the straight
conversion from fine grain to coarse grain.
Now follow the conversion from fine grain to
medium grain and from medium grain to
coarse grain. Here we assume fine grain size
<=2, medium grain<=4, otherwise coarse
grain.
Fine Grain Parallelism
Medium grain parallelism
Coarse grain parallelism
• For any question contact me

You might also like