diff --git a/schedulers/tetrisched/include/tetrisched/Scheduler.hpp b/schedulers/tetrisched/include/tetrisched/Scheduler.hpp index 103dfb83..d53a8cc5 100644 --- a/schedulers/tetrisched/include/tetrisched/Scheduler.hpp +++ b/schedulers/tetrisched/include/tetrisched/Scheduler.hpp @@ -1,9 +1,9 @@ #ifndef _TETRISCHED_SCHEDULER_HPP_ #define _TETRISCHED_SCHEDULER_HPP_ +#include "tetrisched/OptimizationPasses.hpp" #include "tetrisched/Partition.hpp" #include "tetrisched/Solver.hpp" -#include "tetrisched/OptimizationPasses.hpp" namespace tetrisched { class Scheduler { @@ -29,7 +29,7 @@ class Scheduler { /// Registers the STRL expression for the scheduler to schedule from /// and parses it to populate the SolverModel. void registerSTRL(ExpressionPtr expression, Partitions availablePartitions, - Time currentTime); + Time currentTime, bool optimize = false); /// Invokes the solver to schedule the registered STRL expression /// on the given partitions at the given time. diff --git a/schedulers/tetrisched/src/OptimizationPasses.cpp b/schedulers/tetrisched/src/OptimizationPasses.cpp index fceb296c..83997725 100644 --- a/schedulers/tetrisched/src/OptimizationPasses.cpp +++ b/schedulers/tetrisched/src/OptimizationPasses.cpp @@ -350,8 +350,7 @@ void CriticalPathOptimizationPass::runPass(ExpressionPtr strlExpression) { computeTimeBounds(strlExpression); /* Phase 2: The previous phase computes the tight bounds but does not - push them down necessarily. In this phase, we push the bounds down and - purge nodes that cannot be used. */ + push them down necessarily. In this phase, we push the bounds down. */ pushDownTimeBounds(strlExpression); /* Phase 3: The bounds have been pushed down now, we can do a bottom-up diff --git a/schedulers/tetrisched/src/Scheduler.cpp b/schedulers/tetrisched/src/Scheduler.cpp index 8b7abf84..cacb521d 100644 --- a/schedulers/tetrisched/src/Scheduler.cpp +++ b/schedulers/tetrisched/src/Scheduler.cpp @@ -32,7 +32,8 @@ Scheduler::Scheduler(Time discretization, SolverBackendType solverBackend) } void Scheduler::registerSTRL(ExpressionPtr expression, - Partitions availablePartitions, Time currentTime) { + Partitions availablePartitions, Time currentTime, + bool optimize) { // Clear the previously saved expressions in the SolverModel. solverModel->clear(); @@ -43,11 +44,14 @@ void Scheduler::registerSTRL(ExpressionPtr expression, "but is of type: " + std::to_string(expression->getType()) + "."); } + // Save the expression. this->expression = expression; // Run the OptimizationPasses on this expression. - optimizationPasses.runPasses(expression); + if (optimize) { + optimizationPasses.runPasses(expression); + } // Create the CapacityConstraintMap for the STRL tree to add constraints to. CapacityConstraintMap capacityConstraintMap(discretization); diff --git a/schedulers/tetrisched_scheduler.py b/schedulers/tetrisched_scheduler.py index ef043e1d..fafc6b41 100644 --- a/schedulers/tetrisched_scheduler.py +++ b/schedulers/tetrisched_scheduler.py @@ -183,7 +183,9 @@ def schedule( # Register the STRL expression with the scheduler and solve it. try: - self._scheduler.registerSTRL(objective_strl, partitions, sim_time.time) + self._scheduler.registerSTRL( + objective_strl, partitions, sim_time.time, True + ) solver_start_time = time.time() self._scheduler.schedule(sim_time.time) solver_end_time = time.time()