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
a95a2982
Commit
a95a2982
authored
4 years ago
by
Yifan Zhao
Browse files
Options
Downloads
Patches
Plain Diff
Default model-less performance is given by measuring time
parent
9c1786d0
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/torchapp.py
+9
-2
9 additions, 2 deletions
predtuner/torchapp.py
with
9 additions
and
2 deletions
predtuner/torchapp.py
+
9
−
2
View file @
a95a2982
...
@@ -123,16 +123,21 @@ class TorchApp(ModeledApp, abc.ABC):
...
@@ -123,16 +123,21 @@ class TorchApp(ModeledApp, abc.ABC):
def
empirical_measure_qos_perf
(
def
empirical_measure_qos_perf
(
self
,
with_approxes
:
KnobsT
,
is_testset
:
bool
self
,
with_approxes
:
KnobsT
,
is_testset
:
bool
)
->
Tuple
[
float
,
float
]:
)
->
Tuple
[
float
,
float
]:
from
time
import
time_ns
dataloader
=
self
.
test_loader
if
is_testset
else
self
.
val_loader
dataloader
=
self
.
test_loader
if
is_testset
else
self
.
val_loader
approxed
=
self
.
_apply_knobs
(
with_approxes
)
approxed
=
self
.
_apply_knobs
(
with_approxes
)
qoses
=
[]
qoses
=
[]
time_begin
=
time_ns
()
/
(
10
**
9
)
for
inputs
,
targets
in
dataloader
:
for
inputs
,
targets
in
dataloader
:
inputs
=
move_to_device_recursively
(
inputs
,
self
.
device
)
inputs
=
move_to_device_recursively
(
inputs
,
self
.
device
)
targets
=
move_to_device_recursively
(
targets
,
self
.
device
)
targets
=
move_to_device_recursively
(
targets
,
self
.
device
)
outputs
=
approxed
(
inputs
)
outputs
=
approxed
(
inputs
)
qoses
.
append
(
self
.
tensor_to_qos
(
outputs
,
targets
))
qoses
.
append
(
self
.
tensor_to_qos
(
outputs
,
targets
))
time_end
=
time_ns
()
/
(
10
**
9
)
qos
=
self
.
combine_qos
(
np
.
array
(
qoses
))
qos
=
self
.
combine_qos
(
np
.
array
(
qoses
))
return
float
(
qos
),
0.0
# float64->float
return
float
(
qos
),
time_end
-
time_begin
# float64->float
def
__repr__
(
self
)
->
str
:
def
__repr__
(
self
)
->
str
:
class_name
=
self
.
__class__
.
__name__
class_name
=
self
.
__class__
.
__name__
...
@@ -161,7 +166,9 @@ class TorchApp(ModeledApp, abc.ABC):
...
@@ -161,7 +166,9 @@ class TorchApp(ModeledApp, abc.ABC):
if
last_baseline_knob
is
None
:
if
last_baseline_knob
is
None
:
last_baseline_knob
=
k
last_baseline_knob
=
k
else
:
else
:
raise
ValueError
(
f
"
Found more than 1 baseline knobs:
{
last_baseline_knob
}
and
{
k
}
"
)
raise
ValueError
(
f
"
Found more than 1 baseline knobs:
{
last_baseline_knob
}
and
{
k
}
"
)
if
last_baseline_knob
is
None
:
if
last_baseline_knob
is
None
:
knobs
.
add
(
BaselineKnob
())
knobs
.
add
(
BaselineKnob
())
return
knobs
return
knobs
...
...
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