Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
N
ngraph
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ngraph
Commits
bb2b9516
Unverified
Commit
bb2b9516
authored
Mar 13, 2018
by
Fenglei
Committed by
GitHub
Mar 13, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #620 from NervanaSystems/tfl/gpu_dot_back
gpu dot bug fix for bprop
parents
b5467550
3d53e58a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
21 deletions
+24
-21
gpu_emitter.cpp
src/ngraph/runtime/gpu/gpu_emitter.cpp
+20
-5
gpu_external_function.cpp
src/ngraph/runtime/gpu/gpu_external_function.cpp
+4
-0
autodiff.in.cpp
test/autodiff.in.cpp
+0
-16
No files found.
src/ngraph/runtime/gpu/gpu_emitter.cpp
View file @
bb2b9516
...
...
@@ -183,6 +183,7 @@ cudnnSetOpTensorDescriptor(opTensorDesc,
return
;
}
const
ngraph
::
op
::
Dot
*
dot
=
static_cast
<
const
ngraph
::
op
::
Dot
*>
(
node
);
const
Shape
&
arg0_shape
=
args
[
0
].
get_shape
();
const
Shape
&
arg1_shape
=
args
[
1
].
get_shape
();
if
(
arg0_shape
.
empty
()
||
arg1_shape
.
empty
())
...
...
@@ -217,18 +218,31 @@ cudnnSetOpTensorDescriptor(opTensorDesc,
return
;
}
if
((
arg0_shape
.
size
()
==
1
)
&&
(
arg1_shape
.
size
()
==
1
))
//case that can be treat as dot1d
if
((
arg0_shape
.
size
()
==
arg1_shape
.
size
())
&&
(
arg0_shape
.
size
()
==
dot
->
get_reduction_axes_count
()))
{
for
(
int
i
=
0
;
i
<
arg0_shape
.
size
();
i
++
)
{
if
(
arg0_shape
[
i
]
!=
arg1_shape
[
i
])
{
throw
std
::
runtime_error
(
"input1 and input2 shape does not match for dot;"
);
}
}
writer
<<
"{ // "
<<
node
->
get_name
()
<<
"
\n
"
;
writer
.
indent
++
;
writer
<<
"cublasSdot("
<<
"cublas_handle,"
<<
arg0_shape
[
0
]
<<
","
<<
args
[
0
].
get_name
()
<<
","
<<
"cublas_handle,"
<<
args
[
0
].
get_size
()
<<
","
<<
args
[
0
].
get_name
()
<<
","
<<
"1,"
<<
args
[
1
].
get_name
()
<<
","
<<
"1,"
<<
out
[
0
].
get_name
()
<<
");
\n
"
;
writer
.
indent
--
;
writer
<<
"}
\n
"
;
}
else
if
((
arg0_shape
.
size
()
==
2
)
&&
(
arg1_shape
.
size
()
==
1
))
else
if
((
arg0_shape
.
size
()
==
2
)
&&
(
arg1_shape
.
size
()
==
1
)
&&
(
dot
->
get_reduction_axes_count
()
==
1
))
{
writer
<<
"{ // "
<<
node
->
get_name
()
<<
"
\n
"
;
writer
.
indent
++
;
...
...
@@ -249,14 +263,15 @@ cudnnSetOpTensorDescriptor(opTensorDesc,
writer
.
indent
--
;
writer
<<
"}
\n
"
;
}
else
if
((
arg0_shape
.
size
()
==
2
)
&&
(
arg1_shape
.
size
()
==
2
))
else
if
((
arg0_shape
.
size
()
==
2
)
&&
(
arg1_shape
.
size
()
==
2
)
&&
(
dot
->
get_reduction_axes_count
()
==
1
))
{
// GEMM Call
if
(
arg0_shape
[
0
]
!=
out
[
0
].
get_shape
()[
0
]
||
// m
arg1_shape
[
1
]
!=
out
[
0
].
get_shape
()[
1
]
||
// n
arg0_shape
[
1
]
!=
arg1_shape
[
0
])
// k
{
throw
std
::
runtime_error
(
"input and output shape
is not correct
for dot;"
);
throw
std
::
runtime_error
(
"input and output shape
does not match
for dot;"
);
}
writer
<<
"{ // "
<<
node
->
get_name
()
<<
"
\n
"
;
writer
.
indent
++
;
...
...
src/ngraph/runtime/gpu/gpu_external_function.cpp
View file @
bb2b9516
...
...
@@ -521,6 +521,10 @@ using namespace std;
writer
<<
"if("
<<
tv
->
get_tensor
().
get_name
()
<<
" == NULL)
\n
"
;
writer
<<
"{
\n
"
;
writer
.
indent
++
;
writer
<<
tv
->
get_tensor
().
get_name
()
<<
" = ("
<<
tv
->
get_tensor
().
get_element_type
().
c_type_string
()
<<
" *) runtime::gpu::create_gpu_buffer("
<<
tv
->
get_tensor
().
size
()
<<
");
\n
"
;
writer
<<
"runtime::gpu::cuda_memcpyHtD("
<<
tv
->
get_tensor
().
get_name
()
<<
", "
<<
tv
->
get_tensor
().
get_name
()
<<
"_cpu, "
<<
tv
->
get_tensor
().
size
()
<<
");
\n
"
;
...
...
test/autodiff.in.cpp
View file @
bb2b9516
...
...
@@ -388,7 +388,6 @@ TEST(${BACKEND_NAME}, backwards_avgpool_n2_c2_hw2x2_win_2x2_str_1x1_padding_nume
TEST
(
$
{
BACKEND_NAME
},
backwards_abs
)
{
SKIP_TEST_FOR
(
"GPU"
,
"${BACKEND_NAME}"
);
auto
manager
=
runtime
::
Manager
::
get
(
"${BACKEND_NAME}"
);
auto
backend
=
manager
->
allocate_backend
();
...
...
@@ -439,7 +438,6 @@ TEST(${BACKEND_NAME}, backwards_add)
TEST
(
$
{
BACKEND_NAME
},
backwards_add_nested
)
{
SKIP_TEST_FOR
(
"GPU"
,
"${BACKEND_NAME}"
);
auto
manager
=
runtime
::
Manager
::
get
(
"${BACKEND_NAME}"
);
auto
backend
=
manager
->
allocate_backend
();
...
...
@@ -577,7 +575,6 @@ TEST(${BACKEND_NAME}, backwards_concat_axis_1)
TEST
(
$
{
BACKEND_NAME
},
backwards_ceiling
)
{
SKIP_TEST_FOR
(
"GPU"
,
"${BACKEND_NAME}"
);
SKIP_TEST_FOR
(
"ARGON"
,
"${BACKEND_NAME}"
);
auto
manager
=
runtime
::
Manager
::
get
(
"${BACKEND_NAME}"
);
...
...
@@ -617,7 +614,6 @@ TEST(${BACKEND_NAME}, backwards_ceiling)
TEST
(
$
{
BACKEND_NAME
},
backwards_cos
)
{
SKIP_TEST_FOR
(
"GPU"
,
"${BACKEND_NAME}"
);
auto
manager
=
runtime
::
Manager
::
get
(
"${BACKEND_NAME}"
);
auto
backend
=
manager
->
allocate_backend
();
...
...
@@ -639,7 +635,6 @@ TEST(${BACKEND_NAME}, backwards_cos)
TEST
(
$
{
BACKEND_NAME
},
backwards_cosh
)
{
SKIP_TEST_FOR
(
"GPU"
,
"${BACKEND_NAME}"
);
SKIP_TEST_FOR
(
"ARGON"
,
"${BACKEND_NAME}"
);
auto
manager
=
runtime
::
Manager
::
get
(
"${BACKEND_NAME}"
);
...
...
@@ -690,7 +685,6 @@ TEST(${BACKEND_NAME}, backwards_divide)
TEST
(
$
{
BACKEND_NAME
},
backwards_dot_scalar_scalar
)
{
SKIP_TEST_FOR
(
"GPU"
,
"${BACKEND_NAME}"
);
auto
manager
=
runtime
::
Manager
::
get
(
"${BACKEND_NAME}"
);
auto
backend
=
manager
->
allocate_backend
();
...
...
@@ -712,7 +706,6 @@ TEST(${BACKEND_NAME}, backwards_dot_scalar_scalar)
TEST
(
$
{
BACKEND_NAME
},
backwards_dot_scalar_tensor
)
{
SKIP_TEST_FOR
(
"GPU"
,
"${BACKEND_NAME}"
);
auto
manager
=
runtime
::
Manager
::
get
(
"${BACKEND_NAME}"
);
auto
backend
=
manager
->
allocate_backend
();
...
...
@@ -734,7 +727,6 @@ TEST(${BACKEND_NAME}, backwards_dot_scalar_tensor)
TEST
(
$
{
BACKEND_NAME
},
backwards_dot_tensor_scalar
)
{
SKIP_TEST_FOR
(
"GPU"
,
"${BACKEND_NAME}"
);
auto
manager
=
runtime
::
Manager
::
get
(
"${BACKEND_NAME}"
);
auto
backend
=
manager
->
allocate_backend
();
...
...
@@ -756,7 +748,6 @@ TEST(${BACKEND_NAME}, backwards_dot_tensor_scalar)
TEST
(
$
{
BACKEND_NAME
},
backwards_dot_vector_vector
)
{
SKIP_TEST_FOR
(
"GPU"
,
"${BACKEND_NAME}"
);
auto
manager
=
runtime
::
Manager
::
get
(
"${BACKEND_NAME}"
);
auto
backend
=
manager
->
allocate_backend
();
...
...
@@ -844,7 +835,6 @@ TEST(${BACKEND_NAME}, backwards_dot_tensor3_tensor3)
TEST
(
$
{
BACKEND_NAME
},
backwards_exp
)
{
SKIP_TEST_FOR
(
"GPU"
,
"${BACKEND_NAME}"
);
auto
manager
=
runtime
::
Manager
::
get
(
"${BACKEND_NAME}"
);
auto
backend
=
manager
->
allocate_backend
();
...
...
@@ -862,7 +852,6 @@ TEST(${BACKEND_NAME}, backwards_exp)
TEST
(
$
{
BACKEND_NAME
},
backwards_floor
)
{
SKIP_TEST_FOR
(
"GPU"
,
"${BACKEND_NAME}"
);
SKIP_TEST_FOR
(
"ARGON"
,
"${BACKEND_NAME}"
);
auto
manager
=
runtime
::
Manager
::
get
(
"${BACKEND_NAME}"
);
...
...
@@ -997,7 +986,6 @@ TEST(${BACKEND_NAME}, backwards_negative)
TEST
(
$
{
BACKEND_NAME
},
backwards_parameter
)
{
SKIP_TEST_FOR
(
"GPU"
,
"${BACKEND_NAME}"
);
auto
manager
=
runtime
::
Manager
::
get
(
"${BACKEND_NAME}"
);
auto
backend
=
manager
->
allocate_backend
();
...
...
@@ -1112,7 +1100,6 @@ TEST(${BACKEND_NAME}, backwards_replace_slice)
TEST
(
$
{
BACKEND_NAME
},
backwards_reshape
)
{
SKIP_TEST_FOR
(
"GPU"
,
"${BACKEND_NAME}"
);
auto
manager
=
runtime
::
Manager
::
get
(
"${BACKEND_NAME}"
);
auto
backend
=
manager
->
allocate_backend
();
...
...
@@ -1202,7 +1189,6 @@ TEST(${BACKEND_NAME}, backwards_select_nested)
TEST
(
$
{
BACKEND_NAME
},
backwards_sign
)
{
SKIP_TEST_FOR
(
"GPU"
,
"${BACKEND_NAME}"
);
SKIP_TEST_FOR
(
"ARGON"
,
"${BACKEND_NAME}"
);
auto
manager
=
runtime
::
Manager
::
get
(
"${BACKEND_NAME}"
);
...
...
@@ -1236,7 +1222,6 @@ TEST(${BACKEND_NAME}, backwards_sign)
TEST
(
$
{
BACKEND_NAME
},
backwards_sin
)
{
SKIP_TEST_FOR
(
"GPU"
,
"${BACKEND_NAME}"
);
auto
manager
=
runtime
::
Manager
::
get
(
"${BACKEND_NAME}"
);
auto
backend
=
manager
->
allocate_backend
();
...
...
@@ -1258,7 +1243,6 @@ TEST(${BACKEND_NAME}, backwards_sin)
TEST
(
$
{
BACKEND_NAME
},
backwards_sinh
)
{
SKIP_TEST_FOR
(
"GPU"
,
"${BACKEND_NAME}"
);
SKIP_TEST_FOR
(
"ARGON"
,
"${BACKEND_NAME}"
);
auto
manager
=
runtime
::
Manager
::
get
(
"${BACKEND_NAME}"
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment