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
ebfd4e06
Commit
ebfd4e06
authored
4 years ago
by
hashimsharif
Browse files
Options
Downloads
Patches
Plain Diff
Fixing global_knobs.txt path - make it relative to LLVM_SRC_ROOT
parent
88ed4913
No related branches found
Branches containing commit
No related tags found
Tags containing commit
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/src/approx_knobs_utils.cc
+78
-34
78 additions, 34 deletions
...s/hpvm-tensor-rt/tensor_runtime/src/approx_knobs_utils.cc
with
78 additions
and
34 deletions
llvm/projects/hpvm-tensor-rt/tensor_runtime/src/approx_knobs_utils.cc
+
78
−
34
View file @
ebfd4e06
...
...
@@ -4,6 +4,7 @@
#include
<fstream>
#include
<map>
#include
<vector>
#include
<string.h>
#include
"approx_knob_utils.h"
...
...
@@ -24,8 +25,22 @@ PerfParams::PerfParams(int row1, int col1, int skip_offset1){
PerfParamSet
::
PerfParamSet
(){
std
::
ifstream
file
(
"../autotuner/data/global_knobs.txt"
);
char
llvm_src_root
[
100
];
strcpy
(
llvm_src_root
,
getenv
(
"LLVM_SRC_ROOT"
));
if
(
llvm_src_root
==
NULL
){
printf
(
"ERROR: SET LLVM_SRC_ROOT
\n
"
);
abort
();
}
printf
(
"*LLVM_SRC_ROOT = %s"
,
llvm_src_root
);
char
*
knobs_file_path
=
strcat
(
llvm_src_root
,
"/projects/hpvm-tensor-rt/autotuner/data/global_knobs.txt"
);
printf
(
"- knobs_file_path = %s
\n
"
,
knobs_file_path
);
std
::
ifstream
file
(
knobs_file_path
);
std
::
string
line
;
std
::
string
partial
;
...
...
@@ -33,6 +48,8 @@ PerfParamSet::PerfParamSet(){
while
(
std
::
getline
(
file
,
line
))
{
// Read each line
printf
(
"***** line === "
,
line
);
std
::
istringstream
iss
(
line
);
std
::
string
token
;
while
(
std
::
getline
(
iss
,
token
,
'\t'
)){
// Read each token in the line
...
...
@@ -58,7 +75,8 @@ PerfParamSet::PerfParamSet(){
std
::
getline
(
token_stream
,
tok
,
','
);
int
offset
=
atoi
(
tok
.
c_str
());
printf
(
"**** knob = %d, row = %d, col = %d, offset = %d
\n\n
"
,
knob
,
row
,
col
,
offset
);
PerfParams
params
(
row
,
col
,
offset
);
perf_knob_map
[
knob
]
=
params
;
...
...
@@ -66,11 +84,16 @@ PerfParamSet::PerfParamSet(){
}
}
file
.
close
();
}
PerfParams
PerfParamSet
::
getPerfParams
(
int
swing
){
if
(
swing
>=
150
){
swing
=
swing
-
30
;
}
return
perf_knob_map
[
swing
];
...
...
@@ -94,58 +117,79 @@ SampParams::SampParams(int skip_rate1, int skip_offset1, float interpolation_id1
SampParamSet
::
SampParamSet
(){
std
::
ifstream
file
(
"../autotuner/data/global_knobs.txt"
);
char
llvm_src_root
[
100
];
strcpy
(
llvm_src_root
,
getenv
(
"LLVM_SRC_ROOT"
));
if
(
llvm_src_root
==
NULL
){
printf
(
"ERROR: SET LLVM_SRC_ROOT
\n
"
);
abort
();
}
printf
(
"* LLVM_SRC_ROOT = %s
\n
"
,
llvm_src_root
);
std
::
string
line
;
std
::
string
partial
;
std
::
vector
<
std
::
string
>
tokens
;
char
*
knobs_file_path
=
strcat
(
llvm_src_root
,
"/projects/hpvm-tensor-rt/autotuner/data/global_knobs.txt"
);
printf
(
"- knobs_file_path = %s
\n
"
,
knobs_file_path
);
std
::
ifstream
file
(
knobs_file_path
);
while
(
std
::
getline
(
file
,
line
))
{
// Read each line
std
::
string
line
;
std
::
string
partial
;
std
::
vector
<
std
::
string
>
tokens
;
while
(
std
::
getline
(
file
,
line
))
{
// Read each line
std
::
istringstream
iss
(
line
);
std
::
string
token
;
while
(
std
::
getline
(
iss
,
token
,
'\t'
)){
// Read each token in the line
tokens
.
push_back
(
token
);
std
::
istringstream
iss
(
line
);
std
::
string
token
;
while
(
std
::
getline
(
iss
,
token
,
'\t'
)){
// Read each token in the line
tokens
.
push_back
(
token
);
int
index
=
token
.
find
(
"samp"
);
int
test_index
=
token
.
find
(
"reduction"
);
int
index
=
token
.
find
(
"samp"
);
int
test_index
=
token
.
find
(
"reduction"
);
if
(
index
!=
std
::
string
::
npos
&&
test_index
==
std
::
string
::
npos
){
if
(
index
!=
std
::
string
::
npos
&&
test_index
==
std
::
string
::
npos
){
int
index2
=
token
.
find
(
","
);
std
::
string
knob_str
=
token
.
substr
(
index2
+
1
);
int
knob
=
atoi
(
knob_str
.
c_str
());
printf
(
"knob = %d
\n
"
,
knob
);
int
index2
=
token
.
find
(
","
);
std
::
string
knob_str
=
token
.
substr
(
index2
+
1
);
int
knob
=
atoi
(
knob_str
.
c_str
());
printf
(
"knob = %d
\n
"
,
knob
);
std
::
getline
(
iss
,
token
,
'\t'
);
std
::
istringstream
token_stream
(
token
);
std
::
getline
(
iss
,
token
,
'\t'
);
std
::
istringstream
token_stream
(
token
);
std
::
string
tok
;
std
::
string
tok
;
std
::
getline
(
token_stream
,
tok
,
','
);
int
skip_every
=
atoi
(
tok
.
c_str
());
std
::
getline
(
token_stream
,
tok
,
','
);
int
skip_every
=
atoi
(
tok
.
c_str
());
std
::
getline
(
token_stream
,
tok
,
','
);
int
offset
=
atoi
(
tok
.
c_str
());
std
::
getline
(
token_stream
,
tok
,
','
);
int
offset
=
atoi
(
tok
.
c_str
());
std
::
getline
(
token_stream
,
tok
,
','
);
float
interpolation_id
=
atof
(
tok
.
c_str
());
std
::
getline
(
token_stream
,
tok
,
','
);
float
interpolation_id
=
atof
(
tok
.
c_str
());
printf
(
"skip_every = %d, offset = %d
\n
"
,
skip_every
,
offset
);
SampParams
params
(
skip_every
,
offset
,
interpolation_id
);
samp_knob_map
[
knob
]
=
params
;
printf
(
"skip_every = %d, offset = %d
\n
"
,
skip_every
,
offset
);
SampParams
params
(
skip_every
,
offset
,
interpolation_id
);
samp_knob_map
[
knob
]
=
params
;
}
}
}
}
file
.
close
();
}
SampParams
SampParamSet
::
getSampParams
(
int
swing
){
if
(
swing
>=
260
){
swing
=
swing
-
30
;
}
return
samp_knob_map
[
swing
];
}
...
...
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