Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
predtuner
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
Package registry
Model registry
Operate
Environments
Terraform modules
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
predtuner
Commits
8b2c96c4
Commit
8b2c96c4
authored
4 years ago
by
Yifan Zhao
Browse files
Options
Downloads
Patches
Plain Diff
Changing metadata protocol
parent
617927d5
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
predtuner/pipedbin.py
+10
-16
10 additions, 16 deletions
predtuner/pipedbin.py
with
10 additions
and
16 deletions
predtuner/pipedbin.py
+
10
−
16
View file @
8b2c96c4
...
...
@@ -165,37 +165,31 @@ class PipedBinaryApp(ModeledApp):
metadata
=
json
.
load
(
f
)
op_costs
=
metadata
[
"
op_cost
"
]
op_knobs
=
metadata
[
"
op_knobs
"
]
knob_speedup
=
metadata
[
"
knob_speedup
"
]
knob_devices
=
metadata
[
"
knob_devices
"
]
baseline_knob
=
metadata
[
"
baseline_knob
"
]
knobs
=
metadata
[
"
knobs
"
]
# Check sanity
if
set
(
op_costs
.
keys
())
!=
set
(
op_knobs
.
keys
()):
raise
ValueError
(
"
Operators listed in layer_cost and knobs_of_layer mismatch
"
)
if
set
(
knob_speedup
.
keys
())
!=
set
(
knob_devices
.
keys
()):
raise
ValueError
(
"
Knobs listed in knob_speedup and knob_devices mismatch
"
)
knobs_used
=
set
().
union
(
*
[
set
(
knobs
)
for
knobs
in
op_knobs
.
values
()])
knobs_defined
=
set
(
knob
_speedup
.
keys
())
knobs_defined
=
set
(
knob
s
.
keys
())
undefined
=
knobs_used
-
knobs_defined
if
undefined
:
raise
ValueError
(
f
"
These knobs used in knobs_of_layer are undefined:
{
undefined
}
"
)
if
baseline_knob
not
in
knobs_defined
:
raise
ValueError
(
f
"
baseline_knob
{
baseline_knob
}
is undefined
"
)
# Create actual knob object from knob names
name2knob
=
{
s
:
ApproxKnob
(
s
,
knob_devices
[
s
],
(
0
if
s
==
baseline_knob
else
None
))
for
s
in
knobs_used
}
op_knobs
=
{
op
:
[
name2knob
[
k
]
for
k
in
knobs
]
for
op
,
knobs
in
op_knobs
.
items
()}
knob_objs
=
{}
knob_speedup
=
{}
for
knob_name
,
knob_args
in
knobs
.
items
():
knob_speedup
[
knob_name
]
=
knob_args
.
pop
(
"
speedup
"
)
knob_objs
[
knob_name
]
=
ApproxKnob
(
knob_name
,
**
knob_args
)
op_knobs
=
{
op
:
[
knob_objs
[
k
]
for
k
in
knobs
]
for
op
,
knobs
in
op_knobs
.
items
()}
# Process other fields in metadata
tune_labels_file
=
Path
(
metadata
[
"
tune_labels_path
"
])
tune_labels
=
torch
.
from_numpy
(
np
.
fromfile
(
tune_labels_file
,
dtype
=
np
.
int32
))
conf_file
=
Path
(
metadata
[
"
conf_path
"
])
# Our "w" file is the binary's "r" file, vice versa
#
--
Our "w" file is the binary's "r" file, vice versa
fifo_r_file
=
Path
(
metadata
[
"
fifo_path_w
"
])
fifo_w_file
=
Path
(
metadata
[
"
fifo_path_r
"
])
return
(
...
...
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