"git@developer.sourcefind.cn:gaoqiong/migraphx.git" did not exist on "785307c31a1599e9b8fff2709c71620607a75700"
Commit c1d244d9 authored by Paul's avatar Paul
Browse files

Formatting

parent cf8cc835
......@@ -43,7 +43,7 @@ auto nary_nonstandard_impl(hipStream_t stream, F f, argument result, Arguments..
std::size_t nelements = result.get_shape().elements();
hip_visit_all(result, args...)([&](auto output, auto... inputs) {
gs_launch(stream, nelements)([=](auto i) {
auto idx = output.get_shape().multi(i);
auto idx = output.get_shape().multi(i);
output[i] = f(inputs[idx]...);
});
});
......@@ -93,8 +93,8 @@ void trinary_broadcast_vec_impl(hipStream_t stream,
// Process the data
for(size_t i = idx.global; i < n; i += nglobal)
{
auto bidx = ((i * vec_size) % bdim_next_stride) / bdim_stride;
auto b = bp[bidx];
auto bidx = ((i * vec_size) % bdim_next_stride) / bdim_stride;
auto b = bp[bidx];
vec<type, 4> x = xp[i];
vec<type, 4> y = yp[i];
vec<type, 4> out = outp[i];
......@@ -198,8 +198,8 @@ void binary_broadcast_vec_impl(
// Process the data
for(size_t i = idx.global; i < n; i += nglobal)
{
auto bidx = ((i * vec_size) % bdim_next_stride) / bdim_stride;
auto b = bp[bidx];
auto bidx = ((i * vec_size) % bdim_next_stride) / bdim_stride;
auto b = bp[bidx];
vec<type, 4> x = xp[i];
vec<type, 4> out = outp[i];
for(std::size_t j = 0; j < vec_size; j++)
......@@ -287,9 +287,7 @@ void nary_standard_impl(hipStream_t stream, F f, argument result, Arguments... a
{
std::size_t nelements = result.get_shape().elements();
hip_visit_all(result, args...)([&](auto output, auto... inputs) {
gs_launch(stream, nelements)([=](auto i) {
output.data()[i] = f(inputs.data()[i]...);
});
gs_launch(stream, nelements)([=](auto i) { output.data()[i] = f(inputs.data()[i]...); });
});
}
......
......@@ -85,7 +85,7 @@ struct hip_array
friend MIGRAPHX_DEVICE_CONSTEXPR hip_array operator*(const hip_array& x, const hip_array& y)
{
hip_array result;
for(std::size_t i = 0;i < N;i++)
for(std::size_t i = 0; i < N; i++)
result[i] = x[i] * y[i];
return result;
}
......@@ -167,15 +167,9 @@ struct hip_shape
std::copy(s.strides().begin(), s.strides().end(), strides.begin());
}
MIGRAPHX_DEVICE_CONSTEXPR std::size_t elements() const
{
return lens.product();
}
MIGRAPHX_DEVICE_CONSTEXPR std::size_t elements() const { return lens.product(); }
MIGRAPHX_DEVICE_CONSTEXPR std::size_t index(hip_index x) const
{
return x.dot(strides);
}
MIGRAPHX_DEVICE_CONSTEXPR std::size_t index(hip_index x) const { return x.dot(strides); }
MIGRAPHX_DEVICE_CONSTEXPR std::size_t index(std::initializer_list<std::size_t> x) const
{
......@@ -199,7 +193,7 @@ struct hip_shape
const std::size_t k = rank - j - 1;
const std::size_t stride = this->strides[k];
const std::size_t len = this->lens[k];
const std::size_t slen = s * len;
const std::size_t slen = s * len;
const std::size_t idx = (i % slen) / s;
result += stride * idx;
s = slen;
......@@ -224,7 +218,7 @@ struct hip_shape
template <class T, std::size_t N>
struct hip_tensor_view
{
using value_type = device_type<T>;
using value_type = device_type<T>;
__device__ __host__ hip_tensor_view() = default;
__host__ hip_tensor_view(tensor_view<T> x) : d(device_cast(x.data())), s(x.get_shape()) {}
......@@ -234,8 +228,11 @@ struct hip_tensor_view
MIGRAPHX_DEVICE_CONSTEXPR value_type* data() const { return d; }
template<class U>
MIGRAPHX_DEVICE_CONSTEXPR value_type& operator[](U i) const { return d[s.index(i)]; }
template <class U>
MIGRAPHX_DEVICE_CONSTEXPR value_type& operator[](U i) const
{
return d[s.index(i)];
}
MIGRAPHX_DEVICE_CONSTEXPR value_type* begin() const { return d; }
......
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