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
2c3681f8
Commit
2c3681f8
authored
6 years ago
by
Hashim Sharif
Browse files
Options
Downloads
Patches
Plain Diff
Adding dir_path cmd argument to InsertApproxInfo pass
parent
8374b345
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
llvm/lib/Transforms/InsertApproxInfo/InsertApproxInfo.cpp
+54
-4
54 additions, 4 deletions
llvm/lib/Transforms/InsertApproxInfo/InsertApproxInfo.cpp
llvm/projects/hpvm-tensor-rt/bin/setup_tyler_paths.sh
+2
-3
2 additions, 3 deletions
llvm/projects/hpvm-tensor-rt/bin/setup_tyler_paths.sh
with
56 additions
and
7 deletions
llvm/lib/Transforms/InsertApproxInfo/InsertApproxInfo.cpp
+
54
−
4
View file @
2c3681f8
...
...
@@ -21,6 +21,9 @@
#include
"llvm/Support/SourceMgr.h"
#include
"llvm/InPlaceDFG/InPlaceDFGAnalysis.h"
#include
"llvm/SupportVISC/DFG2LLVM.h"
#include
<unordered_map>
#include
<dirent.h>
#include
<stdio.h>
using
namespace
llvm
;
...
...
@@ -31,10 +34,26 @@ using namespace inplacedfg;
namespace
{
static
cl
::
opt
<
std
::
string
>
dir_name
(
"results-dir"
,
cl
::
desc
(
" Name of directory with Autotuner results "
));
struct
ApproxMetrics
{
// Relative L-norm metrics
double
relative_l0
;
double
relative_l1
;
double
relative_l2
;
// Mean L-norm metrics
double
mean_l0
;
double
mean_l1
;
double
mean_l2
;
};
struct
InsertApproxInfoWrapperPass
:
public
ModulePass
{
static
char
ID
;
// Pass identification, replacement for typeid
InsertApproxInfoWrapperPass
()
:
ModulePass
(
ID
)
{}
public
:
// Functions
bool
runOnModule
(
Module
&
M
);
...
...
@@ -51,6 +70,10 @@ private:
void
initRuntimeAPI
()
{}
void
codeGen
(
DFInternalNode
*
N
);
void
codeGen
(
DFLeafNode
*
N
);
void
loadTrainedApproxMetrics
(
std
::
string
dir_path
);
// private data
std
::
unordered_map
<
std
::
string
,
std
::
vector
<
ApproxMetrics
*>>
operation_metrics
;
public
:
// Constructor
...
...
@@ -59,7 +82,7 @@ public:
}
//void run(Module &M, BuildDFG &DFG);
void
run
();
void
run
(
std
::
string
dir_path
);
};
...
...
@@ -70,20 +93,43 @@ void InsertApproxInfoWrapperPass::getAnalysisUsage(AnalysisUsage &AU) const {
AU
.
addPreserved
<
BuildDFG
>
();
}
bool
InsertApproxInfoWrapperPass
::
runOnModule
(
Module
&
M
)
{
std
::
string
dir_path
=
dir_name
.
getValue
();
// Get the BuildDFG Analysis Results:
// - Dataflow graph
BuildDFG
&
DFG
=
getAnalysis
<
BuildDFG
>
();
InsertApproxInfo
IApprox
(
M
,
DFG
);
IApprox
.
run
();
IApprox
.
run
(
dir_path
);
return
false
;
}
void
InsertApproxInfo
::
loadTrainedApproxMetrics
(
std
::
string
dir_path
){
struct
dirent
*
entry
;
DIR
*
dir
=
opendir
(
dir_path
.
c_str
());
if
(
dir
==
NULL
){
printf
(
"Directory %s not found . Aborting ...
\n\n
"
,
dir_path
.
c_str
());
abort
();
}
while
((
entry
=
readdir
(
dir
))
!=
NULL
){
printf
(
"%s
\n
"
,
entry
->
d_name
);
}
}
/*** Methods of InPlaceDFGAnalysis ***/
void
InsertApproxInfo
::
run
()
{
void
InsertApproxInfo
::
run
(
std
::
string
dir_path
)
{
loadTrainedApproxMetrics
(
dir_path
);
errs
()
<<
"
\n
NOTE: ApproxInfo INSERTION TRANSFORM
\n
"
;
std
::
vector
<
DFInternalNode
*>
Roots
=
DFG
.
getRoots
();
...
...
@@ -116,5 +162,9 @@ static RegisterPass<InsertApproxInfoWrapperPass> X("insert-approxinfo",
false
/* does not modify the CFG */
,
false
/* not transformation, just analysis */
);
}
// End of namespace
This diff is collapsed.
Click to expand it.
llvm/projects/hpvm-tensor-rt/bin/setup_tyler_paths.sh
+
2
−
3
View file @
2c3681f8
...
...
@@ -4,12 +4,11 @@
module load cuda-toolkit/9.1
export
CUDA_INCLUDE_PATH
=
/software/cuda-9.1/include
export
CUDNN_PATH
=
/software/cuda-9.1/lib64/
module load cuda-toolkit/9.1
export
LIBRARY_PATH
=
/software/cuda-9.1/lib64/:
$LIBRARY_PATH
export
LD_LIBRARY_PATH
=
/software/cuda-9.1/lib64/
$LD_LIBRARY_PATH
export
LD_LIBRARY_PATH
=
/software/cuda-9.1/lib64/
:
$LD_LIBRARY_PATH
# HPVM Path setup
export
CPATH
=
$CPATH
:/home/hsharif3/anaconda2/include/
export
PATH
=
/home/hsharif3/Gitlab/
llvm/ll
vm/build/bin/:
$PATH
export
PATH
=
/home/hsharif3/Gitlab/
hp
vm/build/bin/:
$PATH
export
LLVM_BUILD_ROOT
=
/home/hsharif3/Gitlab/hpvm/build/
export
LLVM_SRC_ROOT
=
/home/hsharif3/Gitlab/hpvm/llvm/
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