Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B-ASIC - Better ASIC Toolbox
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Computer Engineering
B-ASIC - Better ASIC Toolbox
Commits
f36057d7
Commit
f36057d7
authored
1 month ago
by
Simon Bjurek
Browse files
Options
Downloads
Patches
Plain Diff
there is a bug that can occur when an op is scheduled before predecessors
parent
87268b64
No related branches found
Branches containing commit
No related tags found
1 merge request
!461
Finalize earliest deadline scheduler
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
b_asic/scheduler.py
+25
-9
25 additions, 9 deletions
b_asic/scheduler.py
with
25 additions
and
9 deletions
b_asic/scheduler.py
+
25
−
9
View file @
f36057d7
...
...
@@ -181,7 +181,7 @@ class EarliestDeadlineScheduler(Scheduler):
Schedule to apply the scheduling algorithm on.
"""
# TODO:
Take the execution time into consideration!
# TODO:
Solve bug where operation (ADD) is scheduled before proceeding (MUL) -> pipelining
ALAPScheduler
().
apply_scheduling
(
schedule
)
...
...
@@ -190,9 +190,15 @@ class EarliestDeadlineScheduler(Scheduler):
input_op
=
cast
(
Input
,
input_op
)
schedule
.
move_operation_asap
(
input_op
.
graph_id
)
# construct the set of remaining operations, excluding inputs
remaining_ops
=
set
(
schedule
.
start_times
.
keys
())
remaining_ops
=
{
elem
for
elem
in
remaining_ops
if
not
elem
.
startswith
(
"
in
"
)}
# construct a dictionarry for storing how many times until a resource is available again
used_resources_ready_times
=
{}
# iterate through all remaining operations and schedule them
# while not exceeding the available resources
remaining_resources
=
self
.
_max_resources
.
copy
()
current_time
=
0
while
remaining_ops
:
...
...
@@ -202,13 +208,23 @@ class EarliestDeadlineScheduler(Scheduler):
if
not
best_candidate
:
current_time
+=
1
remaining_resources
=
self
.
_max_resources
.
copy
()
# update available operators
for
operation
,
ready_time
in
used_resources_ready_times
.
items
():
print
(
ready_time
,
current_time
)
if
ready_time
==
current_time
:
remaining_resources
[
operation
.
type_name
()]
+=
1
# remaining_resources = self._max_resources.copy()
continue
# update remaining resources
#
if the resource is constrained,
update remaining resources
if
best_candidate
.
type_name
()
in
remaining_resources
:
remaining_resources
[
best_candidate
.
type_name
()]
-=
1
used_resources_ready_times
[
best_candidate
]
=
(
current_time
+
best_candidate
.
execution_time
)
# schedule the best candidate to the current time
remaining_ops
.
remove
(
best_candidate
.
graph_id
)
schedule
.
start_times
[
best_candidate
.
graph_id
]
=
current_time
...
...
@@ -222,11 +238,16 @@ class EarliestDeadlineScheduler(Scheduler):
def
_find_best_candidate
(
schedule
,
remaining_ops
,
remaining_resources
,
current_time
):
# precompute source end times for faster checks
sfg
=
schedule
.
sfg
source_end_times
=
defaultdict
(
float
)
# find the best candidate
best_candidate
=
None
best_deadline
=
float
(
'
inf
'
)
for
op_id
in
remaining_ops
:
operation
=
sfg
.
find_by_id
(
op_id
)
# compute maximum end times of preceding operations
for
op_input
in
operation
.
inputs
:
source_op
=
op_input
.
signals
[
0
].
source
.
operation
if
not
isinstance
(
source_op
,
Delay
):
...
...
@@ -235,11 +256,6 @@ class EarliestDeadlineScheduler(Scheduler):
schedule
.
start_times
[
source_op
.
graph_id
]
+
source_op
.
latency
,
)
best_candidate
=
None
best_deadline
=
float
(
'
inf
'
)
for
op_id
in
remaining_ops
:
operation
=
sfg
.
find_by_id
(
op_id
)
# check resource constraints
if
operation
.
type_name
()
in
remaining_resources
:
if
remaining_resources
[
operation
.
type_name
()]
==
0
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment