mirror of
https://github.com/ROCm/composable_kernel.git
synced 2026-04-19 22:39:03 +00:00
* delete obselete files * move files * build * update cmake * update cmake * fix build * reorg examples * update cmake for example and test
66 lines
2.0 KiB
C++
66 lines
2.0 KiB
C++
/*******************************************************************************
|
|
*
|
|
* MIT License
|
|
*
|
|
* Copyright (c) 2020 Advanced Micro Devices, Inc.
|
|
*
|
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
* of this software and associated documentation files (the "Software"), to deal
|
|
* in the Software without restriction, including without limitation the rights
|
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
* copies of the Software, and to permit persons to whom the Software is
|
|
* furnished to do so, subject to the following conditions:
|
|
*
|
|
* The above copyright notice and this permission notice shall be included in all
|
|
* copies or substantial portions of the Software.
|
|
*
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
* SOFTWARE.
|
|
*
|
|
*******************************************************************************/
|
|
#ifndef CK_REDUCTION_COMMON_HPP
|
|
#define CK_REDUCTION_COMMON_HPP
|
|
|
|
#include "reduction_enums.hpp"
|
|
|
|
namespace ck {
|
|
|
|
struct float_equal_one
|
|
{
|
|
template <class T>
|
|
__device__ inline bool operator()(T x)
|
|
{
|
|
return x <= static_cast<T>(1.0f) and x >= static_cast<T>(1.0f);
|
|
};
|
|
};
|
|
|
|
struct float_equal_zero
|
|
{
|
|
template <class T>
|
|
__device__ inline bool operator()(T x)
|
|
{
|
|
return x <= static_cast<T>(0.0f) and x >= static_cast<T>(0.0f);
|
|
};
|
|
};
|
|
|
|
template <index_t N>
|
|
static constexpr __device__ index_t get_shift()
|
|
{
|
|
return (get_shift<N / 2>() + 1);
|
|
};
|
|
|
|
template <>
|
|
constexpr __device__ index_t get_shift<1>()
|
|
{
|
|
return (0);
|
|
}
|
|
|
|
}; // end of namespace ck
|
|
|
|
#endif
|