Commit 22500e6c authored by Shucai Xiao's avatar Shucai Xiao
Browse files

clang format

parent ea932b63
...@@ -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)
{ {
......
...@@ -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)
{ {
......
...@@ -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)
{ {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment