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
def8b929
Commit
def8b929
authored
3 years ago
by
Hashim Sharif
Browse files
Options
Downloads
Patches
Plain Diff
Cleaning up probabilistic configuration selection policy
parent
1b09b76c
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
hpvm/projects/hpvm-tensor-rt/tensor_runtime/src/hpvm-rt-controller.cpp
+12
-38
12 additions, 38 deletions
.../hpvm-tensor-rt/tensor_runtime/src/hpvm-rt-controller.cpp
with
12 additions
and
38 deletions
hpvm/projects/hpvm-tensor-rt/tensor_runtime/src/hpvm-rt-controller.cpp
+
12
−
38
View file @
def8b929
...
...
@@ -1064,6 +1064,11 @@ void RuntimeController::findTargetConfiguration(float goal,
configurationIdx
);
}
/*** This routine takes as input goal (target speedup) and computes the probabilty of selecting the higher configuration
(one with higher than target speedup) and probability of lower configuration (config with lower than target speedup).
Motivation: The Pareto curve often does not have a configuration providing the exact req speedup
***/
void
RuntimeController
::
adjustTargetConfiguration
(
float
goal
)
{
DEBUG
(
"adjustTargetConfiguration: goalVal: %f.
\n\n
"
,
goal
);
...
...
@@ -1077,53 +1082,22 @@ void RuntimeController::adjustTargetConfiguration(float goal) {
// Get the two configurations' speedup, and compute the appropriate ranges
float
curr_conf_speedup
=
(
*
Configurations
)[
configurationIdx
]
->
speedup
;
float
prev_conf_speedup
=
(
*
Configurations
)[
prev_conf_idx
]
->
speedup
;
float
sp_diff
=
curr_conf_speedup
-
prev_conf_speedup
;
// Computation of how far the target speedup is for lower and higher speedup config
float
sp_diff
=
curr_conf_speedup
-
prev_conf_speedup
;
float
high_range
=
curr_conf_speedup
-
goal
;
float
low_range
=
goal
-
prev_conf_speedup
;
// These represent how likely we are to pick the upper or lower configuration
float
high_pb
=
0.0
,
low_pb
=
0.0
;
if
(
configurationIdx
==
prev_conf_idx
)
{
high_pb
=
low_pb
=
1.0
;
}
else
{
}
else
{
// Compute the probabitly of selection for higher config and lower config
high_pb
=
low_range
/
sp_diff
;
low_pb
=
high_range
/
sp_diff
;
//***--- Probability adjustment strategy 1 ---***//
// No big adjustments at edges of probability range
// float adjust_val = 0.0;
// if (low_pb < high_pb) {
// adjust_val = low_pb * 0.2;
// } else {
// adjust_val = high_pb * 0.2;
// }
// low_pb -= adjust_val;
// high_pb += adjust_val;
//***--- ---***//
//***--- Probability adjustment strategy 2 ---***//
// No big adjustment at high edge of probability range
// float adjust_val = high_pb * 0.2 > 0.1 ? 0.1 : high_pb * 0.2;
// low_pb -= adjust_val;
// high_pb += adjust_val;
//***--- ---***//
//***--- Probability adjustment strategy 3 ---***//
// Similar to 2, but higher always increases, more significantly
// float adjust_val = low_pb * 0.5 > 0.1 ? 0.1 : low_pb * 0.5;
// low_pb -= adjust_val;
// high_pb += adjust_val;
//***--- ---***//
//***--- Probability adjustment strategy 4 ---***//
// Similar to 2, but higher always increases, more significantly
// Low end, high end a bit less aggressive than total range
float
adjust_val
=
low_pb
*
0.6
>
0.2
?
0.2
:
low_pb
*
0.6
;
adjust_val
=
adjust_val
>
high_pb
?
high_pb
:
adjust_val
;
low_pb
-=
adjust_val
;
high_pb
+=
adjust_val
;
//***--- ---***//
}
DEBUG
(
"**---- adjustTargetConfiguration: upper conf = %s with probability: "
...
...
@@ -1212,7 +1186,7 @@ uint32_t *hpvm_rt_readLabelsBatch_cached(const char *labels_file, int start,
static
float
average_accuracy
=
0.0
;
static
int
num_executations
=
0
;
//*** Copied from dnn_sources/include/utils.h ***//
float
hpvm_rt_computeAccuracy3
(
uint32_t
*
labels
,
void
*
result_ptr
)
{
struct
Tensor
*
result
=
(
struct
Tensor
*
)
result_ptr
;
...
...
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