Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
hpvm-release
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
llvm
hpvm-release
Commits
d579f04c
Commit
d579f04c
authored
5 years ago
by
Elizabeth
Browse files
Options
Downloads
Patches
Plain Diff
Implemented code to run promise simulator
parent
8c507806
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
llvm/projects/soc_simulator/src/driver.py
+33
-0
33 additions, 0 deletions
llvm/projects/soc_simulator/src/driver.py
with
33 additions
and
0 deletions
llvm/projects/soc_simulator/src/driver.py
+
33
−
0
View file @
d579f04c
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
from
collections
import
defaultdict
from
collections
import
defaultdict
import
os
import
os
import
subprocess
import
sys
import
sys
def
build_nested_default_dict
():
def
build_nested_default_dict
():
...
@@ -145,6 +146,38 @@ def quantize(curr_layer, prev_layer, h2f_f2h_operation_ind, layer_data):
...
@@ -145,6 +146,38 @@ def quantize(curr_layer, prev_layer, h2f_f2h_operation_ind, layer_data):
assert
(
False
)
# Error: Should never reach this section
assert
(
False
)
# Error: Should never reach this section
def
run_promise_simulation
(
swing
,
layer_data
):
layer_name
=
layer_data
[
"
Name
"
]
patch_factor
=
1
if
is_conv
(
layer_name
):
rows_a
=
layer_data
[
"
N
"
]
*
layer_data
[
"
H
"
]
*
layer_data
[
"
W
"
]
\
/
(
layer_data
[
"
Sh
"
]
*
layer_data
[
"
Sw
"
])
cols_a
=
layer_data
[
"
Cin
"
]
*
layer_data
[
"
Kh
"
]
*
layer_data
[
"
Kw
"
]
rows_b
=
cols_a
cols_b
=
layer_data
[
"
Cout
"
]
patch_factor
=
layer_data
[
"
Kh
"
]
*
layer_data
[
"
Kw
"
]
elif
is_fc
(
layer_name
):
rows_a
=
layer_data
[
"
RA
"
]
cols_a
=
layer_data
[
"
CA
"
]
rows_b
=
cols_a
cols_b
=
layer_data
[
"
CB
"
]
else
:
print
(
"
PROMISE can
'
t run whatever this layer is.
"
)
exit
(
1
)
# Run promise simulator
# TODO need to print time and energy so we can pipe it
# get output --> total time and energy
ptm_process
=
subprocess
.
Popen
([
"
./ptm
"
,
str
(
rows_a
),
str
(
cols_a
),
str
(
rows_b
),
\
str
(
cols_b
),
str
(
patch_factor
),
str
(
swing
)])
output
,
_
=
ptm_process
.
communicate
()
total_time_energy
=
output
.
strip
().
split
(
'
'
)
assert
(
len
(
total_time_energy
)
==
2
)
return
total_time_energy
[
0
],
total_time_energy
[
1
]
def
run_simulations
(
config_filename
,
results_filename
):
def
run_simulations
(
config_filename
,
results_filename
):
config_file
=
open
(
config_filename
,
"
r
"
)
config_file
=
open
(
config_filename
,
"
r
"
)
results_file
=
open
(
results_filename
,
"
w
"
)
results_file
=
open
(
results_filename
,
"
w
"
)
...
...
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