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
3a848f0d
Commit
3a848f0d
authored
Mar 19, 2020
by
Paul
Browse files
Merge branch 'develop' into doc2
parents
64e8e30a
d1e945da
Changes
208
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
69 additions
and
29 deletions
+69
-29
src/targets/gpu/device/add.cpp
src/targets/gpu/device/add.cpp
+3
-2
src/targets/gpu/device/add_clip.cpp
src/targets/gpu/device/add_clip.cpp
+4
-4
src/targets/gpu/device/add_relu.cpp
src/targets/gpu/device/add_relu.cpp
+3
-3
src/targets/gpu/device/add_sigmoid.cpp
src/targets/gpu/device/add_sigmoid.cpp
+4
-3
src/targets/gpu/device/add_tanh.cpp
src/targets/gpu/device/add_tanh.cpp
+3
-2
src/targets/gpu/device/asin.cpp
src/targets/gpu/device/asin.cpp
+1
-1
src/targets/gpu/device/asinh.cpp
src/targets/gpu/device/asinh.cpp
+18
-0
src/targets/gpu/device/atan.cpp
src/targets/gpu/device/atan.cpp
+1
-1
src/targets/gpu/device/atanh.cpp
src/targets/gpu/device/atanh.cpp
+18
-0
src/targets/gpu/device/ceil.cpp
src/targets/gpu/device/ceil.cpp
+1
-1
src/targets/gpu/device/clip.cpp
src/targets/gpu/device/clip.cpp
+3
-2
src/targets/gpu/device/contiguous.cpp
src/targets/gpu/device/contiguous.cpp
+1
-1
src/targets/gpu/device/convert.cpp
src/targets/gpu/device/convert.cpp
+2
-2
src/targets/gpu/device/cos.cpp
src/targets/gpu/device/cos.cpp
+1
-1
src/targets/gpu/device/cosh.cpp
src/targets/gpu/device/cosh.cpp
+1
-1
src/targets/gpu/device/div.cpp
src/targets/gpu/device/div.cpp
+1
-1
src/targets/gpu/device/erf.cpp
src/targets/gpu/device/erf.cpp
+1
-1
src/targets/gpu/device/exp.cpp
src/targets/gpu/device/exp.cpp
+1
-1
src/targets/gpu/device/floor.cpp
src/targets/gpu/device/floor.cpp
+1
-1
src/targets/gpu/device/gather.cpp
src/targets/gpu/device/gather.cpp
+1
-1
No files found.
src/targets/gpu/device/add.cpp
View file @
3a848f0d
...
...
@@ -8,7 +8,7 @@ namespace device {
void
add
(
hipStream_t
stream
,
const
argument
&
result
,
const
argument
&
arg1
,
const
argument
&
arg2
)
{
nary
(
stream
,
result
,
arg1
,
arg2
)([](
auto
x
,
auto
y
)
{
return
x
+
y
;
});
nary
(
stream
,
result
,
arg1
,
arg2
)([](
auto
x
,
auto
y
)
__device__
{
return
x
+
y
;
});
}
void
add
(
hipStream_t
stream
,
...
...
@@ -17,7 +17,8 @@ void add(hipStream_t stream,
const
argument
&
arg2
,
const
argument
&
arg3
)
{
nary
(
stream
,
result
,
arg1
,
arg2
,
arg3
)([](
auto
x
,
auto
y
,
auto
z
)
{
return
x
+
y
+
z
;
});
nary
(
stream
,
result
,
arg1
,
arg2
,
arg3
)([](
auto
x
,
auto
y
,
auto
z
)
__device__
{
return
x
+
y
+
z
;
});
}
}
// namespace device
...
...
src/targets/gpu/device/add_clip.cpp
View file @
3a848f0d
...
...
@@ -13,8 +13,8 @@ void add_clip(hipStream_t stream,
const
float
max
,
const
float
min
)
{
nary
(
stream
,
result
,
arg1
,
arg2
)([
max
,
min
](
auto
x
,
auto
y
)
{
return
std
::
min
<
decltype
(
x
+
y
)
>
(
std
::
max
<
decltype
(
x
)
>
(
min
,
x
+
y
),
max
);
nary
(
stream
,
result
,
arg1
,
arg2
)([
max
,
min
](
auto
x
,
auto
y
)
__device__
{
return
::
min
<
decltype
(
x
+
y
)
>
(
::
max
<
decltype
(
x
)
>
(
min
,
x
+
y
),
max
);
});
}
...
...
@@ -26,8 +26,8 @@ void add_clip(hipStream_t stream,
const
float
max
,
const
float
min
)
{
nary
(
stream
,
result
,
arg1
,
arg2
,
arg3
)([
max
,
min
](
auto
x
,
auto
y
,
auto
z
)
{
return
std
::
min
<
decltype
(
x
+
y
+
z
)
>
(
std
::
max
<
decltype
(
x
)
>
(
min
,
x
+
y
+
z
),
max
);
nary
(
stream
,
result
,
arg1
,
arg2
,
arg3
)([
max
,
min
](
auto
x
,
auto
y
,
auto
z
)
__device__
{
return
::
min
<
decltype
(
x
+
y
+
z
)
>
(
::
max
<
decltype
(
x
)
>
(
min
,
x
+
y
+
z
),
max
);
});
}
...
...
src/targets/gpu/device/add_relu.cpp
View file @
3a848f0d
...
...
@@ -11,8 +11,8 @@ void add_relu(hipStream_t stream,
const
argument
&
arg1
,
const
argument
&
arg2
)
{
nary
(
stream
,
result
,
arg1
,
arg2
)(
[](
auto
x
,
auto
y
)
{
return
std
::
max
<
decltype
(
x
+
y
)
>
(
0
,
x
+
y
);
});
nary
(
stream
,
result
,
arg1
,
arg2
)(
[](
auto
x
,
auto
y
)
__device__
{
return
::
max
<
decltype
(
x
+
y
)
>
(
0
,
x
+
y
);
});
}
void
add_relu
(
hipStream_t
stream
,
...
...
@@ -22,7 +22,7 @@ void add_relu(hipStream_t stream,
const
argument
&
arg3
)
{
nary
(
stream
,
result
,
arg1
,
arg2
,
arg3
)(
[](
auto
x
,
auto
y
,
auto
z
)
{
return
std
::
max
<
decltype
(
x
+
y
+
z
)
>
(
0
,
x
+
y
+
z
);
});
[](
auto
x
,
auto
y
,
auto
z
)
__device__
{
return
::
max
<
decltype
(
x
+
y
+
z
)
>
(
0
,
x
+
y
+
z
);
});
}
}
// namespace device
...
...
src/targets/gpu/device/add_sigmoid.cpp
View file @
3a848f0d
...
...
@@ -12,7 +12,7 @@ void add_sigmoid(hipStream_t stream,
const
argument
&
arg2
)
{
nary
(
stream
,
result
,
arg1
,
arg2
)(
[](
auto
x
,
auto
y
)
{
return
1.
f
/
(
1.
f
+
::
exp
(
to_hip_type
(
-
(
x
+
y
))));
});
[](
auto
x
,
auto
y
)
__device__
{
return
1.
f
/
(
1.
f
+
::
exp
(
to_hip_type
(
-
(
x
+
y
))));
});
}
void
add_sigmoid
(
hipStream_t
stream
,
...
...
@@ -21,8 +21,9 @@ void add_sigmoid(hipStream_t stream,
const
argument
&
arg2
,
const
argument
&
arg3
)
{
nary
(
stream
,
result
,
arg1
,
arg2
,
arg3
)(
[](
auto
x
,
auto
y
,
auto
z
)
{
return
1.
f
/
(
1.
f
+
::
exp
(
to_hip_type
(
-
(
x
+
y
+
z
))));
});
nary
(
stream
,
result
,
arg1
,
arg2
,
arg3
)([](
auto
x
,
auto
y
,
auto
z
)
__device__
{
return
1.
f
/
(
1.
f
+
::
exp
(
to_hip_type
(
-
(
x
+
y
+
z
))));
});
}
}
// namespace device
...
...
src/targets/gpu/device/add_tanh.cpp
View file @
3a848f0d
...
...
@@ -11,7 +11,8 @@ void add_tanh(hipStream_t stream,
const
argument
&
arg1
,
const
argument
&
arg2
)
{
nary
(
stream
,
result
,
arg1
,
arg2
)([](
auto
x
,
auto
y
)
{
return
::
tanh
(
to_hip_type
(
x
+
y
));
});
nary
(
stream
,
result
,
arg1
,
arg2
)([](
auto
x
,
auto
y
)
__device__
{
return
::
tanh
(
to_hip_type
(
x
+
y
));
});
}
void
add_tanh
(
hipStream_t
stream
,
...
...
@@ -21,7 +22,7 @@ void add_tanh(hipStream_t stream,
const
argument
&
arg3
)
{
nary
(
stream
,
result
,
arg1
,
arg2
,
arg3
)(
[](
auto
x
,
auto
y
,
auto
z
)
{
return
::
tanh
(
to_hip_type
(
x
+
y
+
z
));
});
[](
auto
x
,
auto
y
,
auto
z
)
__device__
{
return
::
tanh
(
to_hip_type
(
x
+
y
+
z
));
});
}
}
// namespace device
...
...
src/targets/gpu/device/asin.cpp
View file @
3a848f0d
...
...
@@ -9,7 +9,7 @@ namespace device {
void
asin
(
hipStream_t
stream
,
const
argument
&
result
,
const
argument
&
arg
)
{
nary
(
stream
,
result
,
arg
)([](
auto
x
)
{
return
::
asin
(
to_hip_type
(
x
));
});
nary
(
stream
,
result
,
arg
)([](
auto
x
)
__device__
{
return
::
asin
(
to_hip_type
(
x
));
});
}
}
// namespace device
...
...
src/targets/gpu/device/asinh.cpp
0 → 100644
View file @
3a848f0d
#include <migraphx/gpu/device/asinh.hpp>
#include <migraphx/gpu/device/nary.hpp>
#include <migraphx/gpu/device/types.hpp>
namespace
migraphx
{
inline
namespace
MIGRAPHX_INLINE_NS
{
namespace
gpu
{
namespace
device
{
void
asinh
(
hipStream_t
stream
,
const
argument
&
result
,
const
argument
&
arg
)
{
nary
(
stream
,
result
,
arg
)([](
auto
x
)
{
return
::
asinh
(
to_hip_type
(
x
));
});
}
}
// namespace device
}
// namespace gpu
}
// namespace MIGRAPHX_INLINE_NS
}
// namespace migraphx
src/targets/gpu/device/atan.cpp
View file @
3a848f0d
...
...
@@ -9,7 +9,7 @@ namespace device {
void
atan
(
hipStream_t
stream
,
const
argument
&
result
,
const
argument
&
arg
)
{
nary
(
stream
,
result
,
arg
)([](
auto
x
)
{
return
::
atan
(
to_hip_type
(
x
));
});
nary
(
stream
,
result
,
arg
)([](
auto
x
)
__device__
{
return
::
atan
(
to_hip_type
(
x
));
});
}
}
// namespace device
...
...
src/targets/gpu/device/atanh.cpp
0 → 100644
View file @
3a848f0d
#include <migraphx/gpu/device/atanh.hpp>
#include <migraphx/gpu/device/nary.hpp>
#include <migraphx/gpu/device/types.hpp>
namespace
migraphx
{
inline
namespace
MIGRAPHX_INLINE_NS
{
namespace
gpu
{
namespace
device
{
void
atanh
(
hipStream_t
stream
,
const
argument
&
result
,
const
argument
&
arg
)
{
nary
(
stream
,
result
,
arg
)([](
auto
x
)
{
return
::
atanh
(
to_hip_type
(
x
));
});
}
}
// namespace device
}
// namespace gpu
}
// namespace MIGRAPHX_INLINE_NS
}
// namespace migraphx
src/targets/gpu/device/ceil.cpp
View file @
3a848f0d
...
...
@@ -9,7 +9,7 @@ namespace device {
void
ceil
(
hipStream_t
stream
,
const
argument
&
result
,
const
argument
&
arg
)
{
nary
(
stream
,
result
,
arg
)([](
auto
x
)
{
return
::
ceil
(
to_hip_type
(
x
));
});
nary
(
stream
,
result
,
arg
)([](
auto
x
)
__device__
{
return
::
ceil
(
to_hip_type
(
x
));
});
}
}
// namespace device
...
...
src/targets/gpu/device/clip.cpp
View file @
3a848f0d
...
...
@@ -12,8 +12,9 @@ void clip(hipStream_t stream,
const
float
max
,
const
float
min
)
{
nary
(
stream
,
result
,
arg1
)(
[
max
,
min
](
auto
x
)
{
return
std
::
min
<
decltype
(
x
)
>
(
std
::
max
<
decltype
(
x
)
>
(
min
,
x
),
max
);
});
nary
(
stream
,
result
,
arg1
)([
max
,
min
](
auto
x
)
__device__
{
return
::
min
<
decltype
(
x
)
>
(
::
max
<
decltype
(
x
)
>
(
min
,
x
),
max
);
});
}
}
// namespace device
...
...
src/targets/gpu/device/contiguous.cpp
View file @
3a848f0d
...
...
@@ -9,7 +9,7 @@ namespace device {
void
contiguous
(
hipStream_t
stream
,
argument
result
,
argument
arg
)
{
nary
(
stream
,
std
::
move
(
result
),
std
::
move
(
arg
))([](
auto
x
)
{
return
x
;
});
nary
(
stream
,
std
::
move
(
result
),
std
::
move
(
arg
))([](
auto
x
)
__device__
{
return
x
;
});
}
}
// namespace device
...
...
src/targets/gpu/device/convert.cpp
View file @
3a848f0d
...
...
@@ -12,8 +12,8 @@ void convert(hipStream_t stream, const argument& result, const argument& arg)
arg
.
visit
([
&
](
auto
input
)
{
const
auto
*
input_ptr
=
device_cast
(
input
.
data
());
auto
*
output_ptr
=
device_cast
(
output
.
data
());
gs_launch
(
stream
,
result
.
get_shape
().
elements
())(
[
=
](
auto
i
)
{
output_ptr
[
i
]
=
input_ptr
[
i
];
});
gs_launch
(
stream
,
result
.
get_shape
().
elements
())(
[
=
](
auto
i
)
__device__
{
output_ptr
[
i
]
=
input_ptr
[
i
];
});
});
});
}
...
...
src/targets/gpu/device/cos.cpp
View file @
3a848f0d
...
...
@@ -9,7 +9,7 @@ namespace device {
void
cos
(
hipStream_t
stream
,
const
argument
&
result
,
const
argument
&
arg
)
{
nary
(
stream
,
result
,
arg
)([](
auto
x
)
{
return
::
cos
(
to_hip_type
(
x
));
});
nary
(
stream
,
result
,
arg
)([](
auto
x
)
__device__
{
return
::
cos
(
to_hip_type
(
x
));
});
}
}
// namespace device
...
...
src/targets/gpu/device/cosh.cpp
View file @
3a848f0d
...
...
@@ -9,7 +9,7 @@ namespace device {
void
cosh
(
hipStream_t
stream
,
const
argument
&
result
,
const
argument
&
arg
)
{
nary
(
stream
,
result
,
arg
)([](
auto
x
)
{
return
::
cosh
(
to_hip_type
(
x
));
});
nary
(
stream
,
result
,
arg
)([](
auto
x
)
__device__
{
return
::
cosh
(
to_hip_type
(
x
));
});
}
}
// namespace device
...
...
src/targets/gpu/device/div.cpp
View file @
3a848f0d
...
...
@@ -8,7 +8,7 @@ namespace device {
void
div
(
hipStream_t
stream
,
const
argument
&
result
,
const
argument
&
arg1
,
const
argument
&
arg2
)
{
nary
(
stream
,
result
,
arg1
,
arg2
)([](
auto
x
,
auto
y
)
{
return
x
/
y
;
});
nary
(
stream
,
result
,
arg1
,
arg2
)([](
auto
x
,
auto
y
)
__device__
{
return
x
/
y
;
});
}
}
// namespace device
...
...
src/targets/gpu/device/erf.cpp
View file @
3a848f0d
...
...
@@ -9,7 +9,7 @@ namespace device {
void
erf
(
hipStream_t
stream
,
const
argument
&
result
,
const
argument
&
arg
)
{
nary
(
stream
,
result
,
arg
)([](
auto
x
)
{
return
::
erf
(
to_hip_type
(
x
));
});
nary
(
stream
,
result
,
arg
)([](
auto
x
)
__device__
{
return
::
erf
(
to_hip_type
(
x
));
});
}
}
// namespace device
...
...
src/targets/gpu/device/exp.cpp
View file @
3a848f0d
...
...
@@ -9,7 +9,7 @@ namespace device {
void
exp
(
hipStream_t
stream
,
const
argument
&
result
,
const
argument
&
arg
)
{
nary
(
stream
,
result
,
arg
)([](
auto
x
)
{
return
::
exp
(
to_hip_type
(
x
));
});
nary
(
stream
,
result
,
arg
)([](
auto
x
)
__device__
{
return
::
exp
(
to_hip_type
(
x
));
});
}
}
// namespace device
...
...
src/targets/gpu/device/floor.cpp
View file @
3a848f0d
...
...
@@ -9,7 +9,7 @@ namespace device {
void
floor
(
hipStream_t
stream
,
const
argument
&
result
,
const
argument
&
arg
)
{
nary
(
stream
,
result
,
arg
)([](
auto
x
)
{
return
::
floor
(
to_hip_type
(
x
));
});
nary
(
stream
,
result
,
arg
)([](
auto
x
)
__device__
{
return
::
floor
(
to_hip_type
(
x
));
});
}
}
// namespace device
...
...
src/targets/gpu/device/gather.cpp
View file @
3a848f0d
...
...
@@ -25,7 +25,7 @@ argument gather(hipStream_t stream, argument result, argument arg1, argument arg
arg2
.
visit
([
&
](
auto
indices
)
{
const
auto
*
indices_ptr
=
device_cast
(
indices
.
data
());
auto
*
output_ptr
=
device_cast
(
output
.
data
());
gs_launch
(
stream
,
nelements
,
256
)([
=
](
auto
i
)
{
gs_launch
(
stream
,
nelements
,
256
)([
=
](
auto
i
)
__device__
{
auto
idx
=
out_comp
.
multi
(
i
);
auto
in_index
=
indices_ptr
[
idx
[
axis_index
]];
in_index
=
(
in_index
<
0
)
?
in_index
+
axis_dim_size
:
in_index
;
...
...
Prev
1
2
3
4
5
6
7
8
…
11
Next
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