Commit 3272b22e authored by Shucai Xiao's avatar Shucai Xiao
Browse files

clang format

parent 94e3a2e4
......@@ -596,10 +596,7 @@ void program::mark(const parameter_map& params, marker&& m)
m.mark_stop(*this);
}
void program::perf_report(std::ostream& os,
int n,
parameter_map params,
int batch) const
void program::perf_report(std::ostream& os, int n, parameter_map params, int batch) const
{
auto& ctx = this->impl->ctx;
// Run once by itself
......
......@@ -103,9 +103,7 @@ struct cpu_im2col
// compute linear index for output
int ldx = ioutput * col_width + joutput;
int p = 0;
dfor(channels,
kernel_h,
kernel_w)([&](int c, int koffset, int loffset) {
dfor(channels, kernel_h, kernel_w)([&](int c, int koffset, int loffset) {
auto idx = iinput + long(koffset) - kdiv2_h;
auto jdx = jinput + long(loffset) - kdiv2_w;
col(ldx, p) = ((idx >= 0) && (idx < height) && (jdx >= 0) && (jdx < width))
......
......@@ -79,12 +79,8 @@ __device__ auto auto_block_reduce(index idx, Op op, T init, index_int n, F f)
}
template <index_int MaxBlockSize, class Input, class Output>
__device__ void layernorm(index_int i,
index idx,
int block_size_div,
index_int relements,
Input input,
Output output)
__device__ void layernorm(
index_int i, index idx, int block_size_div, index_int relements, Input input, Output output)
{
using value_type = decltype(input(idx.local));
const auto relements_v = relements / vector_size<value_type>{};
......
......@@ -89,8 +89,8 @@ void gemm_impl(context& ctx,
MIGRAPHX_THROW("ROCBLAS_GEMM: k size of int8 type input must be mutlple of 4!");
}
auto num_matrices = std::accumulate(
out_lens.rbegin() + 2, out_lens.rend(), int{1}, std::multiplies<int>());
auto num_matrices =
std::accumulate(out_lens.rbegin() + 2, out_lens.rend(), int{1}, std::multiplies<int>());
if(num_matrices == 1)
{
// the rocblas_gemm API handles inputs and output matrices as
......
......@@ -187,10 +187,7 @@ struct context
hip_device::stream& get_stream(int n) { return get_current_device().get_stream(n); }
const hip_device::stream& get_stream() const { return get_current_device().get_stream(); }
const hip_device::stream& get_stream(int n) const
{
return get_current_device().get_stream(n);
}
const hip_device::stream& get_stream(int n) const { return get_current_device().get_stream(n); }
void set_stream(int n) { get_current_device().set_stream(n); }
......
......@@ -29,10 +29,7 @@ struct kernel
int local,
const std::vector<kernel_argument>& args) const;
void launch(hipStream_t stream,
int global,
int local,
std::vector<void*> args) const;
void launch(hipStream_t stream, int global, int local, std::vector<void*> args) const;
auto launch(hipStream_t stream, int global, int local) const
{
......
......@@ -52,12 +52,8 @@ kernel::kernel(const char* image, const std::string& name) : impl(std::make_shar
MIGRAPHX_THROW("Failed to get function: " + name + ": " + hip_error(status));
}
void launch_kernel(hipFunction_t fun,
hipStream_t stream,
int global,
int local,
void* kernargs,
int size)
void launch_kernel(
hipFunction_t fun, hipStream_t stream, int global, int local, void* kernargs, int size)
{
void* config[] = {
// HIP_LAUNCH_PARAM_* are macros that do horrible things
......@@ -78,10 +74,7 @@ void launch_kernel(hipFunction_t fun,
MIGRAPHX_THROW("Failed to launch kernel: " + hip_error(status));
}
void kernel::launch(hipStream_t stream,
int global,
int local,
std::vector<void*> args) const
void kernel::launch(hipStream_t stream, int global, int local, std::vector<void*> args) const
{
assert(impl != nullptr);
void* kernargs = args.data();
......
......@@ -43,10 +43,8 @@ struct avg_pool
};
template <class T, class Op>
MIGRAPHX_DEVICE_CONSTEXPR T bilinear_interpolate(const T* data,
const array<int, 2>& dims,
array<float, 2> xy,
Op pooling)
MIGRAPHX_DEVICE_CONSTEXPR T
bilinear_interpolate(const T* data, const array<int, 2>& dims, array<float, 2> xy, Op pooling)
{
array<int, 2> low{};
array<int, 2> high{};
......
......@@ -20,8 +20,14 @@ static auto make_mat(tensor_view<T> x)
int dim_0 = n_dims - 2;
int dim_1 = n_dims - 1;
if(s.transposed())
return matrix<T>{x.data(), static_cast<std::size_t>(s.lens()[dim_1]), static_cast<std::size_t>(s.lens()[dim_0]), static_cast<std::size_t>(s.strides()[dim_1])};
return matrix<T>{x.data(), static_cast<std::size_t>(s.lens()[dim_0]), static_cast<std::size_t>(s.lens()[dim_1]), static_cast<std::size_t>(s.strides()[dim_0])};
return matrix<T>{x.data(),
static_cast<std::size_t>(s.lens()[dim_1]),
static_cast<std::size_t>(s.lens()[dim_0]),
static_cast<std::size_t>(s.strides()[dim_1])};
return matrix<T>{x.data(),
static_cast<std::size_t>(s.lens()[dim_0]),
static_cast<std::size_t>(s.lens()[dim_1]),
static_cast<std::size_t>(s.strides()[dim_0])};
}
template <class T, class F>
......
......@@ -317,9 +317,7 @@ struct ref_im2col
// compute linear index for output
int ldx = ioutput * col_width + joutput;
int p = 0;
dfor(channels,
kernel_h,
kernel_w)([&](int c, int koffset, int loffset) {
dfor(channels, kernel_h, kernel_w)([&](int c, int koffset, int loffset) {
auto idx = iinput + long(koffset) - kdiv2_h;
auto jdx = jinput + long(loffset) - kdiv2_w;
col(ldx, p) = ((idx >= 0) && (idx < height) && (jdx >= 0) && (jdx < width))
......
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