.\" @(#)demoDo1	1.2	12/11/92
.NA demoDo1
.SD
Demonstration of the quasi-static scheduler for a graph with a "do-while" construct.
.DE
.SV 1.1 2/6/92
.AL "S. Ha"
.LO "~ptolemy/src/domains/cg-ddf/demo"
.LD
.Ir "do-while construct"
.Ir "quasi-static scheduler"
This demo displays a schedule result applying a quasi-static
scheduling technique to a program graph with a \fIdo-while\fR construct.
A \fIdo-while\fR construct, which resides in a CGWormhole, consists of a
.c EndCase
star at the front,
.c Case
star at the back, and a wormhole that represents a loop-body.
The control value to the
.c Case
star is generated from the loop-body, which decides whether to
execute the loop-body once more or quit.
The number of iteration cycles of the \fIdo-while\fR loop is, therefore,
data-dependent 
.pp
By setting the target parameter of the CG-DDF domain inside
the CGWormhole (green block at the top level), we indicate that 
it is a \fIdo-while\fR construct (
.c constructType
= dowhile ) and the number of iteration cycles is distributed
geometrically (
.c paramType
= geometric ) with a constant 0.7 (
.c paramGeo
= 0.7 ). The probability of doing one more iteration is 0.7 after
finishing the current iteration cycle. 
Since the
.c fixedNum
state is 0, we let the scheduler decide the number of processors to
assign to the for construct.
.pp
The CG-DDF galaxy contains a wormhole of CG domain
to represent the body of the loop.
The outside CG domain and this inner CG domain share
the same child targets by setting
.c inheritProcessors
target parameter "YES" in the inner target. The quasi-static scheduling
idea is that we fix the assignment and the execution order of stars in
the CG targets at the compile time.  At the top level, the "do-while"
construct is regarded as an atomic block. The blocks inside the
loop-body are also scheduled (assigned and ordered)
at compile-time. At run time, 
we execute the loop-body as many times as the termination condition
fails.
.pp
The core of the scheduling technique is to determine the assumed
execution profile of the \fIdo-while\fR construct at compile-time,
based on the distribution of the number of iteration cycles.
In the displayed Gantt chart, we can find out what is the
.Ir "profile, CG-DDF"
estimated profile of the construct. The construct is assigned to 2 
processors among 4. Unlike the "for" construct, in the "do-while" loop,
intercycle parallelism does not exist. 
The assumed number of iteration cycles is 2 in this case.
Note that we pipeline the program graph by inserting delays on a cutset
manually to increase the possibility of parallelism.
In this release we do not make code
generation working properly yet.
.ES

