Using Interfaces to Analyze
Compositionality
Haiyang Zheng and Rachel Zhou
EE290N Class Project PresentationDec. 10, 2004
Outline
• Introduction and motivation.• Study and development of several
interfaces for discrete-event models.• Applying the previously developed
interfaces on dataflow and process network models.
• Conclusion.
Introduction
• What is a composition?– A product of mixing or combining various
elements or ingredients. (From Merriam-Webster Online.)
• What is a valid composition? – The interface of a composition should be
indistinguishable from its elements.• An interface of an actor can be a set of ports and
parameters.– The behavior of a composition should be the
same as that of before being composed. • A behavior includes not only ports and parameters but
also the signals going through the ports.
• Can we reason about the behavioral validity of a composition by analyzing its interfaces only?
An Example without Composition
A discrete-event model that has a unique behavior.
A delta-causal process.
An Example with Composition
What about the existence and uniqueness of the behavior of the followingmodel (modified from the previous example by introducing a hierarchy)?
The causality property is missing.
An interface only consisting of ports and parameters is insufficient to reason about the behavior of the composite
actor.
A Refined Interface• This interface includes function dependencies of an actor.
– A function dependency of an actor is a data dependency relation that an output port has on an input port of the same actor in the same firing.
• This interface is a graph, where nodes are ports and directed edges represent data dependencies.
Function Dependency(No data dependency.)
Interfaces
Function Dependency(Output depends on input.)
A Refined Interface (Continued)
Abstraction
CommunicationDependency
• Interfaces (graphs) of component actors can be composed with communication dependencies to construct another graph.
• The interface of a composite actor is an abstraction of the resulted graph.
Revisiting ExampleWhat about the existence and uniqueness of the behavior of the followingmodel (modified from the previous example by introducing a hierarchy)?
A strictly causal process.
The new interface containing function dependency is still insufficient to reason about the behavior of the composite
actor.
A Weighted Interface• This interface contains weighted function dependencies.• Each input-output pair has a directed edge going from
input to output. • Each edge has a weight, where the weight represents
the amount of delay between input and output.
A directed edge with weight 1.0.
A directed edge with weight 0.0.
A directed edge with weight infinity.
A directed edge with weight x.
1.0 0.0 infinity x
A Weighted Interface (Cont.)• This interface distinguishes delta causality from
strict causality.• If an edge has a weight depending on states,
this interface may not help much.
Abstraction
0.0 0.0 0.0 1.0 0.0 1.0Sum
Abstraction
0.0 0.0 0.0 x 0.0 xSum
Replace TimedDelay with
Revisiting ExampleWhat about the existence and uniqueness of the behavior of the followingmodel (modified from the previous example by introducing a hierarchy)?
A delta causal process.
The new interface containing weighted function dependency is sufficient to reason about the behavior of the composite
actor.
A More Complex DE Model • We can conclude from the analysis of interfaces that
the following model has a unique behavior and it is a valid composition according to the DE semantics.– A DE simulator may complain about a direct feedback loop.– However, if a DE simulator can simulate the model, it does
give the same behavior as that of a flattened model.
p1 p3 p2 p40.0 0.0 0.0
p50.0
p60.0
p1 p2 p3 p4(t, 1, 1) a a (t, 1, 2) a a (t, 2, 1) b b (t, 2, 2) b b
p1 p2 p3 p4(t, 1) a a a a (t, 2) b b b b
A
B
p1
p2
p3
p4
Source
Sink
p5
p6
A
B
p1
p2
p3
p4
Source
Sink
p5
p6
Before composition
After compositionIndex forFirings ofComposite
Firing order of Actors
Where are we…
• Introduction and motivation.• Study and improvement of several
interfaces for discrete-event models.• Applying the previously developed
interfaces on dataflow and process network models.
• Conclusion.
B
E
2
D
A
F
C
SDFSDF
B
E
2
D
A
F
C
SDF
Composition Example 1 in Dataflow
Composition in SDF adds constraints on the number of firings of actor B and E in the firing vector.
A consistent SDF graph.
This makes the whole model inconsistent. This is an invalid composition.
B
E
2
D
A
F
C
SDFSDF
B
E
2
D
A
F
C
SDF
SDF
SDF
Schedules for actor B and E are actually independent, but composition adds constraint on them.
Decomposition using Function Dependency
One solution is to perform function dependency analysis and decomposition.
Only necessary decomposition is performed so maximum compositionality is preserved.
Composition Example 2 in Dataflow
A consistent SDF graph.
Schedulability is lost if hierarchy is introduced. The graph becomes deadlock.
Weighted Interface for Dataflow
• Nodes represent ports and directed edges represent data and communication dependencies.
• Each node has a weight, which represents the number of initial tokens available at this node (port).
• A directed edge represents dependency between the weight of its sink node on that of its source node.
k k+1 k k kk 0 nm
k
Dataflow Example 2 Revisited
Abstraction
k k k+1 k+1 k+1 kk+1 k+1
The interface exposes the necessary information to analyze deadlock correctly.
Dataflow Example 3
A{0}2
{0}
B
3
32
32
1
k
k
When k = 1, 332
1
k
Therefore, actor B has enough tokens to fire and the deadlock is resolved.
A symbolic representation of the interface.
Dataflow Example 1 Revisited
B
E
2
D
A
F
C
SDF
SDF
m
n
m
n
Similarly, we can use symbolic representation (weighted interfaces) for the rate signature of the composite actor.
The variable m and n give 2 degrees of freedom on the composite actor schedule.
m and n can be determined by the outside constraint (balance equations) and the minimum solution requirement.
Artificial Local Deadlock in Process Network
B
ED
A
F
C
PN
B
ED
A
F
C
PN
PN
PN
One solution is to introduce a new hierarchy for each disconnected graph. Each inside PN director is responsible to detect its own deadlock.
Artificial local deadlock is not handled by Parks’ algorithm.
Conclusion
• We developed several interfaces to analyze compositionality of models with different models of computation.
• Future work will be to develop more useful interfaces.
The End.Thanks!