Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Deadline decomposition for Tetrisched #89

Merged
merged 2 commits into from
Feb 19, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,11 @@
"If True, the scheduler writes the status of each run to a seperate"
"log file in a format unique to every scheduler.",
)
flags.DEFINE_bool(
"enable_deadline_decomposition",
False,
"If True, the task deadline is decomposed per task based on critical path of the taskgraph",
)
flags.DEFINE_list(
"scheduler_log_times",
[],
Expand Down
38 changes: 36 additions & 2 deletions workload/jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -886,8 +886,42 @@ def _generate_task_graph(
task_graph_deadline = release_time + weighted_task_graph_length.fuzz(
deadline_variance, deadline_bounds
)
for task in task_graph.get_nodes():
task.update_deadline(task_graph_deadline)
if _flags and _flags.enable_deadline_decomposition:
stages_info = {}
stages = set([])
for task in task_graph.topological_sort():
stage = 0
for previous_task in task_graph.get_parents(task):
stage = max(stage, stages_info.get(previous_task, 0) + 1)
stages_info[task] = stage
stages.add(stage)

critical_path = task_graph.get_longest_path(
weights=lambda task: (task.slowest_execution_strategy.runtime.time)
)
critical_path_time = sum(
[t.slowest_execution_strategy.runtime.time for t in critical_path]
)
sukritkalra marked this conversation as resolved.
Show resolved Hide resolved
stage_wise_deadline = {}
for critical_task in critical_path:
stage_deadline = int(
task_graph_deadline.time
* critical_task.slowest_execution_strategy.runtime.time
/ critical_path_time
sukritkalra marked this conversation as resolved.
Show resolved Hide resolved
)
sukritkalra marked this conversation as resolved.
Show resolved Hide resolved
stage_wise_deadline[stages_info[critical_task]] = stage_deadline

for task in task_graph.get_nodes():
task_stage = min(
stage_wise_deadline.keys(), key=lambda s: abs(s - stages_info[task] if s>=stages_info[task] else float("inf") )
)
sukritkalra marked this conversation as resolved.
Show resolved Hide resolved
deadline = EventTime(
stage_wise_deadline[task_stage], unit=EventTime.Unit.US
sukritkalra marked this conversation as resolved.
Show resolved Hide resolved
)
task.update_deadline(deadline)
else:
for task in task_graph.get_nodes():
task.update_deadline(task_graph_deadline)

return task_graph

Expand Down
Loading