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
f6b57d73
Commit
f6b57d73
authored
4 years ago
by
Hashim Sharif
Browse files
Options
Downloads
Patches
Plain Diff
Partially genration of getopt handling - incomplete!
parent
e62dc524
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
hpvm/projects/keras/keras_frontend/approxhpvm_translator.py
+0
-3
0 additions, 3 deletions
hpvm/projects/keras/keras_frontend/approxhpvm_translator.py
hpvm/projects/keras/keras_frontend/hpvm_dfg_translator.py
+51
-5
51 additions, 5 deletions
hpvm/projects/keras/keras_frontend/hpvm_dfg_translator.py
with
51 additions
and
8 deletions
hpvm/projects/keras/keras_frontend/approxhpvm_translator.py
+
0
−
3
View file @
f6b57d73
...
...
@@ -1088,10 +1088,7 @@ def createRecursiveDir(target_dir):
print
(
"
Delete Directory or Give Different Path. Aborting....
"
)
sys
.
exit
(
1
)
print
(
target_dir
)
toks
=
target_dir
.
split
(
"
/
"
)
print
(
toks
)
for
i
in
range
(
len
(
toks
)):
path_str
=
"
/
"
.
join
(
toks
[
0
:
i
+
1
])
if
path_str
!=
""
:
...
...
This diff is collapsed.
Click to expand it.
hpvm/projects/keras/keras_frontend/hpvm_dfg_translator.py
+
51
−
5
View file @
f6b57d73
...
...
@@ -695,6 +695,9 @@ class HPVMTranslator:
def
genMainFunction
(
self
,
test_data
,
batch_size
):
main_func_str
=
"
int main(int argc, char* argv[]){
\n\n
"
main_func_str
+=
self
.
GetOptLoop
()
main_func_str
+=
self
.
weight_str
main_func_str
+=
self
.
input_str
main_func_str
+=
"
\n
"
+
HPVM_init
+
"
();
\n
"
...
...
@@ -733,6 +736,9 @@ class HPVMTranslator:
def
genTunerMainFunction
(
self
,
src_dir
,
test_data
,
batch_size
):
tuner_main_func_str
=
"
int main(int argc, char* argv[]){
\n\n
"
tuner_main_func_str
+=
self
.
GetOptLoop
()
tuner_main_func_str
+=
self
.
weight_str
tuner_main_func_str
+=
self
.
input_str
tuner_main_func_str
+=
"
RootIn* args = static_cast<RootIn*>(malloc(sizeof(RootIn)));
\n\n
"
...
...
@@ -833,18 +839,58 @@ void write_accuracy(float accuracy) {
fout << std::fixed << accuracy;
}
"""
return
FIFO_str
def
getUsageStr
(
self
):
usage_str
=
"""
"""
void printUsage(){
std::cerr <<
\"
Usage: -d {test|tune} -c {config_file_path}
\"
;
abort();
}
return
FIFO_str
"""
return
usage_str
def
GetOptLoop
(
self
):
getopt_str
=
"""
std::string runtype;
std::string config_path;
int flag;
while ( (flag = getopt (argc, argv,
"
d:c:
"
)) != -1){
switch (flag)
{
case
'
d
'
:
runtype = std::string(optarg);
if (runtype !=
"
test
"
&& runtype !=
"
tune
"
)
printUsage();
break;
case
'
c
'
:
config_path = std::string(optarg);
break;
default:
printUsage();
}
}
"""
return
getopt_str
def
generateTestProgram
(
self
,
dir_prefix
):
program_str
=
self
.
file_header_str
+
self
.
node_str
+
self
.
root_str
program_str
+=
self
.
root_struct_str
+
self
.
main_func_str
program_str
+=
self
.
root_struct_str
+
self
.
getUsageStr
()
+
self
.
main_func_str
DEBUG
(
program_str
)
...
...
@@ -856,8 +902,8 @@ void write_accuracy(float accuracy) {
def
generateTunerProgram
(
self
,
dir_prefix
,
FIFO_str
):
program_str
=
self
.
file_header_str
+
FIFO_str
+
self
.
node_str
+
self
.
root_str
program_str
+=
self
.
root_struct_str
+
self
.
tuner_main_func_str
program_str
=
self
.
file_header_str
+
FIFO_str
+
self
.
node_str
+
self
.
root_str
program_str
+=
self
.
root_struct_str
+
self
.
getUsageStr
()
+
self
.
tuner_main_func_str
DEBUG
(
program_str
)
...
...
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