Skip to content

Commit

Permalink
Allow turning off optimization in STRL.
Browse files Browse the repository at this point in the history
  • Loading branch information
sukritkalra committed Nov 5, 2023
1 parent 29e0fd4 commit a28a296
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 7 deletions.
4 changes: 2 additions & 2 deletions schedulers/tetrisched/include/tetrisched/Scheduler.hpp
Original file line number Diff line number Diff line change
@@ -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 {
Expand All @@ -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.
Expand Down
3 changes: 1 addition & 2 deletions schedulers/tetrisched/src/OptimizationPasses.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 6 additions & 2 deletions schedulers/tetrisched/src/Scheduler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand All @@ -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);
Expand Down
4 changes: 3 additions & 1 deletion schedulers/tetrisched_scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit a28a296

Please sign in to comment.