Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
gaoqiong
MIGraphX
Commits
1b0de8d5
Commit
1b0de8d5
authored
Apr 18, 2019
by
Shucai Xiao
Browse files
separte this pull request into ajust_gpu_allocation and eliminate_contiguous processing.
parent
c46b0432
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
14 additions
and
23 deletions
+14
-23
src/include/migraphx/op/unary.hpp
src/include/migraphx/op/unary.hpp
+1
-1
src/targets/cpu/lowering.cpp
src/targets/cpu/lowering.cpp
+8
-17
src/targets/gpu/include/migraphx/gpu/oper.hpp
src/targets/gpu/include/migraphx/gpu/oper.hpp
+2
-2
src/targets/gpu/lrn.cpp
src/targets/gpu/lrn.cpp
+1
-1
src/targets/gpu/relu.cpp
src/targets/gpu/relu.cpp
+1
-1
src/targets/gpu/tanh.cpp
src/targets/gpu/tanh.cpp
+1
-1
No files found.
src/include/migraphx/op/unary.hpp
View file @
1b0de8d5
...
...
@@ -21,7 +21,7 @@ struct unary
shape
compute_shape
(
std
::
vector
<
shape
>
inputs
)
const
{
check_shapes
{
inputs
}.
has
(
1
);
return
{
inputs
.
at
(
0
)
.
type
(),
inputs
.
at
(
0
).
lens
()}
;
return
inputs
.
at
(
0
);
}
};
...
...
src/targets/cpu/lowering.cpp
View file @
1b0de8d5
...
...
@@ -593,9 +593,9 @@ struct cpu_unary
{
Op
op
;
std
::
string
name
()
const
{
return
op
.
name
();
}
shape
compute_shape
(
const
std
::
vector
<
shape
>&
inputs
)
const
{
return
{
inputs
.
front
().
type
(),
inputs
.
front
().
lens
()};
shape
compute_shape
(
const
std
::
vector
<
shape
>&
inputs
)
const
{
return
{
inputs
.
front
().
type
(),
inputs
.
front
().
lens
()};
}
argument
compute
(
context
&
,
const
shape
&
output_shape
,
std
::
vector
<
argument
>
args
)
const
...
...
@@ -603,16 +603,7 @@ struct cpu_unary
argument
result
{
output_shape
};
result
.
visit
([
&
](
auto
output
)
{
args
[
0
].
visit
([
&
](
auto
input
)
{
if
(
input
.
get_shape
().
packed
())
{
std
::
transform
(
input
.
begin
(),
input
.
end
(),
output
.
begin
(),
op
.
fcn
());
}
else
{
shape_for_each
(
output
.
get_shape
(),
[
&
](
const
auto
&
idx
)
{
output
(
idx
.
begin
(),
idx
.
end
())
=
op
.
fcn
()(
input
(
idx
.
begin
(),
idx
.
end
()));
});
}
std
::
transform
(
input
.
begin
(),
input
.
end
(),
output
.
begin
(),
op
.
fcn
());
});
});
...
...
@@ -786,11 +777,11 @@ struct cpu_binary
{
Op
op
;
std
::
string
name
()
const
{
return
op
.
name
();
}
shape
compute_shape
(
const
std
::
vector
<
shape
>&
inputs
)
const
{
// operator will generate standard output shape
return
{
inputs
.
front
().
type
(),
inputs
.
front
().
lens
()};
shape
compute_shape
(
const
std
::
vector
<
shape
>&
inputs
)
const
{
return
{
inputs
.
front
().
type
(),
inputs
.
front
().
lens
()};
}
argument
compute
(
context
&
,
const
shape
&
output_shape
,
std
::
vector
<
argument
>
args
)
const
{
argument
result
{
output_shape
};
...
...
src/targets/gpu/include/migraphx/gpu/oper.hpp
View file @
1b0de8d5
...
...
@@ -45,7 +45,7 @@ struct unary_device : oper<Derived>
shape
compute_shape
(
const
std
::
vector
<
shape
>&
inputs
)
const
{
check_shapes
{
inputs
,
*
this
}.
has
(
2
);
return
{
inputs
.
at
(
0
).
type
(),
inputs
.
at
(
0
).
lens
()}
;
return
inputs
.
at
(
1
)
;
}
argument
compute
(
context
&
ctx
,
const
shape
&
,
const
std
::
vector
<
argument
>&
args
)
const
...
...
@@ -63,7 +63,7 @@ struct binary_device : oper<Derived>
shape
compute_shape
(
const
std
::
vector
<
shape
>&
inputs
)
const
{
check_shapes
{
inputs
,
*
this
}.
has
(
3
);
return
{
inputs
.
at
(
0
).
type
(),
inputs
.
at
(
0
).
lens
()}
;
return
inputs
.
at
(
2
)
;
}
argument
compute
(
context
&
ctx
,
const
shape
&
,
const
std
::
vector
<
argument
>&
args
)
const
...
...
src/targets/gpu/lrn.cpp
View file @
1b0de8d5
...
...
@@ -7,7 +7,7 @@ namespace gpu {
shape
miopen_lrn
::
compute_shape
(
const
std
::
vector
<
shape
>&
inputs
)
const
{
check_shapes
{
inputs
,
*
this
}.
has
(
2
).
standar
d
();
check_shapes
{
inputs
,
*
this
}.
has
(
2
).
not_broadcaste
d
();
return
inputs
.
at
(
1
);
}
...
...
src/targets/gpu/relu.cpp
View file @
1b0de8d5
...
...
@@ -7,7 +7,7 @@ namespace gpu {
shape
miopen_relu
::
compute_shape
(
const
std
::
vector
<
shape
>&
inputs
)
const
{
check_shapes
{
inputs
,
*
this
}.
has
(
2
).
not_broadcasted
()
.
not_transposed
()
;
check_shapes
{
inputs
,
*
this
}.
has
(
2
).
not_broadcasted
();
return
inputs
.
at
(
1
);
}
...
...
src/targets/gpu/tanh.cpp
View file @
1b0de8d5
...
...
@@ -7,7 +7,7 @@ namespace gpu {
shape
miopen_tanh
::
compute_shape
(
const
std
::
vector
<
shape
>&
inputs
)
const
{
check_shapes
{
inputs
,
*
this
}.
has
(
2
).
not_broadcasted
()
.
not_transposed
()
;
check_shapes
{
inputs
,
*
this
}.
has
(
2
).
not_broadcasted
();
return
inputs
.
at
(
1
);
}
...
...
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