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
b6786993
Commit
b6786993
authored
Jun 25, 2019
by
Shucai Xiao
Browse files
clang format
parent
ccdacf44
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
17 deletions
+18
-17
src/targets/gpu/device/logsoftmax.cpp
src/targets/gpu/device/logsoftmax.cpp
+14
-14
src/targets/gpu/device/softmax.cpp
src/targets/gpu/device/softmax.cpp
+4
-2
src/targets/gpu/include/migraphx/gpu/device/reduce_opers.hpp
src/targets/gpu/include/migraphx/gpu/device/reduce_opers.hpp
+0
-1
No files found.
src/targets/gpu/device/logsoftmax.cpp
View file @
b6786993
...
@@ -58,7 +58,8 @@ void logsoftmax(hipStream_t stream, const argument& result, const argument& arg,
...
@@ -58,7 +58,8 @@ void logsoftmax(hipStream_t stream, const argument& result, const argument& arg,
}
}
__syncthreads
();
__syncthreads
();
auto
item_num
=
(
remaining_item_num
>
block_size
)
?
block_size
:
remaining_item_num
;
auto
item_num
=
(
remaining_item_num
>
block_size
)
?
block_size
:
remaining_item_num
;
reduce_max
(
lds_data
,
block_size
,
thr_idx
,
item_num
);
reduce_max
(
lds_data
,
block_size
,
thr_idx
,
item_num
);
remaining_item_num
-=
block_size
;
remaining_item_num
-=
block_size
;
...
@@ -74,21 +75,20 @@ void logsoftmax(hipStream_t stream, const argument& result, const argument& arg,
...
@@ -74,21 +75,20 @@ void logsoftmax(hipStream_t stream, const argument& result, const argument& arg,
if
(
i
<
batch_item_num
)
if
(
i
<
batch_item_num
)
{
{
data_idx
[
axis
]
=
i
;
data_idx
[
axis
]
=
i
;
lds_data
[
thr_idx
]
=
lds_data
[
thr_idx
]
=
input_ptr
[
desc_data
.
linear
(
data_idx
)]
-
batch_max
;
input_ptr
[
desc_data
.
linear
(
data_idx
)]
-
batch_max
;
lds_data
[
thr_idx
]
=
::
exp
(
to_hip_type
(
lds_data
[
thr_idx
]));
lds_data
[
thr_idx
]
=
::
exp
(
to_hip_type
(
lds_data
[
thr_idx
]));
}
}
__syncthreads
();
__syncthreads
();
auto
item_num
=
(
remaining_item_num
>
block_size
)
?
block_size
:
remaining_item_num
;
auto
item_num
=
(
remaining_item_num
>
block_size
)
?
block_size
:
remaining_item_num
;
reduce_sum
(
lds_data
,
block_size
,
thr_idx
,
item_num
);
reduce_sum
(
lds_data
,
block_size
,
thr_idx
,
item_num
);
remaining_item_num
-=
block_size
;
remaining_item_num
-=
block_size
;
}
}
auto
log_batch_sum
=
auto
log_batch_sum
=
::
log
(
to_hip_type
(
lds_data
[
block_size
]))
+
batch_max
;
::
log
(
to_hip_type
(
lds_data
[
block_size
]))
+
batch_max
;
for
(
size_t
i
=
thr_idx
;
i
<
batch_item_num
;
i
+=
block_size
)
for
(
size_t
i
=
thr_idx
;
i
<
batch_item_num
;
i
+=
block_size
)
{
{
...
...
src/targets/gpu/device/softmax.cpp
View file @
b6786993
...
@@ -59,7 +59,8 @@ void softmax(hipStream_t stream, const argument& result, const argument& arg, in
...
@@ -59,7 +59,8 @@ void softmax(hipStream_t stream, const argument& result, const argument& arg, in
__syncthreads
();
__syncthreads
();
auto
item_num
=
(
remaining_item_num
>
block_size
)
?
block_size
:
remaining_item_num
;
auto
item_num
=
(
remaining_item_num
>
block_size
)
?
block_size
:
remaining_item_num
;
reduce_max
<
type
>
(
lds_data
,
block_size
,
thr_idx
,
item_num
);
reduce_max
<
type
>
(
lds_data
,
block_size
,
thr_idx
,
item_num
);
remaining_item_num
-=
block_size
;
remaining_item_num
-=
block_size
;
...
@@ -81,7 +82,8 @@ void softmax(hipStream_t stream, const argument& result, const argument& arg, in
...
@@ -81,7 +82,8 @@ void softmax(hipStream_t stream, const argument& result, const argument& arg, in
__syncthreads
();
__syncthreads
();
auto
item_num
=
(
remaining_item_num
>
block_size
)
?
block_size
:
remaining_item_num
;
auto
item_num
=
(
remaining_item_num
>
block_size
)
?
block_size
:
remaining_item_num
;
reduce_sum
<
type
>
(
lds_data
,
block_size
,
thr_idx
,
item_num
);
reduce_sum
<
type
>
(
lds_data
,
block_size
,
thr_idx
,
item_num
);
remaining_item_num
-=
block_size
;
remaining_item_num
-=
block_size
;
...
...
src/targets/gpu/include/migraphx/gpu/device/reduce_opers.hpp
View file @
b6786993
...
@@ -70,4 +70,3 @@ __device__ void reduce_sum(T* data_ptr, size_t block_size, size_t thr_idx, size_
...
@@ -70,4 +70,3 @@ __device__ void reduce_sum(T* data_ptr, size_t block_size, size_t thr_idx, size_
}
// namespace migraphx
}
// namespace migraphx
#endif
#endif
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