/home/docs/checkouts/readthedocs.org/user_builds/advanced-micro-devices-roccv/checkouts/latest/include/core/detail/math/vectorized_type_math.hpp File Reference

/home/docs/checkouts/readthedocs.org/user_builds/advanced-micro-devices-roccv/checkouts/latest/include/core/detail/math/vectorized_type_math.hpp File Reference#

2 min read time

Applies to Linux

rocCV: /home/docs/checkouts/readthedocs.org/user_builds/advanced-micro-devices-roccv/checkouts/latest/include/core/detail/math/vectorized_type_math.hpp File Reference
vectorized_type_math.hpp File Reference

This header defines common arithmetic operators for HIP vectorized types. More...

#include <hip/hip_runtime.h>
#include <type_traits>
#include "core/detail/type_traits.hpp"

Go to the source code of this file.

Namespaces

 roccv
 
 roccv::detail
 
 roccv::detail::math
 

Macros

#define DEFINE_VECTOR_BINARY_FUNC(FUNC, NAME)
 
#define DEFINE_VECTOR_BINARY_OP(OPERATOR, NAME)
 
#define DEFINE_VECTOR_UNARY_FUNC(FUNC, NAME)
 

Functions

 roccv::detail::math::DEFINE_VECTOR_BINARY_FUNC (fdividef, vfdividef)
 
 roccv::detail::math::DEFINE_VECTOR_BINARY_FUNC (powf, vpowf)
 
 roccv::detail::math::DEFINE_VECTOR_BINARY_OP (+, add)
 
 roccv::detail::math::DEFINE_VECTOR_BINARY_OP (-, sub)
 
 roccv::detail::math::DEFINE_VECTOR_BINARY_OP (/, div)
 
 roccv::detail::math::DEFINE_VECTOR_UNARY_FUNC (rsqrtf, vrsqrtf)
 
 roccv::detail::math::DEFINE_VECTOR_UNARY_FUNC (sqrtf, vsqrtf)
 

Variables

DEFINE_VECTOR_BINARY_OProccv::detail::math::mul
 

Detailed Description

This header defines common arithmetic operators for HIP vectorized types.

Macro Definition Documentation

◆ DEFINE_VECTOR_BINARY_FUNC

#define DEFINE_VECTOR_BINARY_FUNC (   FUNC,
  NAME 
)

◆ DEFINE_VECTOR_BINARY_OP

#define DEFINE_VECTOR_BINARY_OP (   OPERATOR,
  NAME 
)

◆ DEFINE_VECTOR_UNARY_FUNC

#define DEFINE_VECTOR_UNARY_FUNC (   FUNC,
  NAME 
)
Value:
template <typename U, class = std::enable_if_t<HasTypeTraits<U>>> \
inline __host__ __device__ U NAME(U v) { \
if constexpr (NumComponents<U> == 0) \
return FUNC(v); \
else if constexpr (NumComponents<U> == 1) { \
return U{FUNC(v.x)}; \
} else if constexpr (NumComponents<U> == 2) { \
return U{FUNC(v.x), FUNC(v.y)}; \
} else if constexpr (NumComponents<U> == 3) { \
return U{FUNC(v.x), FUNC(v.y), FUNC(v.z)}; \
} else if constexpr (NumComponents<U> == 4) { \
return U{FUNC(v.x), FUNC(v.y), FUNC(v.z), FUNC(v.w)}; \
} \
}