public class ClusterMutExclNonPipelined extends Z3Solver implements LatencyConstraints, BufferConstraints, LatBuffConstraints
Modifier and Type | Class and Description |
---|---|
private class |
ClusterMutExclNonPipelined.OptimizeSchedule
Schedule optimizer to improve latency and processor usage.
|
Z3Solver.SatResult
Modifier and Type | Field and Description |
---|---|
boolean |
bufferAnalysis
Enable calculation of communication buffer size
|
private java.util.Map<java.lang.String,com.microsoft.z3.IntExpr> |
bufferDecl
SMT variables for buffer calculation of all the channels.
|
private java.util.Map<java.lang.String,com.microsoft.z3.IntExpr> |
cpuDecl
SMT variables for allocated processor of all the tasks.
|
private java.util.Map<java.lang.String,com.microsoft.z3.IntExpr> |
durationDecl
SMT variables for duration of all the tasks.
|
private java.util.Map<java.lang.String,com.microsoft.z3.IntExpr> |
endTimeDecl
SMT variables for end times of all the tasks.
|
private Graph |
graph
Application Graph
|
boolean |
graphSymmetry
Enable Task Symmetry
|
private Graph |
hsdf
Equivalent HSDF of application graph
|
private com.microsoft.z3.IntExpr |
latencyDecl
SMT variable for latency of the application
|
private com.microsoft.z3.IntExpr |
maxBufDecl
SMT variable for maximum buffer usage per cluster of the application
|
private boolean |
newSatQuery
Every time i want to have model from the solver, I don't have
to solve the model for non-lazy and optimal proc schedule.
|
private ClusterMutExclNonPipelined.OptimizeSchedule |
optimizeSchedule
Schedule optimizer for improving latency, number of processors
used.
|
private java.lang.String |
outputDirectory
output directory to generate different files
|
private Graph |
partitionAwareGraph
Partition aware graph
|
private Graph |
partitionAwareHsdf
Equivalent HSDF of partition aware graph
|
private Solutions |
partitionGraphSolutions
Solutions for partition aware graph
|
private Platform |
platform
Target platform
|
boolean |
processorSymmetry
Enable Processor Symmetry
|
private java.util.Map<java.lang.String,java.lang.String> |
satQueryModel
Current SMT query model from a SAT point obtained.
|
private SchedulingConstraints |
schedulingConstraints
Scheduling constraints
|
private Solutions |
solutions
Solutions for application graph
|
private java.util.Map<java.lang.String,com.microsoft.z3.IntExpr> |
startTimeDecl
SMT variables for start times of all the tasks.
|
private java.util.Map<java.lang.String,com.microsoft.z3.IntExpr> |
symmetryDecl
SMT variables for Processor Symmetry
|
private com.microsoft.z3.IntExpr |
totalBufDecl
SMT variable for total buffer usage of the application
|
boolean |
useMaxBuffer
Use maximum buffer per cluster (true)
or total buffer used in the schedule (false)
|
contextStatements, pushedContext, statementCountAfterPush, z3Solver
Constructor and Description |
---|
ClusterMutExclNonPipelined(Graph graph,
Graph hsdf,
Solutions solutions,
Graph partitionAwareGraph,
Graph partitionAwareHsdf,
Solutions partitionGraphSolutions,
Platform platform,
java.lang.String outputDirectory,
SchedulingConstraints schedulingConstraints)
Initialize a Cluster scheduler based on mutual exclusion.
|
Modifier and Type | Method and Description |
---|---|
private void |
actorPrecedences()
Generate all the actor precedence constraints.
|
private void |
assertActorDuration()
Generate a constraint for actor duration variables
|
private void |
assertBufferBoundsLinear(java.lang.String srcActor,
java.lang.String dstActor,
int srcRepCount,
int lowerBound,
int upperBound)
Generate constraints for upper and lower bounds on the buffer size of a channel.
|
private void |
assertBufferCalculation()
Generate all the constraints for buffer-size calculation.
|
private void |
assertBufferLinearNonPipelined(java.lang.String srcActor,
java.lang.String dstActor,
int initialTokens,
int tokenSize,
int srcRepCount,
int dstRepCount,
int prodRate,
int consRate)
Constraint to determine the buffer size at the start of a producer of the channel depending
on the start times of other producer and consumer instances.
|
private void |
assertBufferLinearNonPipelinedWithDma(java.lang.String channelName,
java.lang.String srcActor,
java.lang.String dstActor,
int initialTokens,
int tokenSize,
int srcRepCount,
int dstRepCount,
int prodRate,
int consRate)
Assert buffer constraints for channels with DMA at the output.
|
private void |
assertCommunicationMutualExclusion(java.util.List<java.lang.String> actrList)
Generate Mutual Exclusion constraints for the communication actors.
|
private void |
assertDataFlowMutualExclusion(java.util.List<java.lang.String> actrList)
Generate Mutual Exclusion constraints for the dataflow actors.
|
private void |
assertDmaTaskProcBounds()
Lower and upper bounds on DMA engines allocated to
communication tasks.
|
private void |
assertEndTime()
Generate a constraint for end time calculation of all the tasks
yA_0 = xA_0 + dA
|
private void |
assertMaxBuffer()
Generate constraints for maximum buffer size per cluster.
|
private void |
assertMaxBufferLinear(java.lang.String srcActor,
java.lang.String dstActor,
int srcRepCount,
int initialTokens,
int tokenSize)
Calculate maximum buffer size for a given channel
|
private void |
assertMaxClusterBuffer()
Generate constraints to calculate maximum buffer used in a cluster
|
private void |
assertMutualExclusion()
Generate all the mutual exclusion constraints
|
void |
assertNonPipelineConstraints()
Generate all the non-pipelined scheduling constraints
|
private void |
assertStartTimeBounds()
Lower and upper bounds on the start times of the actor
|
void |
assertTaskCpuBounds()
Lower and upper bound on the processor allocation of the tasks.
|
private void |
assertTotalBuffer()
Generate calculation for total buffer size
|
private com.microsoft.z3.IntExpr |
bufferAtId(java.lang.String srcActor,
java.lang.String dstActor,
int index)
Get SMT variable for buffer size at a producer of a channel connecting two actors
|
private java.util.HashMap<java.lang.Integer,java.util.List<java.lang.Integer>> |
calculateActorPrecedences(Channel chnnl)
Generate a list of precedences between the producer and consumer task instances.
|
private com.microsoft.z3.IntExpr |
clusterBufferId(java.lang.String clusterName)
Get SMT variable for buffer usage for a cluster
|
private void |
clusterDmaStartTimePrecedences()
Generate special precedence constraints for start times of DMA actors.
|
private com.microsoft.z3.IntExpr |
cpuId(java.lang.String name)
Get SMT variable for processor allocated of an actor instance
|
private com.microsoft.z3.IntExpr |
cpuId(java.lang.String name,
int index)
Get SMT variable for processor allocated of an actor instance
|
private void |
defineActorDuration()
Define actor duration variables for all the tasks.
|
private void |
defineEndTimes()
Define end time variables for all the tasks.
|
private void |
defineStartTimes()
Define start time variables for all the tasks.
|
private void |
dmaSymInCluster(java.util.List<java.lang.String> dmaActorList,
int startDmaIndex)
Generate constraints for processor symmetry for the DMA Engines in the cluster.
|
private com.microsoft.z3.IntExpr |
durationId(java.lang.String name)
Get SMT variable for duration of an actor
|
private void |
generateActorTimeDefinitions()
Generate start,end times and duration for all the tasks.
|
private void |
generateBufferAnalysisDefinitions()
Generate all the definitions required for calculating communication buffer size
|
void |
generateBufferConstraint(int bufferConstraint)
Set the buffer size for exploration query.
|
private void |
generateCpuDefinitions()
Generate definitions for processor allocation of all the tasks
|
private void |
generateLatencyCalculation()
Generate latency calculation for the application graph.
|
void |
generateLatencyConstraint(int latency)
Set the latency constraint for exploration query.
|
private void |
generateProcessorSymmetryDefinitions()
Generate definition for processor symmetry variables.
|
com.microsoft.z3.IntExpr |
getBufDeclId()
Get SMT variable for buffer usage calculation of the application
|
private Channel |
getLastDmaPort(Actor actr)
Get the last DMA port of the actor when sorted
by name.
|
int |
getLatency(java.util.Map<java.lang.String,java.lang.String> model)
Get the latency of the application graph calculated by the solver and returned in the model.
|
com.microsoft.z3.IntExpr |
getLatencyDeclId()
Get SMT variable for latency calculation of the application.
|
java.util.Map<java.lang.String,java.lang.String> |
getModel()
Get model from the Solver
|
private java.util.List<Channel> |
getSortedDmaPortList(Actor actr)
We sort the ports of an actor by their names.
|
private java.util.List<Channel.Link> |
getSortedPortList(Actor actr)
We sort the ports of an actor by their names.
|
int |
getTotalBufferSize(java.util.Map<java.lang.String,java.lang.String> model)
Get Total Buffer Size from the model.
|
private void |
graphSymmetryLexicographic()
Task Symmetry constraints
|
private boolean |
hasActorDmaOutput(Actor actr)
Check if the actor has DMA at its output or not.
|
private com.microsoft.z3.IntExpr |
maxBufferId(java.lang.String srcActor,
java.lang.String dstActor)
Get SMT variable for maximum buffer for channel connecting two actors.
|
private com.microsoft.z3.IntExpr |
maxCpuId(java.lang.String name,
int index)
Get SMT variable for max CPU id for processor symmetry
|
private void |
minLatencyBound()
Lower bound on the latency.
|
void |
modelToGantt(java.util.Map<java.lang.String,java.lang.String> model,
java.lang.String outputFileName)
Convert a SMT model to Gantt chart.
|
DesignFlowSolution.Schedule |
modelToSchedule(java.util.Map<java.lang.String,java.lang.String> model,
DesignFlowSolution designSolution)
Generate a Schedule of design flow solution from the model obtained from the SMT solver.
|
private void |
processorSymmetryConstraints()
Generate all the processor symmetry constraints
|
private void |
procSymInCluster(java.util.HashSet<java.lang.String> actrAllocated,
int startProcIndex)
Generate constraints for processor symmetry for the processors in the cluster.
|
void |
resetSolver()
Reset the Z3 Solver.
|
private com.microsoft.z3.IntExpr |
xId(java.lang.String name)
Get SMT variable for start time of an actor instance
|
private com.microsoft.z3.IntExpr |
xId(java.lang.String name,
int index)
Get SMT variable for start time of an instance of an actor.
|
private com.microsoft.z3.IntExpr |
yDotId(java.lang.String name)
Get SMT variable for end time of an actor instance for actors
which have DMA connected at its output
|
private com.microsoft.z3.IntExpr |
yDotId(java.lang.String name,
int index)
Get SMT variable for end time of an actor instance for actors
which have DMA connected at its output
|
private com.microsoft.z3.IntExpr |
yId(java.lang.String name)
Get SMT variable for end time of an actor instance
|
private com.microsoft.z3.IntExpr |
yId(java.lang.String name,
int index)
Get SMT variable for end time of an instance of an actor.
|
private void |
zeroStartTimeActor()
Generate constraint for having at least one actor to start at zero time.
|
addVariableDeclaration, checkSat, declareFunction, generateAssertion, generateSatCode, getStatistics, popContext, printContext, pushContext, setTacTicSolver
check, getModel, getVersion, setRandomSeed
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
checkSat, popContext, pushContext
private Graph graph
private Graph hsdf
private Solutions solutions
private Graph partitionAwareGraph
private Graph partitionAwareHsdf
private Solutions partitionGraphSolutions
private Platform platform
private SchedulingConstraints schedulingConstraints
private com.microsoft.z3.IntExpr latencyDecl
private com.microsoft.z3.IntExpr totalBufDecl
private com.microsoft.z3.IntExpr maxBufDecl
public boolean graphSymmetry
public boolean processorSymmetry
public boolean bufferAnalysis
public boolean useMaxBuffer
private java.lang.String outputDirectory
private ClusterMutExclNonPipelined.OptimizeSchedule optimizeSchedule
private boolean newSatQuery
private java.util.Map<java.lang.String,java.lang.String> satQueryModel
private java.util.Map<java.lang.String,com.microsoft.z3.IntExpr> startTimeDecl
private java.util.Map<java.lang.String,com.microsoft.z3.IntExpr> endTimeDecl
private java.util.Map<java.lang.String,com.microsoft.z3.IntExpr> durationDecl
private java.util.Map<java.lang.String,com.microsoft.z3.IntExpr> cpuDecl
private java.util.Map<java.lang.String,com.microsoft.z3.IntExpr> bufferDecl
private java.util.Map<java.lang.String,com.microsoft.z3.IntExpr> symmetryDecl
public ClusterMutExclNonPipelined(Graph graph, Graph hsdf, Solutions solutions, Graph partitionAwareGraph, Graph partitionAwareHsdf, Solutions partitionGraphSolutions, Platform platform, java.lang.String outputDirectory, SchedulingConstraints schedulingConstraints)
graph
- application graphhsdf
- equivalent HSDF graph of application graphsolutions
- solutions of application graphpartitionAwareGraph
- partition aware graphpartitionAwareHsdf
- equivalent HSDF of partition aware graphpartitionGraphSolutions
- solutions of partition aware graphplatform
- target platformoutputDirectory
- output directoryschedulingConstraints
- scheduling constraintspublic com.microsoft.z3.IntExpr getLatencyDeclId()
public com.microsoft.z3.IntExpr getBufDeclId()
private com.microsoft.z3.IntExpr xId(java.lang.String name, int index)
name
- name of the actorindex
- index of the instanceprivate com.microsoft.z3.IntExpr xId(java.lang.String name)
name
- actor instance nameprivate com.microsoft.z3.IntExpr yId(java.lang.String name, int index)
name
- name of the actorindex
- index of the instanceprivate com.microsoft.z3.IntExpr yId(java.lang.String name)
name
- actor instance nameprivate com.microsoft.z3.IntExpr yDotId(java.lang.String name)
name
- actor instance nameprivate com.microsoft.z3.IntExpr yDotId(java.lang.String name, int index)
name
- actor nameindex
- index of the instanceprivate com.microsoft.z3.IntExpr durationId(java.lang.String name)
name
- actor nameprivate com.microsoft.z3.IntExpr cpuId(java.lang.String name)
name
- actor instance nameprivate com.microsoft.z3.IntExpr cpuId(java.lang.String name, int index)
name
- actor nameindex
- index of the instanceprivate com.microsoft.z3.IntExpr maxBufferId(java.lang.String srcActor, java.lang.String dstActor)
srcActor
- producer actordstActor
- consumer actorprivate com.microsoft.z3.IntExpr bufferAtId(java.lang.String srcActor, java.lang.String dstActor, int index)
srcActor
- producer actordstActor
- consumer actorindex
- index of the buffer, <= repetition count of srcActorprivate com.microsoft.z3.IntExpr clusterBufferId(java.lang.String clusterName)
clusterName
- name of the clusterprivate com.microsoft.z3.IntExpr maxCpuId(java.lang.String name, int index)
name
- name of the actorindex
- indexprivate void defineStartTimes()
private void defineActorDuration()
private void defineEndTimes()
private void assertActorDuration()
private void assertEndTime()
private void generateCpuDefinitions()
private void generateActorTimeDefinitions()
private void zeroStartTimeActor()
private void assertStartTimeBounds()
public void assertTaskCpuBounds()
private java.util.List<Channel.Link> getSortedPortList(Actor actr)
actr
- actor for which ports are to be sortedprivate java.util.List<Channel> getSortedDmaPortList(Actor actr)
actr
- actor for which ports are to be sortedprivate Channel getLastDmaPort(Actor actr)
actr
- actor instanceprivate boolean hasActorDmaOutput(Actor actr)
actr
- actor instanceprivate void assertDataFlowMutualExclusion(java.util.List<java.lang.String> actrList)
actrList
- list of dataflow actorsprivate void assertCommunicationMutualExclusion(java.util.List<java.lang.String> actrList)
actrList
- list of communication actorsprivate void assertMutualExclusion()
private java.util.HashMap<java.lang.Integer,java.util.List<java.lang.Integer>> calculateActorPrecedences(Channel chnnl)
chnnl
- channel for which precedences should be derivedprivate void generateLatencyCalculation()
private void actorPrecedences()
private void minLatencyBound()
private void assertDmaTaskProcBounds()
private void graphSymmetryLexicographic()
public DesignFlowSolution.Schedule modelToSchedule(java.util.Map<java.lang.String,java.lang.String> model, DesignFlowSolution designSolution)
model
- the model obtained from the SMT solver.designSolution
- design flow solutionprivate void generateBufferAnalysisDefinitions()
private void assertBufferLinearNonPipelined(java.lang.String srcActor, java.lang.String dstActor, int initialTokens, int tokenSize, int srcRepCount, int dstRepCount, int prodRate, int consRate)
srcActor
- source actordstActor
- sink actorinitialTokens
- number of initial tokens on the channeltokenSize
- token sizesrcRepCount
- repetition count of the source actordstRepCount
- repetition count of the sink actorprodRate
- production rate of tokensconsRate
- consumption rate of tokensprivate void assertBufferLinearNonPipelinedWithDma(java.lang.String channelName, java.lang.String srcActor, java.lang.String dstActor, int initialTokens, int tokenSize, int srcRepCount, int dstRepCount, int prodRate, int consRate)
channelName
- name of the channelsrcActor
- source actordstActor
- sink actorinitialTokens
- number of initial tokenstokenSize
- size of the tokensrcRepCount
- source actor repetition countdstRepCount
- sink actor repetition countprodRate
- token production rate on the channelconsRate
- token consumption rate on the channelprivate void assertMaxBufferLinear(java.lang.String srcActor, java.lang.String dstActor, int srcRepCount, int initialTokens, int tokenSize)
srcActor
- source actordstActor
- sink actorsrcRepCount
- source actor repetition countinitialTokens
- number of initial tokens on the channeltokenSize
- size of the tokenprivate void assertBufferBoundsLinear(java.lang.String srcActor, java.lang.String dstActor, int srcRepCount, int lowerBound, int upperBound)
srcActor
- source actordstActor
- sink actorsrcRepCount
- source repetition countlowerBound
- lower bound on buffer sizeupperBound
- upper bound on buffer sizeprivate void assertMaxBuffer()
private void assertMaxClusterBuffer()
private void assertTotalBuffer()
private void assertBufferCalculation()
private void generateProcessorSymmetryDefinitions()
private void procSymInCluster(java.util.HashSet<java.lang.String> actrAllocated, int startProcIndex)
actrAllocated
- actors allocated to a clusterstartProcIndex
- starting index of the processorprivate void dmaSymInCluster(java.util.List<java.lang.String> dmaActorList, int startDmaIndex)
dmaActorList
- list of DMA actors allocated to the clusterstartDmaIndex
- starting index of DMA engineprivate void processorSymmetryConstraints()
private void clusterDmaStartTimePrecedences()
public void assertNonPipelineConstraints()
public void modelToGantt(java.util.Map<java.lang.String,java.lang.String> model, java.lang.String outputFileName)
model
- model obtained from the SMT solveroutputFileName
- output file namepublic int getTotalBufferSize(java.util.Map<java.lang.String,java.lang.String> model)
BufferConstraints
getTotalBufferSize
in interface BufferConstraints
model
- model returned by the Solver on a SAT result.public void generateBufferConstraint(int bufferConstraint)
BufferConstraints
generateBufferConstraint
in interface BufferConstraints
bufferConstraint
- total buffer size for the query.public int getLatency(java.util.Map<java.lang.String,java.lang.String> model)
LatencyConstraints
getLatency
in interface LatencyConstraints
model
- model returned by the Solver on a SAT result.public void generateLatencyConstraint(int latency)
LatencyConstraints
generateLatencyConstraint
in interface LatencyConstraints
latency
- upper bound on the latency value for the exploration.public void resetSolver()
Z3Solver
resetSolver
in class Z3Solver
public java.util.Map<java.lang.String,java.lang.String> getModel()
SolverFunctions
getModel
in interface SolverFunctions
getModel
in class Z3Solver