...
 
Commits (2)
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -261,7 +261,7 @@ public class InputInstance {
for (List<HwNode> readRoute : pr) {
for (List<HwNode> writeRoute : pw) {
readRoute.addAll(writeRoute);
paths.add(readRoute); // paths contains all combinations of transfer scenarios but hardly identifiable
paths.add(readRoute);
} //transfer_controller, route1, memSrc, transfer_controller, route2, memDst
}
......@@ -281,7 +281,7 @@ public class InputInstance {
return createPaths(removeRedundantPaths(paths));
}
public List<Path> createPaths(List<List<HwNode>> paths_){
public List<Path> createPaths(List<List<HwNode>> paths_) {
List<Path> paths = new ArrayList<>();
......@@ -299,8 +299,8 @@ public class InputInstance {
i++;
}
path.setReadRoute(pathi.subList(1,j-1));
path.setWriteRoute(pathi.subList(j+1, pathi.size() - 1));
path.setReadRoute(pathi.subList(1, j - 1));
path.setWriteRoute(pathi.subList(j + 1, pathi.size() - 1));
for (HwNode node : pathi.subList(j, pathi.size())) {
if (node instanceof HwMemory) {
......@@ -313,7 +313,7 @@ public class InputInstance {
paths.add(path);
}
return paths;
return paths;
}
......@@ -326,8 +326,34 @@ public class InputInstance {
}
public int getWCCT(TMLChannel channel, Path path) {
//TODO : add implementation
return channel.getNumberOfSamples();
return (channel.getSize() / findMinThroughput(path)) ;
}
public static Integer findMinThroughput(Path path) {
Integer min = Integer.MAX_VALUE;
for (HwNode node : path.getReadRoute()) {
if (node instanceof HwBus) {
HwBus bus = (HwBus) node;
if (min > bus.byteDataSize) {
min = bus.byteDataSize;
}
}
}
for (HwNode node : path.getWriteRoute()) {
if (node instanceof HwBus) {
HwBus bus = (HwBus) node;
if (min > bus.byteDataSize) {
min = bus.byteDataSize;
}
}
}
return min;
}
}
\ No newline at end of file
......@@ -53,8 +53,16 @@ public class OptimizationModel {
ctx = new Context(cfg);
long startTime = System.currentTimeMillis();
result = findOptimizedMapping(ctx);
long endTime = System.currentTimeMillis();
float seconds = (endTime - startTime) / 1000F;
TraceManager.addDev("DSE Resolution Time: " + seconds + "seconds.");
Log.close();
if (Log.isOpen())
TraceManager.addDev("Log is still open!");
......@@ -462,11 +470,17 @@ public class OptimizationModel {
TraceManager.addDev("\nFind an optimized Mapping");
long startTimePath = System.currentTimeMillis();
List<Path> paths = inputInstance.getAllPathsFromArch(inputInstance.getArchitecture());
long endTimePath = System.currentTimeMillis();
float seconds = (endTimePath - startTimePath) / 1000F;
TraceManager.addDev("Time to get all paths: " + seconds + "seconds.");
for (Path path : paths) {
/* for (Path path : paths) {
TraceManager.addDev(path.getController().getName() + " / " + path.getSource().getName() + " / " + path.getDestination().getName() +
"\n");
TraceManager.addDev("Read Route");
......@@ -478,23 +492,15 @@ public class OptimizationModel {
TraceManager.addDev(node.getName() + " / ");
}
}
*/
TraceManager.addDev("#PATHS-------------------------------------------------------------");
TraceManager.addDev("#PATHS---");
System.out.println(paths.size());
//uncomment to print all generated paths
/*
for (List<HwNode> path : paths) {
for (HwNode node : path) {
System.out.print(node.getName() + " / ");
}
System.out.println("\n");
}
*/
long startTimeModel = System.currentTimeMillis();
//Decision variables
//Definition of Xtp as a matrix. Each cell corresponds to a combination of a task and a processor.
......@@ -993,10 +999,22 @@ public class OptimizationModel {
// Add minimization objective.
Optimize.Handle objective_latency = opt.MkMinimize(latency);
long endTimeModel = System.currentTimeMillis();
float secondsModel = (endTimeModel - startTimeModel) / 1000F;
TraceManager.addDev("Time to build CSP: " + secondsModel + "seconds.");
String outputToDisplay;
long startTimeSolver = System.currentTimeMillis();
if (opt.Check() == Status.SATISFIABLE) {
Model m = opt.getModel();
long endTimeSolver = System.currentTimeMillis();
float secondsSolver = (endTimeSolver - startTimeSolver) / 1000F;
TraceManager.addDev("Time to check satisfiability: " + secondsSolver + "seconds.");
Expr[][] optimized_result_X = new Expr[inputInstance.getModeling().getTasks().size()][inputInstance.getArchitecture().getCPUs().size()];
Expr[] optimized_result_start = new Expr[inputInstance.getModeling().getTasks().size()];
Expr[] optimized_result_startY = new Expr[inputInstance.getModeling().getChannels().size()];
......@@ -1006,7 +1024,7 @@ public class OptimizationModel {
tmlMapping = new TMLMapping<>(inputInstance.getModeling(), inputInstance.getArchitecture(), false);
outputToDisplay = "\nThe optimal mapping solution (latency = " + m.evaluate(latency, true) + ") is:\n\n";
outputToDisplay = "\nThe optimal mapping solution (latency = " + m.evaluate(latency, true) + " cycles) is:\n\n";
outputToDisplay = outputToDisplay + "(1) Spatial mapping of tasks:\n";
outputToDisplay = outputToDisplay + "\nTASK --> PLATFORM NODE\n";
......@@ -1093,7 +1111,9 @@ public class OptimizationModel {
//mapping of communication channels
outputToDisplay = outputToDisplay + "\n\n(3) Spatial mapping of channels:\n";
outputToDisplay = outputToDisplay + "\nCHANNEL --> PATH (Controller, source, destination) \n" ;
outputToDisplay = outputToDisplay + "\nCHANNEL --> PATH (Controller, reading route, source, writing " +
"route, " +
" destination) \n" ;
for (Object channel : inputInstance.getModeling().getChannels()) {
int c = inputInstance.getModeling().getChannels().indexOf(channel);
......@@ -1130,16 +1150,25 @@ public class OptimizationModel {
6)add evaluation of routes
// PS; comment réserver les routes unité par unité
*/
outputToDisplay = outputToDisplay + "\nChannel (" + channelCast.getOriginTask().getTaskName() + ", " +
/* outputToDisplay = outputToDisplay + "\nChannel (" + channelCast.getOriginTask().getTaskName() + ", " +
channelCast.getDestinationTask().getTaskName() + ") --> " + path
.getController().getName() + ", " + path.getSource().getName() + ", " + path.getDestination().getName();
*/
outputToDisplay += "\nChannel (" + channelCast.getOriginTask().getTaskName() + ", " +
channelCast.getDestinationTask().getTaskName() + ") --> " + path
.getController().getName() + ",\n\t\t\t\t\t\t\t " + path.printReadRoute()+ ", \n\t\t\t\t\t\t\t" + path
.getSource().getName() + ",\n\t\t\t\t\t\t\t" +
path
.printWriteRoute()+ ", \n\t\t\t\t\t\t\t"+ path
.getDestination().getName();
//TODO CHECH PLACE
//TODO CHECk PLACE
TraceManager.addDev("\nChannel (" + channelCast.getOriginTask().getTaskName() + ", " +
channelCast.getDestinationTask().getTaskName() + ") --> " + path
.getController().getName() + ", " + path.printReadRoute()+ ", " + path.getSource().getName() + ", " + path
.printWriteRoute()+ ", "+ path
.getController().getName() + ",\n\t\t\t\t\t\t\t\t " + path.printReadRoute()+ ", \n\t\t\t\\t\t\tt\t" + path.getSource().getName() + ",\n\t\t\t\t\t\t\t\t" +
path
.printWriteRoute()+ ", \n\t\t\t\t\t\t\t\t"+ path
.getDestination().getName() );
}
}
......