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
4d351708
Commit
4d351708
authored
1 month ago
by
Simon Bjurek
Browse files
Options
Downloads
Patches
Plain Diff
Cyclic scheduling is up and running, examples functional
parent
05b3d917
No related branches found
No related tags found
No related merge requests found
Pipeline
#157099
passed
1 month ago
Stage: test
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
b_asic/scheduler.py
+24
-36
24 additions, 36 deletions
b_asic/scheduler.py
examples/auto_scheduling_with_custom_io_times.py
+1
-1
1 addition, 1 deletion
examples/auto_scheduling_with_custom_io_times.py
examples/ldlt_matrix_inverse.py
+1
-0
1 addition, 0 deletions
examples/ldlt_matrix_inverse.py
with
26 additions
and
37 deletions
b_asic/scheduler.py
+
24
−
36
View file @
4d351708
...
@@ -235,7 +235,7 @@ class ListScheduler(Scheduler, ABC):
...
@@ -235,7 +235,7 @@ class ListScheduler(Scheduler, ABC):
)
)
alap_schedule
=
copy
.
copy
(
self
.
_schedule
)
alap_schedule
=
copy
.
copy
(
self
.
_schedule
)
alap_schedule
.
set
_schedule_time
(
sys
.
maxsize
)
alap_schedule
.
_schedule_time
=
None
ALAPScheduler
().
apply_scheduling
(
alap_schedule
)
ALAPScheduler
().
apply_scheduling
(
alap_schedule
)
alap_start_times
=
alap_schedule
.
start_times
alap_start_times
=
alap_schedule
.
start_times
self
.
_schedule
.
start_times
=
{}
self
.
_schedule
.
start_times
=
{}
...
@@ -248,14 +248,9 @@ class ListScheduler(Scheduler, ABC):
...
@@ -248,14 +248,9 @@ class ListScheduler(Scheduler, ABC):
f
"
{
alap_schedule
.
schedule_time
}
.
"
f
"
{
alap_schedule
.
schedule_time
}
.
"
)
)
used_resources_ready_times
=
{}
self
.
_remaining_resources
=
self
.
_max_resources
.
copy
()
self
.
_remaining_resources
=
self
.
_max_resources
.
copy
()
remaining_ops
=
(
remaining_ops
=
self
.
_sfg
.
operations
self
.
_sfg
.
operations
# + self._sfg.find_by_type_name(Input.type_name())
# + self._sfg.find_by_type_name(Output.type_name())
)
remaining_ops
=
[
op
.
graph_id
for
op
in
remaining_ops
]
remaining_ops
=
[
op
.
graph_id
for
op
in
remaining_ops
]
self
.
_schedule
.
start_times
=
{}
self
.
_schedule
.
start_times
=
{}
...
@@ -292,24 +287,12 @@ class ListScheduler(Scheduler, ABC):
...
@@ -292,24 +287,12 @@ class ListScheduler(Scheduler, ABC):
self
.
_get_next_op_id
(
ready_ops_priority_table
)
self
.
_get_next_op_id
(
ready_ops_priority_table
)
)
)
if
next_op
.
type_name
()
in
self
.
_remaining_resources
:
self
.
_remaining_resources
[
next_op
.
type_name
()]
-=
1
if
self
.
_schedule
.
schedule_time
is
not
None
:
used_resources_ready_times
[
next_op
]
=
(
self
.
_current_time
+
max
(
next_op
.
execution_time
,
1
)
)
%
self
.
_schedule
.
schedule_time
else
:
used_resources_ready_times
[
next_op
]
=
self
.
_current_time
+
max
(
next_op
.
execution_time
,
1
)
self
.
remaining_reads
-=
next_op
.
input_count
self
.
remaining_reads
-=
next_op
.
input_count
remaining_ops
=
[
remaining_ops
=
[
op_id
for
op_id
in
remaining_ops
if
op_id
!=
next_op
.
graph_id
op_id
for
op_id
in
remaining_ops
if
op_id
!=
next_op
.
graph_id
]
]
print
(
"
Next:
"
,
next_op
.
graph_id
,
self
.
_current_time
)
self
.
_time_out_counter
=
0
self
.
_time_out_counter
=
0
self
.
_schedule
.
place_operation
(
next_op
,
self
.
_current_time
)
self
.
_schedule
.
place_operation
(
next_op
,
self
.
_current_time
)
self
.
_op_laps
[
next_op
.
graph_id
]
=
(
self
.
_op_laps
[
next_op
.
graph_id
]
=
(
...
@@ -336,20 +319,7 @@ class ListScheduler(Scheduler, ABC):
...
@@ -336,20 +319,7 @@ class ListScheduler(Scheduler, ABC):
remaining_ops
,
remaining_ops
,
)
)
# update available reads and operators
if
self
.
_schedule
.
schedule_time
is
not
None
:
time
=
self
.
_current_time
%
self
.
_schedule
.
schedule_time
else
:
time
=
self
.
_current_time
self
.
remaining_reads
=
self
.
_max_concurrent_reads
self
.
remaining_reads
=
self
.
_max_concurrent_reads
for
operation
,
ready_time
in
used_resources_ready_times
.
items
():
if
ready_time
>=
time
:
self
.
_remaining_resources
[
operation
.
type_name
()]
+=
1
used_resources_ready_times
=
dict
(
[
pair
for
pair
in
used_resources_ready_times
.
items
()
if
pair
[
1
]
>
time
]
)
self
.
_current_time
-=
1
self
.
_current_time
-=
1
...
@@ -435,13 +405,31 @@ class ListScheduler(Scheduler, ABC):
...
@@ -435,13 +405,31 @@ class ListScheduler(Scheduler, ABC):
for
op_id
,
start_time
in
alap_start_times
.
items
()
for
op_id
,
start_time
in
alap_start_times
.
items
()
}
}
def
_op_satisfies_resource_constraints
(
self
,
op
:
"
Operation
"
)
->
bool
:
if
self
.
_schedule
.
schedule_time
is
not
None
:
time_slot
=
self
.
_current_time
%
self
.
_schedule
.
schedule_time
else
:
time_slot
=
self
.
_current_time
count
=
0
for
op_id
,
start_time
in
self
.
_schedule
.
start_times
.
items
():
if
self
.
_schedule
.
schedule_time
is
not
None
:
start_time
=
start_time
%
self
.
_schedule
.
schedule_time
if
time_slot
>=
start_time
:
if
time_slot
<
start_time
+
max
(
self
.
_sfg
.
find_by_id
(
op_id
).
execution_time
,
1
):
if
op_id
.
startswith
(
op
.
type_name
()):
if
op
.
graph_id
!=
op_id
:
count
+=
1
return
count
<
self
.
_remaining_resources
[
op
.
type_name
()]
def
_op_is_schedulable
(
def
_op_is_schedulable
(
self
,
op
:
"
Operation
"
,
remaining_ops
:
list
[
"
GraphID
"
]
self
,
op
:
"
Operation
"
,
remaining_ops
:
list
[
"
GraphID
"
]
)
->
bool
:
)
->
bool
:
if
(
if
not
self
.
_op_satisfies_resource_constraints
(
op
):
op
.
type_name
()
in
self
.
_remaining_resources
and
self
.
_remaining_resources
[
op
.
type_name
()]
==
0
):
return
False
return
False
op_finish_time
=
self
.
_current_time
+
op
.
latency
op_finish_time
=
self
.
_current_time
+
op
.
latency
...
...
This diff is collapsed.
Click to expand it.
examples/auto_scheduling_with_custom_io_times.py
+
1
−
1
View file @
4d351708
...
@@ -33,7 +33,7 @@ schedule.show()
...
@@ -33,7 +33,7 @@ schedule.show()
# %%
# %%
# Generate a non-cyclic Schedule from HybridScheduler with custom IO times.
# Generate a non-cyclic Schedule from HybridScheduler with custom IO times.
resources
=
{
Butterfly
.
type_name
():
1
,
ConstantMultiplication
.
type_name
():
1
}
resources
=
{
Butterfly
.
type_name
():
1
,
ConstantMultiplication
.
type_name
():
1
}
input_times
=
{
f
"
in
{
i
}
"
:
i
for
i
in
range
(
points
)}
input_times
=
{
f
"
in
{
i
}
"
:
i
-
2
for
i
in
range
(
points
)}
output_delta_times
=
{
f
"
out
{
i
}
"
:
i
for
i
in
range
(
points
)}
output_delta_times
=
{
f
"
out
{
i
}
"
:
i
for
i
in
range
(
points
)}
schedule
=
Schedule
(
schedule
=
Schedule
(
sfg
,
sfg
,
...
...
This diff is collapsed.
Click to expand it.
examples/ldlt_matrix_inverse.py
+
1
−
0
View file @
4d351708
...
@@ -86,6 +86,7 @@ schedule = Schedule(
...
@@ -86,6 +86,7 @@ schedule = Schedule(
scheduler
=
HybridScheduler
(
scheduler
=
HybridScheduler
(
resources
,
input_times
=
input_times
,
output_delta_times
=
output_delta_times
resources
,
input_times
=
input_times
,
output_delta_times
=
output_delta_times
),
),
schedule_time
=
32
,
cyclic
=
True
,
cyclic
=
True
,
)
)
print
(
"
Scheduling time:
"
,
schedule
.
schedule_time
)
print
(
"
Scheduling time:
"
,
schedule
.
schedule_time
)
...
...
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