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
22500e6c
Commit
22500e6c
authored
Jun 25, 2019
by
Shucai Xiao
Browse files
clang format
parent
ea932b63
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
34 additions
and
23 deletions
+34
-23
src/targets/cpu/lowering.cpp
src/targets/cpu/lowering.cpp
+8
-8
src/targets/gpu/device/logsoftmax.cpp
src/targets/gpu/device/logsoftmax.cpp
+4
-3
src/targets/gpu/device/softmax.cpp
src/targets/gpu/device/softmax.cpp
+7
-6
src/targets/gpu/include/migraphx/gpu/device/reduce_opers.hpp
src/targets/gpu/include/migraphx/gpu/device/reduce_opers.hpp
+15
-6
No files found.
src/targets/cpu/lowering.cpp
View file @
22500e6c
src/targets/gpu/device/logsoftmax.cpp
View file @
22500e6c
...
@@ -40,7 +40,8 @@ void logsoftmax(hipStream_t stream, const argument& result, const argument& arg,
...
@@ -40,7 +40,8 @@ void logsoftmax(hipStream_t stream, const argument& result, const argument& arg,
auto
data_idx
=
batch_idx
;
auto
data_idx
=
batch_idx
;
// load data to lds and compute the batch max
// load data to lds and compute the batch max
std
::
size_t
remaining_item_num
=
batch_item_num
;
std
::
size_t
remaining_item_num
=
batch_item_num
;
std
::
size_t
round_item_num
=
(
batch_item_num
+
block_size
-
1
)
/
block_size
*
block_size
;
std
::
size_t
round_item_num
=
(
batch_item_num
+
block_size
-
1
)
/
block_size
*
block_size
;
lds_data
[
max_block_size
]
=
input
[
0
];
lds_data
[
max_block_size
]
=
input
[
0
];
for
(
std
::
size_t
i
=
thr_idx
;
i
<
round_item_num
;
i
+=
block_size
)
for
(
std
::
size_t
i
=
thr_idx
;
i
<
round_item_num
;
i
+=
block_size
)
{
{
...
...
src/targets/gpu/device/softmax.cpp
View file @
22500e6c
...
@@ -40,7 +40,8 @@ void softmax(hipStream_t stream, const argument& result, const argument& arg, in
...
@@ -40,7 +40,8 @@ void softmax(hipStream_t stream, const argument& result, const argument& arg, in
auto
data_idx
=
batch_idx
;
auto
data_idx
=
batch_idx
;
// load data to lds and compute the batch max
// load data to lds and compute the batch max
std
::
size_t
remaining_item_num
=
batch_item_num
;
std
::
size_t
remaining_item_num
=
batch_item_num
;
std
::
size_t
round_item_num
=
(
batch_item_num
+
block_size
-
1
)
/
block_size
*
block_size
;
std
::
size_t
round_item_num
=
(
batch_item_num
+
block_size
-
1
)
/
block_size
*
block_size
;
lds_data
[
max_block_size
]
=
input
[
0
];
lds_data
[
max_block_size
]
=
input
[
0
];
for
(
std
::
size_t
i
=
thr_idx
;
i
<
round_item_num
;
i
+=
block_size
)
for
(
std
::
size_t
i
=
thr_idx
;
i
<
round_item_num
;
i
+=
block_size
)
{
{
...
...
src/targets/gpu/include/migraphx/gpu/device/reduce_opers.hpp
View file @
22500e6c
...
@@ -11,8 +11,11 @@ namespace gpu {
...
@@ -11,8 +11,11 @@ namespace gpu {
namespace
device
{
namespace
device
{
template
<
class
T
>
template
<
class
T
>
inline
__device__
void
inline
__device__
void
reduce_max
(
T
*
data_ptr
,
reduce_max
(
T
*
data_ptr
,
std
::
size_t
block_size
,
std
::
size_t
thr_idx
,
std
::
size_t
item_num
,
std
::
size_t
max_index
)
std
::
size_t
block_size
,
std
::
size_t
thr_idx
,
std
::
size_t
item_num
,
std
::
size_t
max_index
)
{
{
while
(
true
)
while
(
true
)
{
{
...
@@ -39,8 +42,11 @@ reduce_max(T* data_ptr, std::size_t block_size, std::size_t thr_idx, std::size_t
...
@@ -39,8 +42,11 @@ reduce_max(T* data_ptr, std::size_t block_size, std::size_t thr_idx, std::size_t
}
}
template
<
class
T
>
template
<
class
T
>
inline
__device__
void
inline
__device__
void
reduce_min
(
T
*
data_ptr
,
reduce_min
(
T
*
data_ptr
,
std
::
size_t
block_size
,
std
::
size_t
thr_idx
,
std
::
size_t
item_num
,
std
::
size_t
min_index
)
std
::
size_t
block_size
,
std
::
size_t
thr_idx
,
std
::
size_t
item_num
,
std
::
size_t
min_index
)
{
{
while
(
true
)
while
(
true
)
{
{
...
@@ -67,8 +73,11 @@ reduce_min(T* data_ptr, std::size_t block_size, std::size_t thr_idx, std::size_t
...
@@ -67,8 +73,11 @@ reduce_min(T* data_ptr, std::size_t block_size, std::size_t thr_idx, std::size_t
}
}
template
<
class
T
>
template
<
class
T
>
inline
__device__
void
inline
__device__
void
reduce_sum
(
T
*
data_ptr
,
reduce_sum
(
T
*
data_ptr
,
std
::
size_t
block_size
,
std
::
size_t
thr_idx
,
std
::
size_t
item_num
,
std
::
size_t
sum_index
)
std
::
size_t
block_size
,
std
::
size_t
thr_idx
,
std
::
size_t
item_num
,
std
::
size_t
sum_index
)
{
{
while
(
true
)
while
(
true
)
{
{
...
...
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