Skip to content

Commit

Permalink
[BUG] Do not generate Placements for tasks that were skipped by Alloc…
Browse files Browse the repository at this point in the history
…ationExpressions.
  • Loading branch information
sukritkalra committed Apr 16, 2024
1 parent a476bc6 commit 937eee0
Showing 1 changed file with 23 additions and 3 deletions.
26 changes: 23 additions & 3 deletions schedulers/tetrisched_scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@ def __init__(
# sure that no optimization passes remove it.
# Reset at the beginning of each Scheduler invocation (`schedule()`).
self._individual_task_strls: Mapping[str, tetrisched.Expression] = {}
self._skipped_task_names: Set[str] = set()
# A cache for previously selected choose expressions, this is done for
# providing better hints to the solver
self._previously_satisfied_choose_exprs = set([])
Expand Down Expand Up @@ -664,7 +665,7 @@ def schedule(
]

# Keep track of the Tasks that have not been considered for scheduling.
skipped_task_names = set()
self._skipped_task_names: Set[str] = set()
if self.release_taskgraphs:
# Find the TaskGraphs that are available for scheduling.
task_graphs_for_scheduling = self._choose_task_graphs_for_scheduling(
Expand Down Expand Up @@ -732,7 +733,13 @@ def schedule(
f"previously placed tasks to account for "
f"correct Allocations."
)
skipped_task_names.add(task.unique_name)
self._skipped_task_names.add(task.unique_name)
self._logger.debug(
"[%s] Adding %s to the tasks being "
"skipped for scheduling.",
sim_time.time,
task.unique_name,
)
continue

# Construct the STRL.
Expand Down Expand Up @@ -800,6 +807,12 @@ def schedule(
if task_strl is not None:
objective_strl.addChild(task_strl)

self._logger.debug(
"[%s] The tasks being skipped from scheduling were: %s.",
sim_time.time,
", ".join(list(self._skipped_task_names)),
)

# Register the STRL expression with the scheduler and solve it.
try:
self._scheduler.registerSTRL(
Expand Down Expand Up @@ -878,7 +891,7 @@ def schedule(

# Retrieve the Placements for each task.
for task in tasks_to_be_scheduled:
if task.unique_name in skipped_task_names:
if task.unique_name in self._skipped_task_names:
# If the task was skipped, then we honor the previous placement.
self._logger.debug(
f"[{sim_time.time}] Honoring prior placement for Task "
Expand Down Expand Up @@ -1201,6 +1214,13 @@ def construct_task_strl(
)
if task.state == TaskState.SCHEDULED:
task_allocation_expression.setPreviouslySatisfied(True)

self._skipped_task_names.add(task.unique_name)
self._logger.debug(
"[%s] Adding %s to the tasks being skipped for scheduling.",
current_time.time,
task.unique_name,
)
self._logger.debug(
f"[{current_time.time}] Generated an AllocationExpression for "
f"task {task.unique_name} in state {task.state} starting at "
Expand Down

0 comments on commit 937eee0

Please sign in to comment.