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
caee043f
Commit
caee043f
authored
5 years ago
by
Hashim Sharif
Browse files
Options
Downloads
Patches
Plain Diff
Adding SampKnobs in sim-mode
parent
a52d0a81
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/include/approx_simulation.h
+77
-1
77 additions, 1 deletion
...hpvm-tensor-rt/tensor_runtime/include/approx_simulation.h
with
77 additions
and
1 deletion
llvm/projects/hpvm-tensor-rt/tensor_runtime/include/approx_simulation.h
+
77
−
1
View file @
caee043f
...
@@ -303,6 +303,10 @@ void* tensorConvSampSim(void* input_ptr, void* filter_ptr,
...
@@ -303,6 +303,10 @@ void* tensorConvSampSim(void* input_ptr, void* filter_ptr,
hostToDeviceCopy
(
input
);
hostToDeviceCopy
(
input
);
hostToDeviceCopy
(
filter
);
hostToDeviceCopy
(
filter
);
convertToFP32
(
input
);
convertToFP32
(
filter
);
// Zeroing (+Scaling) Filter elements to 'Simulate' input sampling
// Zeroing (+Scaling) Filter elements to 'Simulate' input sampling
sampleFilter
(
filter
,
skip_rate
,
skip_offset
);
sampleFilter
(
filter
,
skip_rate
,
skip_offset
);
...
@@ -341,7 +345,7 @@ void* tensorConvSampSim(void* input_ptr, void* filter_ptr,
...
@@ -341,7 +345,7 @@ void* tensorConvSampSim(void* input_ptr, void* filter_ptr,
DEBUG
(
"**Output Tensor Dims, n = %d, c = %d, h = %d, w = %d
\n
"
,
n
,
c
,
h
,
w
);
DEBUG
(
"**Output Tensor Dims, n = %d, c = %d, h = %d, w = %d
\n
"
,
n
,
c
,
h
,
w
);
Tensor
*
output
;
Tensor
*
output
;
output
=
(
Tensor
*
)
create4DTensor
((
cudnnDataType_t
)
input
->
d
at
a
_type
,
output
=
(
Tensor
*
)
create4DTensor
((
cudnnDataType_t
)
flo
at_type
,
CUDNN_TENSOR_NCHW
,
n
,
c
,
h
,
w
);
CUDNN_TENSOR_NCHW
,
n
,
c
,
h
,
w
);
...
@@ -646,6 +650,15 @@ bool isPerforation(int swing){
...
@@ -646,6 +650,15 @@ bool isPerforation(int swing){
}
}
bool
isSampling
(
int
swing
){
if
(
swing
>=
31
&&
swing
<=
39
)
return
true
;
else
return
false
;
}
int
getSwing
(
int
swing
){
int
getSwing
(
int
swing
){
#ifdef PROMISE_TUNER_ENABLED
#ifdef PROMISE_TUNER_ENABLED
...
@@ -670,6 +683,9 @@ int getSwing(int swing){
...
@@ -670,6 +683,9 @@ int getSwing(int swing){
class
PerfParams
{
class
PerfParams
{
public:
public:
...
@@ -728,6 +744,52 @@ PerfParams getPerfParams(int swing){
...
@@ -728,6 +744,52 @@ PerfParams getPerfParams(int swing){
class
SampParams
{
public:
int
skip_rate
;
int
skip_offset
;
SampParams
(){
skip_rate
=
1
;
skip_offset
=
0
;
}
SampParams
(
int
skip_rate1
,
int
skip_offset1
){
skip_rate
=
skip_rate1
;
skip_offset
=
skip_offset1
;
}
};
SampParams
getSampParams
(
int
swing
){
std
::
map
<
int
,
SampParams
>
samp_knob_map
;
SampParams
params31
(
2
,
0
);
samp_knob_map
[
31
]
=
params31
;
SampParams
params32
(
2
,
1
);
samp_knob_map
[
32
]
=
params32
;
SampParams
params33
(
4
,
0
);
samp_knob_map
[
33
]
=
params33
;
SampParams
params34
(
4
,
1
);
samp_knob_map
[
34
]
=
params34
;
return
samp_knob_map
[
swing
];
}
/***** API for Autotuner Use - Not the ApproxHPVM Wrapper API */
/***** API for Autotuner Use - Not the ApproxHPVM Wrapper API */
void
*
ConvLayer_PROMISE
(
void
*
input
,
float
i_min
,
float
i_max
,
void
*
ConvLayer_PROMISE
(
void
*
input
,
float
i_min
,
float
i_max
,
...
@@ -774,6 +836,20 @@ void* ConvLayer_PROMISE(void* input, float i_min, float i_max,
...
@@ -774,6 +836,20 @@ void* ConvLayer_PROMISE(void* input, float i_min, float i_max,
}
}
if
(
isSampling
(
swing
)){
SampParams
params
=
getSampParams
(
swing
);
DEBUG
(
"params.skip_rate = %d, params.skip_offset = %d
\n
"
,
params
.
skip_rate
,
params
.
skip_offset
);
conv_out
=
tensorConvSampSim
(
input
,
filter
,
conv_pad_h
,
conv_pad_w
,
conv_stride_h
,
conv_stride_w
,
1
,
1
,
params
.
skip_rate
,
params
.
skip_offset
);
}
if
(
isHalfPrecision
(
swing
)){
if
(
isHalfPrecision
(
swing
)){
conv_out
=
tensorHalfConvolution
(
input
,
filter
,
conv_out
=
tensorHalfConvolution
(
input
,
filter
,
...
...
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