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
7f0ba9f9
Commit
7f0ba9f9
authored
4 years ago
by
Hashim Sharif
Browse files
Options
Downloads
Patches
Plain Diff
Updating unit tessts
parent
4be5f914
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/dnn_sources/src/unit_tests.cc
+39
-19
39 additions, 19 deletions
llvm/projects/hpvm-tensor-rt/dnn_sources/src/unit_tests.cc
with
39 additions
and
19 deletions
llvm/projects/hpvm-tensor-rt/dnn_sources/src/unit_tests.cc
+
39
−
19
View file @
7f0ba9f9
...
@@ -62,24 +62,23 @@ void testTensorHgemm(){
...
@@ -62,24 +62,23 @@ void testTensorHgemm(){
void
testTensorSgemm
2
(){
void
testTensorSgemm
(){
printf
(
"***** TensorSgemm *****
\n\n
"
);
printf
(
"***** TensorSgemm *****
\n\n
"
);
void
*
lhs_ptr
=
create4DTensor
(
CUDNN_DATA_FLOAT
,
CUDNN_TENSOR_NCHW
,
void
*
lhs_ptr
=
create4DTensor
(
CUDNN_DATA_FLOAT
,
CUDNN_TENSOR_NCHW
,
5
,
4
,
1
,
1
);
10000
,
800
,
1
,
1
);
struct
Tensor
*
lhs
=
(
struct
Tensor
*
)
lhs_ptr
;
struct
Tensor
*
lhs
=
(
struct
Tensor
*
)
lhs_ptr
;
fillTensorWithOnes
(
lhs
);
float
*
data_arr
=
(
float
*
)
lhs
->
host_data
;
float
*
data_arr
=
(
float
*
)
lhs
->
host_data
;
for
(
int
i
=
0
;
i
<
lhs
->
num_elems
;
i
++
){
for
(
int
i
=
0
;
i
<
lhs
->
num_elems
;
i
++
){
data_arr
[
i
]
=
(
i
/
4
)
+
1
;
data_arr
[
i
]
=
(
i
/
4
)
+
1
;
}
}
void
*
rhs
=
create4DTensor
(
CUDNN_TENSOR_NCHW
,
CUDNN_DATA_FLOAT
,
void
*
rhs
=
create4DTensor
(
CUDNN_TENSOR_NCHW
,
CUDNN_DATA_FLOAT
,
1
,
1
,
4
,
3
);
1
,
1
,
800
,
800
);
fillTensorWithOnes
(
rhs
);
fillTensorWithOnes
(
rhs
);
void
*
output
=
tensorGemmGPU
(
lhs
,
rhs
);
void
*
output
=
tensorGemmGPU
(
lhs
,
rhs
);
//
printTensorValues(output);
printTensorValues
(
output
);
}
}
...
@@ -291,24 +290,42 @@ void testTensorError(){
...
@@ -291,24 +290,42 @@ void testTensorError(){
void
testTensorConv
(){
void
testTensorConv
(){
// NOTE: The input channel count value (param2 to Tensor and Filter) must be the same
void
*
input
=
create4DTensor
(
CUDNN_DATA_FLOAT
,
CUDNN_TENSOR_NCHW
,
1
,
2
,
4
,
4
);
void
*
x3
=
create4DTensor
(
CUDNN_DATA_FLOAT
,
CUDNN_TENSOR_NCHW
,
1
,
2
,
4
,
4
);
void
*
filter
=
create4DTensor
(
CUDNN_DATA_FLOAT
,
CUDNN_TENSOR_NCHW
,
2
,
2
,
3
,
3
);
// NOTE: Filter descriptors do NOT have batch size
// NOTE: First two dims are output channels (configurable), input channels (MUST match input channels)
fillTensorWithOnes
(
input
);
void
*
filter
=
create4DTensor
(
CUDNN_DATA_FLOAT
,
CUDNN_TENSOR_NCHW
,
2
,
2
,
2
,
2
);
fillTensorWithOnes
(
x3
);
fillTensorWithOnes
(
filter
);
fillTensorWithOnes
(
filter
);
int
conv_mode
=
1
;
// NOTE: uses CROSS_CORRELATION
int
conv_mode
=
1
;
// NOTE: uses CROSS_CORRELATION
int
compute_precision
=
0
;
// floating point precision for conv
int
compute_precision
=
0
;
// floating point precision for conv
void
*
conv
1
=
tensorConvolution
(
x3
,
filter
,
0
,
0
,
void
*
conv
_out
=
tensorConvolution
(
input
,
filter
,
0
,
0
,
1
,
1
,
conv_mode
,
compute_precision
);
1
,
1
,
conv_mode
,
compute_precision
);
printTensorValues
(
conv
1
);
printTensorValues
(
conv
_out
);
}
}
void
testTensorHalfConv
(){
void
*
input
=
create4DTensor
(
CUDNN_DATA_FLOAT
,
CUDNN_TENSOR_NCHW
,
1
,
2
,
4
,
4
);
void
*
filter
=
create4DTensor
(
CUDNN_DATA_FLOAT
,
CUDNN_TENSOR_NCHW
,
2
,
2
,
3
,
3
);
fillTensorWithOnes
(
input
);
fillTensorWithOnes
(
filter
);
int
conv_mode
=
1
;
// NOTE: uses CROSS_CORRELATION
int
compute_precision
=
0
;
// floating point precision for conv
void
*
conv_out
=
tensorHalfConvolution
(
input
,
filter
,
0
,
0
,
1
,
1
,
conv_mode
,
compute_precision
);
printTensorValues
(
conv_out
);
}
void
testTensorGroupedConv
(){
void
testTensorGroupedConv
(){
// NOTE: The input channel count value (param2 to Tensor and Filter) must be the same
// NOTE: The input channel count value (param2 to Tensor and Filter) must be the same
...
@@ -1176,11 +1193,14 @@ int main(){
...
@@ -1176,11 +1193,14 @@ int main(){
llvm_hpvm_initTensorRt
(
0
);
llvm_hpvm_initTensorRt
(
0
);
startProfiling
();
startProfiling
();
// Function call per unit test
testTensorHgemm
();
testTensorSgemm
();
testTensorHgemm
();
testTensorConv
();
testTensorHalfConv
();
//testTensorSgemm2();
//testTensorConv();
//testTensorError();
//testTensorError();
//testQuantization();
//testQuantization();
...
...
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