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
ceadfa42
Commit
ceadfa42
authored
4 years ago
by
Yifan Zhao
Browse files
Options
Downloads
Patches
Plain Diff
Frontend binary should respect -c flag
parent
424a32a2
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
hpvm/projects/torch2hpvm/torch2hpvm/template_hpvm.cpp.in
+30
-11
30 additions, 11 deletions
hpvm/projects/torch2hpvm/torch2hpvm/template_hpvm.cpp.in
with
30 additions
and
11 deletions
hpvm/projects/torch2hpvm/torch2hpvm/template_hpvm.cpp.in
+
30
−
11
View file @
ceadfa42
...
@@ -58,23 +58,38 @@ typedef struct __attribute__((__packed__)) {
...
@@ -58,23 +58,38 @@ typedef struct __attribute__((__packed__)) {
struct ret_t r;
struct ret_t r;
} RootIn;
} RootIn;
void printUsage(const std::string &bin_name) {
std::cerr << "Usage: " << bin_name << "[-d {test|tune}] [-c CONF_FILE]\n";
}
const int batch_size = {{batch_size}}, input_size = {{input_size}}, batch_count = input_size / batch_size;
const int batch_size = {{batch_size}}, input_size = {{input_size}}, batch_count = input_size / batch_size;
int main(int argc, char *argv[]){
int main(int argc, char *argv[]) {
if (argc != 2) {
std::string config_path = "", runtype = "test";
std::cout << "Usage: " << argv[0] << " {tune|test}\n";
int flag;
return 1;
while ((flag = getopt(argc, argv, "hc:")) != -1) {
}
switch (flag) {
std::string arg1 = argv[1];
case 'd':
if (arg1 != "tune" && arg1 != "test") {
runtype = std::string(optarg);
std::cout << "Usage: " << argv[0] << " {tune|test}\n";
if (runtype != "test" && runtype != "tune")
return 1;
printUsage(argv[0]);
return 1;
break;
case 'c':
config_path = std::string(optarg);
break;
case 'h':
printUsage(argv[0]);
return 0;
default:
printUsage(argv[0]);
return 1;
}
}
}
std::string dir_prefix = "{{prefix}}/";
std::string dir_prefix = "{{prefix}}/";
std::string input_path = dir_prefix +
arg1 + "
_input.bin";
std::string input_path = dir_prefix +
"test
_input.bin";
std::string labels_path = dir_prefix +
arg1 + "
_labels.bin";
std::string labels_path = dir_prefix +
"test
_labels.bin";
{% for w in weights %}
{% for w in weights %}
std::string {{w.name}}_path = dir_prefix + "{{w.filename}}";
std::string {{w.name}}_path = dir_prefix + "{{w.filename}}";
void* {{w.name}} = readTrainedWeights({{w.name}}_path.c_str(), 0, {{w.shape|join(', ')}});
void* {{w.name}} = readTrainedWeights({{w.name}}_path.c_str(), 0, {{w.shape|join(', ')}});
...
@@ -88,6 +103,10 @@ int main(int argc, char *argv[]){
...
@@ -88,6 +103,10 @@ int main(int argc, char *argv[]){
{% endfor %}
{% endfor %}
__hpvm__init();
__hpvm__init();
if (config_path != "") {
llvm_hpvm_initializeRuntimeController(config_path.c_str());
}
startMemTracking();
startMemTracking();
#pragma clang loop unroll(disable)
#pragma clang loop unroll(disable)
for (int i = 0; i < batch_count; i++){
for (int i = 0; i < batch_count; i++){
...
...
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