public abstract class GenericPartitionSolver extends Z3Solver implements WorkloadCommClusterConstraints, WrkLdCommCostConstraints, MaxWrkLdCommCostClusterConstraints, WorkloadImbalanceConstraints, CommunicationCostConstraints, ClusterConstraints, MaxWorkLoadPerCluster
Z3Solver.SatResult
Modifier and Type | Field and Description |
---|---|
protected Graph |
graph
Application Graph
|
protected Graph |
hsdf
Equivalent HSDF graph of application graph
|
protected Platform |
platform
Target platform
|
protected Solutions |
solutions
Solutions of the application graph.
|
protected int |
totalWork
Total workload of the application graph
|
boolean |
useImbalance
Use Maximum workload per cluster (false)
or workload imbalance between the clusters (true)
|
protected java.util.Map<java.lang.String,com.microsoft.z3.Expr> |
varDecl
Map of SMT variables
|
contextStatements, pushedContext, statementCountAfterPush, z3Solver
Constructor and Description |
---|
GenericPartitionSolver(Graph inputGraph,
Graph hsdf,
Solutions solutions,
Platform platform)
Initialize a generic partition solver object
|
Modifier and Type | Method and Description |
---|---|
protected void |
calculateWorkImbalance(int numClustersUsed)
Calculate workload imbalance for all the clusters.
|
protected com.microsoft.z3.IntExpr |
clusterAllocatedWorkId(int clusterId)
Get SMT variable of workload allocated on a cluster
|
protected com.microsoft.z3.IntExpr |
clusterImbalanceId(int clusterId)
Get SMT variable of workload imbalance on a cluster
|
protected com.microsoft.z3.IntExpr |
clusterTaskAllocationId(java.lang.String name)
Get SMT variable of an actor allocated to a cluster
|
protected com.microsoft.z3.IntExpr |
clusterTaskAllocationId(java.lang.String name,
int instanceId)
Get SMT variable of an actor instance allocated to a cluster
|
protected com.microsoft.z3.IntExpr |
commCostId(java.lang.String name)
Get SMT variable of communication cost for a channel in application graph
|
protected void |
defineClusterVariables()
Define all the variables required for clusters.
|
void |
generateClusterConstraint(int numClusters)
Set total number of clusters used as a constraint.
|
void |
generateCommunicationCostConstraint(int constraintValue)
Sets the Communication cost constraint for the exploration query
|
void |
generateMaxWorkloadPerClusterConstraint(int constraintValue)
Set the maximum workload per cluster constraint for exploration query.
|
abstract void |
generatePartitioningConstraints()
Generate all the partitioning constraints
|
void |
generateWorkImbalanceConstraint(int constraintValue)
Set an upper bound on max workload imbalance between the clusters.
|
int |
getCommunicationCost(java.util.Map<java.lang.String,java.lang.String> model)
Get the communication cost calculated in the model.
|
int |
getMaxWorkLoadPerCluster(java.util.Map<java.lang.String,java.lang.String> model)
Get maximum workload per cluster from the solver model.
|
int |
getTotalClustersUsed(java.util.Map<java.lang.String,java.lang.String> model)
Get total number of clusters used from the model.
|
int |
getWorkLoadImbalance(java.util.Map<java.lang.String,java.lang.String> model) |
protected void |
maxWorkLoadOnCluster()
Calculate maximum workload on a cluster
|
protected com.microsoft.z3.IntExpr |
maxWorkloadOnClusterId()
Get SMT variable of maximum workload allocated to all clusters
|
protected abstract DesignFlowSolution.Partition |
modelToPartition(java.util.Map<java.lang.String,java.lang.String> model,
DesignFlowSolution designFlowSolution)
Sets a new partition in design flow solution
|
private Graph |
modelToPartitionAwareGraph(java.util.Map<java.lang.String,java.lang.String> model)
Convert a model to partition aware graph by inserting DMA actors.
|
void |
setDesignFlowSolution(DesignFlowSolution designFlowSolution,
java.util.Map<java.lang.String,java.lang.String> model)
Set design flow solution parameters such as partition aware graph, solutions, etc.
|
protected com.microsoft.z3.IntExpr |
totalClustersUsedId()
Get SMT variable of total number of clusters used in the problem
|
protected com.microsoft.z3.IntExpr |
totalCommCostId()
Get SMT variable of total communication cost
|
protected void |
totalWorkImbalance()
Calculate the total workload imbalance between the clusters.
|
protected com.microsoft.z3.IntExpr |
totalWorkImbalanceId()
Get SMT variable of total workload imbalance
|
addVariableDeclaration, checkSat, declareFunction, generateAssertion, generateSatCode, getModel, getStatistics, popContext, printContext, pushContext, resetSolver, setTacTicSolver
check, getModel, getVersion, setRandomSeed
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
checkSat, getModel, popContext, pushContext
protected Graph graph
protected Graph hsdf
protected Solutions solutions
protected int totalWork
protected java.util.Map<java.lang.String,com.microsoft.z3.Expr> varDecl
protected Platform platform
public boolean useImbalance
public GenericPartitionSolver(Graph inputGraph, Graph hsdf, Solutions solutions, Platform platform)
inputGraph
- application graphhsdf
- equivalent HSDF graphsolutions
- solutions to the application graphplatform
- target platformprotected com.microsoft.z3.IntExpr totalWorkImbalanceId()
protected com.microsoft.z3.IntExpr clusterImbalanceId(int clusterId)
clusterId
- cluster idprotected com.microsoft.z3.IntExpr clusterAllocatedWorkId(int clusterId)
clusterId
- cluster idprotected com.microsoft.z3.IntExpr totalClustersUsedId()
protected com.microsoft.z3.IntExpr totalCommCostId()
protected com.microsoft.z3.IntExpr commCostId(java.lang.String name)
name
- name of the channelprotected com.microsoft.z3.IntExpr maxWorkloadOnClusterId()
protected com.microsoft.z3.IntExpr clusterTaskAllocationId(java.lang.String name, int instanceId)
name
- actor nameinstanceId
- instance idprotected com.microsoft.z3.IntExpr clusterTaskAllocationId(java.lang.String name)
name
- name of the actorprotected void defineClusterVariables()
protected void totalWorkImbalance()
protected void calculateWorkImbalance(int numClustersUsed)
numClustersUsed
- total number of clusters usedprotected void maxWorkLoadOnCluster()
public abstract void generatePartitioningConstraints()
public void setDesignFlowSolution(DesignFlowSolution designFlowSolution, java.util.Map<java.lang.String,java.lang.String> model)
designFlowSolution
- design flow solution to be modifiedmodel
- model from the SMT solver for partitioningprivate Graph modelToPartitionAwareGraph(java.util.Map<java.lang.String,java.lang.String> model)
model
- model of solution from the SMT solverprotected abstract DesignFlowSolution.Partition modelToPartition(java.util.Map<java.lang.String,java.lang.String> model, DesignFlowSolution designFlowSolution)
model
- model of solution from the SMT solverdesignFlowSolution
- design flow solution to be modifiedpublic int getMaxWorkLoadPerCluster(java.util.Map<java.lang.String,java.lang.String> model)
MaxWorkLoadPerCluster
getMaxWorkLoadPerCluster
in interface MaxWorkLoadPerCluster
model
- model returned by the Solver on a SAT result.public void generateMaxWorkloadPerClusterConstraint(int constraintValue)
MaxWorkLoadPerCluster
generateMaxWorkloadPerClusterConstraint
in interface MaxWorkLoadPerCluster
constraintValue
- upper bound on max workload allocated to the cluster.public int getTotalClustersUsed(java.util.Map<java.lang.String,java.lang.String> model)
ClusterConstraints
getTotalClustersUsed
in interface ClusterConstraints
model
- model returned by the Solver on a SAT result.public void generateClusterConstraint(int numClusters)
ClusterConstraints
generateClusterConstraint
in interface ClusterConstraints
numClusters
- number of clusters to be usedpublic void generateCommunicationCostConstraint(int constraintValue)
CommunicationCostConstraints
generateCommunicationCostConstraint
in interface CommunicationCostConstraints
public int getCommunicationCost(java.util.Map<java.lang.String,java.lang.String> model)
CommunicationCostConstraints
getCommunicationCost
in interface CommunicationCostConstraints
model
- model returned by the Solver on a SAT result.public void generateWorkImbalanceConstraint(int constraintValue)
WorkloadImbalanceConstraints
generateWorkImbalanceConstraint
in interface WorkloadImbalanceConstraints
constraintValue
- Set upper bound on max workload imbalance.public int getWorkLoadImbalance(java.util.Map<java.lang.String,java.lang.String> model)
getWorkLoadImbalance
in interface WorkloadImbalanceConstraints
model
- model returned by the Solver on a SAT result.