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
ecacc226
Commit
ecacc226
authored
6 years ago
by
Hashim Sharif
Browse files
Options
Downloads
Patches
Plain Diff
Adding 1st Lenet Conv1 Layer in Lenet Benchmark
parent
b6f6d14c
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
llvm/test/VISC/DNN_Benchmarks/benchmarks/lenet/src/lenet.cpp
+42
-14
42 additions, 14 deletions
llvm/test/VISC/DNN_Benchmarks/benchmarks/lenet/src/lenet.cpp
llvm/test/VISC/DNN_Benchmarks/common/include/visc.h
+1
-0
1 addition, 0 deletions
llvm/test/VISC/DNN_Benchmarks/common/include/visc.h
with
43 additions
and
14 deletions
llvm/test/VISC/DNN_Benchmarks/benchmarks/lenet/src/lenet.cpp
+
42
−
14
View file @
ecacc226
...
@@ -9,7 +9,7 @@
...
@@ -9,7 +9,7 @@
using
namespace
std
;
using
namespace
std
;
void
tensorConvNode
(
void
*
t1
,
size_t
bytes1
,
void
*
t2
,
size_t
bytes2
)
{
void
tensorConvNode
1
(
void
*
t1
,
size_t
bytes1
,
void
*
t2
,
size_t
bytes2
)
{
__visc__hint
(
visc
::
CUDNN_TARGET
);
__visc__hint
(
visc
::
CUDNN_TARGET
);
__visc__attributes
(
2
,
t1
,
t2
,
0
);
__visc__attributes
(
2
,
t1
,
t2
,
0
);
...
@@ -19,7 +19,7 @@ void tensorConvNode(void *t1, size_t bytes1, void *t2, size_t bytes2) {
...
@@ -19,7 +19,7 @@ void tensorConvNode(void *t1, size_t bytes1, void *t2, size_t bytes2) {
}
}
void
tensorAddNode
(
void
*
t1
,
size_t
bytest1
,
void
*
t2
,
size_t
bytest2
)
{
void
tensorAddNode
1
(
void
*
t1
,
size_t
bytest1
,
void
*
t2
,
size_t
bytest2
)
{
__visc__hint
(
visc
::
CUDNN_TARGET
);
__visc__hint
(
visc
::
CUDNN_TARGET
);
__visc__attributes
(
2
,
t1
,
t2
,
0
);
__visc__attributes
(
2
,
t1
,
t2
,
0
);
...
@@ -27,6 +27,23 @@ void tensorAddNode(void *t1, size_t bytest1, void *t2, size_t bytest2) {
...
@@ -27,6 +27,23 @@ void tensorAddNode(void *t1, size_t bytest1, void *t2, size_t bytest2) {
__visc__return
(
2
,
r
,
(
size_t
)
0
);
__visc__return
(
2
,
r
,
(
size_t
)
0
);
}
}
void
tensorPoolNode1
(
void
*
t1
,
size_t
bytest1
)
{
__visc__hint
(
visc
::
CUDNN_TARGET
);
__visc__attributes
(
1
,
t1
,
0
);
void
*
r
=
__visc__tensor_pool_max
(
t1
,
2
,
2
,
0
,
0
,
2
,
2
);
__visc__return
(
2
,
r
,
(
size_t
)
0
);
}
void
tensorTanhNode1
(
void
*
t1
,
size_t
bytest1
)
{
__visc__hint
(
visc
::
CUDNN_TARGET
);
__visc__attributes
(
1
,
t1
,
0
);
void
*
r
=
__visc__tensor_tanh
(
t1
);
__visc__return
(
2
,
r
,
(
size_t
)
0
);
}
void
root
(
void
*
x
,
size_t
x_bytes
,
void
root
(
void
*
x
,
size_t
x_bytes
,
void
*
conv1_w
,
size_t
conv1_w_bytes
,
void
*
conv1_w
,
size_t
conv1_w_bytes
,
void
*
conv1_b
,
size_t
conv1_b_bytes
,
void
*
conv1_b
,
size_t
conv1_b_bytes
,
...
@@ -36,8 +53,10 @@ void root(void *x, size_t x_bytes,
...
@@ -36,8 +53,10 @@ void root(void *x, size_t x_bytes,
__visc__hint
(
visc
::
CPU_TARGET
);
__visc__hint
(
visc
::
CPU_TARGET
);
__visc__attributes
(
5
,
x
,
conv1_w
,
conv1_b
,
conv2_w
,
conv2_b
,
0
);
__visc__attributes
(
5
,
x
,
conv1_w
,
conv1_b
,
conv2_w
,
conv2_b
,
0
);
void
*
nodeConv1
=
__visc__createNodeND
(
0
,
tensorConvNode
);
void
*
nodeConv1
=
__visc__createNodeND
(
0
,
tensorConvNode1
);
void
*
nodeAdd
=
__visc__createNodeND
(
0
,
tensorAddNode
);
void
*
nodeAdd1
=
__visc__createNodeND
(
0
,
tensorAddNode1
);
void
*
nodePool1
=
__visc__createNodeND
(
0
,
tensorPoolNode1
);
void
*
nodeTanh1
=
__visc__createNodeND
(
0
,
tensorTanhNode1
);
// node, src, dst, stream
// node, src, dst, stream
__visc__bindIn
(
nodeConv1
,
0
,
0
,
0
);
__visc__bindIn
(
nodeConv1
,
0
,
0
,
0
);
...
@@ -46,14 +65,24 @@ void root(void *x, size_t x_bytes,
...
@@ -46,14 +65,24 @@ void root(void *x, size_t x_bytes,
__visc__bindIn
(
nodeConv1
,
3
,
3
,
0
);
__visc__bindIn
(
nodeConv1
,
3
,
3
,
0
);
// node, node, type, src, dst, stream
// node, node, type, src, dst, stream
__visc__edge
(
nodeConv1
,
nodeAdd
,
1
,
0
,
0
,
0
);
__visc__edge
(
nodeConv1
,
nodeAdd
1
,
1
,
0
,
0
,
0
);
__visc__edge
(
nodeConv1
,
nodeAdd
,
1
,
1
,
1
,
0
);
__visc__edge
(
nodeConv1
,
nodeAdd
1
,
1
,
1
,
1
,
0
);
__visc__bindIn
(
nodeAdd
,
4
,
2
,
0
);
// parent_index, dest_index, bind_type
__visc__bindIn
(
nodeAdd
,
5
,
3
,
0
);
__visc__bindIn
(
nodeAdd1
,
4
,
2
,
0
);
__visc__bindIn
(
nodeAdd1
,
5
,
3
,
0
);
__visc__bindOut
(
nodeAdd
,
0
,
0
,
0
);
// node, node, type, src, dst, stream
__visc__bindOut
(
nodeAdd
,
1
,
1
,
0
);
__visc__edge
(
nodeAdd1
,
nodePool1
,
1
,
0
,
0
,
0
);
__visc__edge
(
nodeAdd1
,
nodePool1
,
1
,
1
,
1
,
0
);
// node, node, type, src, dst, stream
__visc__edge
(
nodePool1
,
nodeTanh1
,
1
,
0
,
0
,
0
);
__visc__edge
(
nodePool1
,
nodeTanh1
,
1
,
1
,
1
,
0
);
__visc__bindOut
(
nodeTanh1
,
0
,
0
,
0
);
__visc__bindOut
(
nodeTanh1
,
1
,
1
,
0
);
}
}
...
@@ -67,12 +96,12 @@ struct ret_t {
...
@@ -67,12 +96,12 @@ struct ret_t {
typedef
struct
__attribute__
((
__packed__
))
{
typedef
struct
__attribute__
((
__packed__
))
{
void
*
x
;
void
*
x
;
size_t
x_bytes
;
size_t
x_bytes
;
// 1st Layer parameters
void
*
conv1_w
;
void
*
conv1_w
;
size_t
conv1_w_bytes
;
size_t
conv1_w_bytes
;
void
*
conv1_b
;
void
*
conv1_b
;
size_t
conv1_b_bytes
;
size_t
conv1_b_bytes
;
// 2nd Layer parameters
void
*
conv2_w
;
void
*
conv2_w
;
size_t
conv2_w_bytes
;
size_t
conv2_w_bytes
;
void
*
conv2_b
;
void
*
conv2_b
;
...
@@ -95,7 +124,7 @@ int main() {
...
@@ -95,7 +124,7 @@ int main() {
printf
(
"Reading Input Data from = %s
\n
"
,
input_data_path
.
c_str
());
printf
(
"Reading Input Data from = %s
\n
"
,
input_data_path
.
c_str
());
void
*
x
=
readTrainedWeights
(
input_data_path
.
c_str
(),
float_type
,
void
*
x
=
readTrainedWeights
(
input_data_path
.
c_str
(),
float_type
,
test_batch_size
,
1
,
28
,
28
);
test_batch_size
,
1
,
28
,
28
);
void
*
conv1_w
=
readTrainedWeights
(
conv1_w_path
.
c_str
(),
float_type
,
32
,
1
,
5
,
5
);
void
*
conv1_w
=
readTrainedWeights
(
conv1_w_path
.
c_str
(),
float_type
,
32
,
1
,
5
,
5
);
void
*
conv1_b
=
readTrainedWeights
(
conv1_b_path
.
c_str
(),
float_type
,
1
,
32
,
1
,
1
);
void
*
conv1_b
=
readTrainedWeights
(
conv1_b_path
.
c_str
(),
float_type
,
1
,
32
,
1
,
1
);
void
*
conv2_w
=
readTrainedWeights
(
conv2_w_path
.
c_str
(),
float_type
,
64
,
32
,
5
,
5
);
void
*
conv2_w
=
readTrainedWeights
(
conv2_w_path
.
c_str
(),
float_type
,
64
,
32
,
5
,
5
);
...
@@ -115,7 +144,6 @@ int main() {
...
@@ -115,7 +144,6 @@ int main() {
args
->
conv2_b
=
conv2_b
;
args
->
conv2_b
=
conv2_b
;
args
->
conv2_b_bytes
=
0
;
args
->
conv2_b_bytes
=
0
;
void
*
dfg
=
__visc__launch
(
0
,
root
,
(
void
*
)
args
);
void
*
dfg
=
__visc__launch
(
0
,
root
,
(
void
*
)
args
);
__visc__wait
(
dfg
);
__visc__wait
(
dfg
);
...
...
This diff is collapsed.
Click to expand it.
llvm/test/VISC/DNN_Benchmarks/common/include/visc.h
+
1
−
0
View file @
ecacc226
...
@@ -95,6 +95,7 @@ float __visc__cos(float);
...
@@ -95,6 +95,7 @@ float __visc__cos(float);
void
*
__visc__tensor_add
(
void
*
,
void
*
);
void
*
__visc__tensor_add
(
void
*
,
void
*
);
void
*
__visc__tensor_mul
(
void
*
,
void
*
);
void
*
__visc__tensor_mul
(
void
*
,
void
*
);
void
*
__visc__tensor_convolution
(
void
*
,
void
*
,
int
,
int
,
int
,
int
);
void
*
__visc__tensor_convolution
(
void
*
,
void
*
,
int
,
int
,
int
,
int
);
void
*
__visc__tensor_pool_max
(
void
*
,
int
,
int
,
int
,
int
,
int
,
int
);
void
*
__visc__tensor_relu
(
void
*
);
void
*
__visc__tensor_relu
(
void
*
);
void
*
__visc__tensor_tanh
(
void
*
);
void
*
__visc__tensor_tanh
(
void
*
);
void
*
__visc__tensor_softmax
(
void
*
);
void
*
__visc__tensor_softmax
(
void
*
);
...
...
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