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
a7dfa2ac
Commit
a7dfa2ac
authored
5 years ago
by
kotsifa2
Browse files
Options
Downloads
Patches
Plain Diff
Added 3D pareto curve construction (accuracy loss-speedup-energy)
parent
0a31ca03
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/hpvm-tensor-rt/tensor_runtime/include/hpvm-rt-controller.h
+90
-4
90 additions, 4 deletions
...pvm-tensor-rt/tensor_runtime/include/hpvm-rt-controller.h
with
90 additions
and
4 deletions
llvm/projects/hpvm-tensor-rt/tensor_runtime/include/hpvm-rt-controller.h
+
90
−
4
View file @
a7dfa2ac
...
...
@@ -33,6 +33,9 @@ class RuntimeController {
// The ones in non dominated set (of pareto optimal points)
// for accuracy loss-energy
std
::
vector
<
struct
Configuration
>
EnergyConfigurations
;
// The ones in non dominated set (of pareto optimal points)
// for accuracy loss-speedup-energy
std
::
vector
<
struct
Configuration
>
ThreeDCurveConfigurations
;
std
::
vector
<
struct
Configuration
>
*
Configurations
;
unsigned
configurationIdx
=
0
;
...
...
@@ -42,6 +45,7 @@ class RuntimeController {
void
readConfigurationFile
(
const
char
*
);
void
computeParetoConfigurationPoints
();
void
compute3DParetoConfigurationPoints
();
public:
// For testing purposes only - do not use widely
...
...
@@ -53,6 +57,10 @@ class RuntimeController {
return
EnergyConfigurations
;
}
// For testing purposes only - do not use widely
std
::
vector
<
struct
Configuration
>
&
getThreeDCurveConfigurations
()
{
return
ThreeDCurveConfigurations
;
}
// For testing purposes only - do not use widely
unsigned
getConfigurationIdx
()
{
return
configurationIdx
;
}
...
...
@@ -77,8 +85,13 @@ class RuntimeController {
readConfigurationFile
(
Cstr
);
Configurations
=
NULL
;
computeParetoConfigurationPoints
();
compute3DParetoConfigurationPoints
();
INFO
(
"Speedup Configurations
\n
"
);
printConfigurations
(
SpeedupConfigurations
);
INFO
(
"Energy Configurations
\n
"
);
printConfigurations
(
EnergyConfigurations
);
INFO
(
"3D Configurations
\n
"
);
printConfigurations
(
ThreeDCurveConfigurations
);
configurationIdx
=
0
;
//TODO: initialize using pareto curve - findTargetConfiguration ?
Configurations
=
&
SpeedupConfigurations
;
}
...
...
@@ -412,10 +425,6 @@ void RuntimeController::computeParetoConfigurationPoints() {
en_notDominated
=
false
;
}
// for (unsigned i = 0; (i < SpeedupConfigurations.size()) && sp_notDominated; i++) {
// if (SpeedupConfigurations[i].speedup >= sp)
// sp_notDominated = false;
// }
DEBUG
(
"sp_notDominated = %d
\n
"
,
sp_notDominated
);
DEBUG
(
"en_notDominated = %d
\n
"
,
en_notDominated
);
...
...
@@ -454,6 +463,83 @@ void RuntimeController::computeParetoConfigurationPoints() {
}
void
RuntimeController
::
compute3DParetoConfigurationPoints
()
{
// Sort the configurations according to accuracy loss
INFO
(
"Sorting autotuner configurations...
\n
"
);
std
::
sort
(
InitialConfigurations
.
begin
(),
InitialConfigurations
.
end
(),
ConfigurationLessThan
());
INFO
(
"Done sorting.
\n
"
);
for
(
unsigned
start_idx
=
0
;
start_idx
<
InitialConfigurations
.
size
();
)
{
// Points to first Configuration with different (higher) accuracy loss
// compared to the one pointed by start_idx
unsigned
end_idx
=
start_idx
+
1
;
while
((
end_idx
<
InitialConfigurations
.
size
())
&&
(
InitialConfigurations
[
end_idx
].
accuracyLoss
-
InitialConfigurations
[
start_idx
].
accuracyLoss
<
AL_THRESHOLD
))
{
end_idx
++
;
}
DEBUG
(
"start_idx = %d, end_idx = %d
\n
"
,
start_idx
,
end_idx
);
// Now, all elements in [start_idx, end_idx) have equal accuracy loss,
// that is lower from later ones and worse than those already in curve
// (so they cannot displace them).
// Find candidates from [start_idx, end_idx) to be inserted
// Keep their indices. If a point is dominated (strictly worse),
// its index will not be inserted
std
::
vector
<
unsigned
>
Indices
;
for
(
unsigned
i
=
start_idx
;
i
<
end_idx
;
i
++
)
{
bool
dominated
=
false
;
for
(
unsigned
j
=
i
+
1
;
(
j
<
end_idx
)
&&
!
dominated
;
j
++
)
{
if
((
InitialConfigurations
[
i
].
speedup
<
InitialConfigurations
[
j
].
speedup
)
&&
(
InitialConfigurations
[
i
].
energy
>
InitialConfigurations
[
j
].
energy
))
{
dominated
=
true
;
}
}
if
(
!
dominated
)
{
DEBUG
(
"accuracy loss = %f, speedup = %f, energy = %f, at idx = %d
\n
"
,
InitialConfigurations
[
i
].
accuracyLoss
,
InitialConfigurations
[
i
].
speedup
,
InitialConfigurations
[
i
].
energy
,
i
);
Indices
.
push_back
(
i
);
}
}
for
(
std
::
vector
<
unsigned
>::
iterator
idx_it
=
Indices
.
begin
(),
idx_e
=
Indices
.
end
();
idx_it
!=
idx_e
;
++
idx_it
)
{
Configuration
&
CandidateConfiguration
=
InitialConfigurations
[
*
idx_it
];
if
(
!
ThreeDCurveConfigurations
.
empty
())
{
bool
notDominated
=
true
;
for
(
unsigned
i
=
0
;
(
i
<
ThreeDCurveConfigurations
.
size
())
&&
notDominated
;
i
++
)
{
if
((
CandidateConfiguration
.
speedup
<=
ThreeDCurveConfigurations
[
i
].
speedup
)
&&
(
CandidateConfiguration
.
energy
>=
ThreeDCurveConfigurations
[
i
].
energy
))
{
// This configuration is not better, in at least one characteristic,
// compared to the existing ones in the curve.
notDominated
=
false
;
}
}
if
(
notDominated
)
{
ThreeDCurveConfigurations
.
push_back
(
CandidateConfiguration
);
}
}
else
{
// If the curve is empty, we know that this is a point that must be
// inserted. It has the best accuracy loss, and belongs here because
// it is not dominated by any point in this accuracy range.
ThreeDCurveConfigurations
.
push_back
(
CandidateConfiguration
);
}
}
// Continue from next accuracy loss level
start_idx
=
end_idx
;
}
}
void
RuntimeController
::
printConfigurations
(
std
::
vector
<
struct
Configuration
>
&
Confs
)
{
...
...
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