Commit a7ea008d authored by Paul's avatar Paul
Browse files

Fix tidy warnings

parent be7467a8
...@@ -53,7 +53,7 @@ struct hip_array ...@@ -53,7 +53,7 @@ struct hip_array
friend MIGRAPHX_DEVICE_CONSTEXPR hip_array operator+(const hip_array& x, const hip_array& y) friend MIGRAPHX_DEVICE_CONSTEXPR hip_array operator+(const hip_array& x, const hip_array& y)
{ {
hip_array result; 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]; result[i] = x[i] + y[i];
return result; return result;
......
...@@ -11,13 +11,13 @@ namespace device { ...@@ -11,13 +11,13 @@ namespace device {
struct index struct index
{ {
std::size_t global; std::size_t global = 0;
std::size_t local; std::size_t local = 0;
std::size_t group; std::size_t group = 0;
__device__ std::size_t nglobal() const { return blockDim.x * gridDim.x; } __device__ std::size_t nglobal() const { return blockDim.x * gridDim.x; } // NOLINT
__device__ std::size_t nlocal() const { return blockDim.x; } __device__ std::size_t nlocal() const { return blockDim.x; } // NOLINT
template <class F> template <class F>
__device__ void global_stride(std::size_t n, F f) const __device__ void global_stride(std::size_t n, F f) const
......
...@@ -87,7 +87,7 @@ __device__ auto block_reduce(index idx, Op op, T init, std::size_t n, F f) ...@@ -87,7 +87,7 @@ __device__ auto block_reduce(index idx, Op op, T init, std::size_t n, F f)
return buffer[0]; return buffer[0];
} }
#else #else
constexpr unsigned int dpp_row_shr(unsigned int x) { return 0x110 | x; } constexpr unsigned int dpp_row_shr(unsigned int x) { return 0x110u | x; }
constexpr unsigned int dpp_row_bcast(unsigned int x) constexpr unsigned int dpp_row_bcast(unsigned int x)
{ {
...@@ -114,8 +114,9 @@ __device__ T dpp_mov(T& x) ...@@ -114,8 +114,9 @@ __device__ T dpp_mov(T& x)
uint32_t reg[n]; uint32_t reg[n];
T data; T data;
}; };
type output; type output{};
type input; type input{};
// cppcheck-suppress unreadVariable
input.data = x; input.data = x;
for(std::size_t i = 0; i < n; i++) for(std::size_t i = 0; i < n; i++)
{ {
...@@ -142,8 +143,11 @@ __device__ void dpp_reduce(T& in, Op op) ...@@ -142,8 +143,11 @@ __device__ void dpp_reduce(T& in, Op op)
in = op(in, out); in = op(in, out);
} }
__device__ void dpp_reduce(float& x, sum) __device__ inline void dpp_reduce(float& x, sum)
{ {
#ifdef MIGRAPHX_USE_CLANG_TIDY
(void)x;
#else
__asm__ volatile("s_nop 4\n" __asm__ volatile("s_nop 4\n"
"v_add_f32 %0 %0 %0 row_shr:1\n" "v_add_f32 %0 %0 %0 row_shr:1\n"
"s_nop 1\n" "s_nop 1\n"
...@@ -159,6 +163,7 @@ __device__ void dpp_reduce(float& x, sum) ...@@ -159,6 +163,7 @@ __device__ void dpp_reduce(float& x, sum)
"s_nop 1\n" "s_nop 1\n"
: "=v"(x) : "=v"(x)
: "0"(x)); : "0"(x));
#endif
} }
template <std::size_t N, class Op, class T, class F> template <std::size_t N, class Op, class T, class F>
......
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