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
c9c08eb0
Commit
c9c08eb0
authored
Jun 27, 2019
by
Shucai Xiao
Browse files
clang format
parent
b16ab01d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
11 deletions
+13
-11
src/targets/gpu/device/argmax.cpp
src/targets/gpu/device/argmax.cpp
+1
-1
src/targets/gpu/device/argmin.cpp
src/targets/gpu/device/argmin.cpp
+1
-1
src/targets/gpu/include/migraphx/gpu/device/reduce_opers.hpp
src/targets/gpu/include/migraphx/gpu/device/reduce_opers.hpp
+11
-9
No files found.
src/targets/gpu/device/argmax.cpp
View file @
c9c08eb0
...
...
@@ -82,7 +82,7 @@ void argmax(hipStream_t stream, const argument& result, const argument& arg, int
// load data to lds_data
size_t
round_item_num
=
(
batch_item_num
+
block_size
-
1
)
/
block_size
*
block_size
;
size_t
remaining_item_num
=
batch_item_num
;
data_idx
[
axis
]
=
0
;
data_idx
[
axis
]
=
0
;
lds_data
[
max_block_size
]
=
input
[
arg_s
.
index
(
data_idx
)];
lds_index
[
max_block_size
]
=
0
;
for
(
size_t
i
=
thr_idx
;
i
<
round_item_num
;
i
+=
block_size
)
...
...
src/targets/gpu/device/argmin.cpp
View file @
c9c08eb0
...
...
@@ -82,7 +82,7 @@ void argmin(hipStream_t stream, const argument& result, const argument& arg, int
// load data to lds_data
size_t
round_item_num
=
(
batch_item_num
+
block_size
-
1
)
/
block_size
*
block_size
;
size_t
remaining_item_num
=
batch_item_num
;
data_idx
[
axis
]
=
0
;
data_idx
[
axis
]
=
0
;
lds_data
[
max_block_size
]
=
input
[
arg_s
.
index
(
data_idx
)];
lds_index
[
max_block_size
]
=
0
;
for
(
size_t
i
=
thr_idx
;
i
<
round_item_num
;
i
+=
block_size
)
...
...
src/targets/gpu/include/migraphx/gpu/device/reduce_opers.hpp
View file @
c9c08eb0
...
...
@@ -76,12 +76,12 @@ struct pair_min_op
template
<
class
T
,
class
Op
>
inline
__device__
void
block_reduce_pair
(
T
*
data_ptr
,
int64_t
*
index_ptr
,
Op
op
,
std
::
size_t
block_size
,
std
::
size_t
thr_idx
,
std
::
size_t
item_num
,
std
::
size_t
output_index
)
int64_t
*
index_ptr
,
Op
op
,
std
::
size_t
block_size
,
std
::
size_t
thr_idx
,
std
::
size_t
item_num
,
std
::
size_t
output_index
)
{
while
(
true
)
{
...
...
@@ -89,8 +89,9 @@ inline __device__ void block_reduce_pair(T* data_ptr,
auto
size
=
item_num
/
2
;
for
(
std
::
size_t
i
=
thr_idx
;
i
<
size
;
i
+=
block_size
)
{
auto
output
=
op
({
data_ptr
[
i
],
index_ptr
[
i
]},
{
data_ptr
[
i
+
stride
],
index_ptr
[
i
+
stride
]});
data_ptr
[
i
]
=
output
.
first
;
auto
output
=
op
({
data_ptr
[
i
],
index_ptr
[
i
]},
{
data_ptr
[
i
+
stride
],
index_ptr
[
i
+
stride
]});
data_ptr
[
i
]
=
output
.
first
;
index_ptr
[
i
]
=
output
.
second
;
}
__syncthreads
();
...
...
@@ -102,7 +103,8 @@ inline __device__ void block_reduce_pair(T* data_ptr,
if
(
thr_idx
==
0
)
{
auto
output
=
op
({
data_ptr
[
output_index
],
index_ptr
[
output_index
]},
{
data_ptr
[
0
],
index_ptr
[
0
]});
auto
output
=
op
({
data_ptr
[
output_index
],
index_ptr
[
output_index
]},
{
data_ptr
[
0
],
index_ptr
[
0
]});
data_ptr
[
output_index
]
=
output
.
first
;
index_ptr
[
output_index
]
=
output
.
second
;
}
...
...
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