Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
gaoqiong
MIGraphX
Commits
759daeb6
Commit
759daeb6
authored
Aug 18, 2018
by
Paul
Browse files
Remove cpu verion for miopen_add
parent
9fed6960
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
34 deletions
+18
-34
src/include/migraph/check_shapes.hpp
src/include/migraph/check_shapes.hpp
+2
-2
src/targets/gpu/lowering.cpp
src/targets/gpu/lowering.cpp
+16
-32
No files found.
src/include/migraph/check_shapes.hpp
View file @
759daeb6
...
@@ -97,8 +97,8 @@ struct check_shapes
...
@@ -97,8 +97,8 @@ struct check_shapes
const
check_shapes
&
not_broadcasted
()
const
const
check_shapes
&
not_broadcasted
()
const
{
{
//
if(!this->all_of([](const shape& s) { return not s.broadcasted(); }))
if
(
!
this
->
all_of
([](
const
shape
&
s
)
{
return
not
s
.
broadcasted
();
}))
//
MIGRAPH_THROW(prefix() + "Shapes are broadcasted");
MIGRAPH_THROW
(
prefix
()
+
"Shapes are broadcasted"
);
return
*
this
;
return
*
this
;
}
}
...
...
src/targets/gpu/lowering.cpp
View file @
759daeb6
...
@@ -180,38 +180,22 @@ struct miopen_add
...
@@ -180,38 +180,22 @@ struct miopen_add
argument
argument
compute
(
context
&
ctx
,
const
shape
&
output_shape
,
const
std
::
vector
<
argument
>&
args
)
const
compute
(
context
&
ctx
,
const
shape
&
output_shape
,
const
std
::
vector
<
argument
>&
args
)
const
{
{
if
(
args
[
1
].
get_shape
().
broadcasted
())
float
alpha
=
1
,
beta
=
0
;
{
auto
a_desc
=
make_tensor
(
args
[
0
].
get_shape
());
argument
result
{
output_shape
};
auto
b_desc
=
make_tensor
(
args
[
1
].
get_shape
());
auto
c_desc
=
make_tensor
(
output_shape
);
visit_all
(
result
,
from_gpu
(
args
[
0
]),
from_gpu
(
args
[
1
]))(
miopenOpTensor
(
ctx
.
handle
.
get
(),
[
&
](
auto
output
,
auto
input1
,
auto
input2
)
{
miopenTensorOpAdd
,
shape_for_each
(
output
.
get_shape
(),
[
&
](
const
auto
&
idx
)
{
&
alpha
,
output
(
idx
.
begin
(),
idx
.
end
())
=
a_desc
.
get
(),
input1
(
idx
.
begin
(),
idx
.
end
())
+
input2
(
idx
.
begin
(),
idx
.
end
());
args
[
0
].
implicit
(),
});
&
alpha
,
});
b_desc
.
get
(),
return
to_gpu
(
result
);
args
[
1
].
implicit
(),
}
&
beta
,
else
c_desc
.
get
(),
{
args
[
2
].
implicit
());
float
alpha
=
1
,
beta
=
0
;
return
args
[
2
];
auto
a_desc
=
make_tensor
(
args
[
0
].
get_shape
());
auto
b_desc
=
make_tensor
(
args
[
1
].
get_shape
());
auto
c_desc
=
make_tensor
(
output_shape
);
miopenOpTensor
(
ctx
.
handle
.
get
(),
miopenTensorOpAdd
,
&
alpha
,
a_desc
.
get
(),
args
[
0
].
implicit
(),
&
alpha
,
b_desc
.
get
(),
args
[
1
].
implicit
(),
&
beta
,
c_desc
.
get
(),
args
[
2
].
implicit
());
return
args
[
2
];
}
}
}
};
};
...
...
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