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
d5935e9d
Commit
d5935e9d
authored
1 month ago
by
Simon Bjurek
Browse files
Options
Downloads
Patches
Plain Diff
added docstrings for scheduler
parent
4303787c
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
+46
-11
46 additions, 11 deletions
b_asic/scheduler.py
with
46 additions
and
11 deletions
b_asic/scheduler.py
+
46
−
11
View file @
d5935e9d
from
abc
import
ABC
,
abstractmethod
from
typing
import
TYPE_CHECKING
,
cast
from
typing
import
TYPE_CHECKING
,
Optional
,
cast
from
b_asic.port
import
OutputPort
from
b_asic.special_operations
import
Delay
,
Output
...
...
@@ -9,17 +9,16 @@ if TYPE_CHECKING:
from
b_asic.schedule
import
Schedule
# class SchedulingAlgorithm(Enum):
# ASAP = "ASAP"
# ALAP = "ALAP"
# EARLIEST_DEADLINE = "earliest_deadline"
# # LEAST_SLACK = "least_slack" # to be implemented
# PROVIDED = "provided"
class
Scheduler
(
ABC
):
@abstractmethod
def
apply_scheduling
(
self
,
schedule
:
"
Schedule
"
)
->
None
:
"""
Applies the scheduling algorithm on the given Schedule.
Parameters
----------
schedule : Schedule
Schedule to apply the scheduling algorithm on.
"""
pass
def
_handle_outputs
(
self
,
schedule
,
non_schedulable_ops
)
->
None
:
...
...
@@ -41,7 +40,16 @@ class Scheduler(ABC):
class
ASAPScheduler
(
Scheduler
):
"""
Scheduler that implements the as-soon-as-possible (ASAP) algorithm.
"""
def
apply_scheduling
(
self
,
schedule
:
"
Schedule
"
)
->
None
:
"""
Applies the scheduling algorithm on the given Schedule.
Parameters
----------
schedule : Schedule
Schedule to apply the scheduling algorithm on.
"""
prec_list
=
schedule
.
sfg
.
get_precedence_list
()
if
len
(
prec_list
)
<
2
:
raise
ValueError
(
"
Empty signal flow graph cannot be scheduled.
"
)
...
...
@@ -114,8 +122,16 @@ class ASAPScheduler(Scheduler):
class
ALAPScheduler
(
Scheduler
):
"""
Scheduler that implements the as-late-as-possible (ALAP) algorithm.
"""
def
apply_scheduling
(
self
,
schedule
:
"
Schedule
"
)
->
None
:
# self.schedule_asap()
"""
Applies the scheduling algorithm on the given Schedule.
Parameters
----------
schedule : Schedule
Schedule to apply the scheduling algorithm on.
"""
ASAPScheduler
().
apply_scheduling
(
schedule
)
max_end_time
=
schedule
.
get_max_end_time
()
...
...
@@ -137,10 +153,29 @@ class ALAPScheduler(Scheduler):
class
EarliestDeadlineScheduler
(
Scheduler
):
def
__init__
(
self
,
max_resources
:
dict
[
TypeName
,
int
])
->
None
:
"""
Scheduler that implements the earliest-deadline-first algorithm.
Parameters
----------
max_resources : dict, optional
Dictionary like ``{Addition.type_name(): 2}`` denoting the maximum number of
resources for a given operation type if the scheduling algorithm considers
that. If not provided, or an operation type is not provided, at most one
resource is used.
"""
def
__init__
(
self
,
max_resources
:
Optional
[
dict
[
TypeName
,
int
]])
->
None
:
self
.
_max_resources
=
max_resources
def
apply_scheduling
(
self
,
schedule
:
"
Schedule
"
)
->
None
:
"""
Applies the scheduling algorithm on the given Schedule.
Parameters
----------
schedule : Schedule
Schedule to apply the scheduling algorithm on.
"""
# ACT BASED ON THE NUMBER OF PEs!
prec_list
=
schedule
.
sfg
.
get_precedence_list
()
if
len
(
prec_list
)
<
2
:
...
...
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