"vscode:/vscode.git/clone" did not exist on "c0547e9aa39f517a65706a322983d5151277e1d4"
Commit c2b3881f authored by Shucai Xiao's avatar Shucai Xiao
Browse files

clang format

parent ad583f24
......@@ -14,16 +14,18 @@ inline namespace MIGRAPHX_INLINE_NS {
namespace gpu {
namespace device {
template<class T>
struct val_index {
template <class T>
struct val_index
{
T val;
int64_t index;
// MIGRAPHX_DEVICE_CONSTEXPR val_index(T v, int64_t idx) : val(v), index(idx) { }
// MIGRAPHX_DEVICE_CONSTEXPR val_index(T v, int64_t idx) : val(v), index(idx) { }
};
template<class T>
struct argmax_op {
template <class T>
struct argmax_op
{
MIGRAPHX_DEVICE_CONSTEXPR val_index<T> operator()(val_index<T> x, val_index<T> y) const
{
if(x.val > y.val)
......@@ -36,13 +38,12 @@ struct argmax_op {
}
}
MIGRAPHX_DEVICE_CONSTEXPR T init() const {
return lowest();
}
MIGRAPHX_DEVICE_CONSTEXPR T init() const { return lowest(); }
};
template<class T>
struct argmin_op {
template <class T>
struct argmin_op
{
MIGRAPHX_DEVICE_CONSTEXPR val_index<T> operator()(val_index<T> x, val_index<T> y) const
{
if(x.val < y.val)
......@@ -55,9 +56,7 @@ struct argmin_op {
}
}
MIGRAPHX_DEVICE_CONSTEXPR T init() const {
return highest();
}
MIGRAPHX_DEVICE_CONSTEXPR T init() const { return highest(); }
};
template <class T, class Op>
......@@ -75,9 +74,8 @@ void arg_op(Op op, hipStream_t stream, const argument& result, const argument& a
// use one block for items in one batch.
const size_t max_block_size = 256;
const std::size_t block_size = compute_block_size(batch_item_num, max_block_size);
gs_launch(stream,
batch_shape.elements() * block_size,
block_size)([=](auto i, auto idx) __device__ {
gs_launch(stream, batch_shape.elements() * block_size, block_size)(
[=](auto i, auto idx) __device__ {
auto batch_idx = batch_s.multi(i / block_size);
auto data_idx = batch_idx;
T init_val = op.init();
......
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