28 template <vector_mode_t V>
35 static constexpr
bool gpu_computable = (is_single_precision_t<T> && impl::egblas::has_sinvsqrt) || (is_double_precision_t<T> && impl::egblas::has_dinvsqrt)
36 || (is_complex_single_t<T> && impl::egblas::has_cinvsqrt) || (is_complex_double_t<T> && impl::egblas::has_zinvsqrt);
51 static constexpr T
apply(
const T& x) {
62 template <
typename X,
typename Y>
69 impl::egblas::invsqrt(
etl::size(y), alpha, t1.gpu_memory(), 1, t2.gpu_memory(), 1);
79 template <
typename X,
typename Y>
84 impl::egblas::invsqrt(
etl::size(y), alpha, t1.gpu_memory(), 1, y.gpu_memory(), 1);
96 static std::string
desc() noexcept {
104 template <
typename TT>
108 static constexpr
bool linear =
true;
109 static constexpr
bool thread_safe =
true;
116 template <vector_mode_t V>
117 static constexpr
bool vectorizable =
false;
122 template <
typename E>
123 static constexpr
bool gpu_computable = (is_single_precision_t<T> && impl::egblas::has_sinvsqrt) || (is_double_precision_t<T> && impl::egblas::has_dinvsqrt)
124 || (is_complex_single_t<T> && impl::egblas::has_cinvsqrt) || (is_complex_double_t<T> && impl::egblas::has_zinvsqrt);
150 template <
typename X,
typename Y>
157 impl::egblas::invsqrt(
etl::size(y), alpha, t1.gpu_memory(), 1, t2.gpu_memory(), 1);
167 template <
typename X,
typename Y>
172 impl::egblas::invsqrt(
etl::size(y), alpha, t1.gpu_memory(), 1, y.gpu_memory(), 1);
184 static std::string
desc() noexcept {
static constexpr T apply(const T &x)
Apply the unary operator on x.
Definition: invsqrt.hpp:51
static constexpr int complexity()
Estimate the complexity of operator.
Definition: invsqrt.hpp:130
Complex number implementation.
Definition: complex.hpp:31
static auto gpu_compute_hint(const X &x, Y &y) noexcept
Compute the result of the operation using the GPU.
Definition: invsqrt.hpp:63
auto sqrt(E &&value) -> detail::unary_helper< E, sqrt_unary_op >
Apply square root on each value of the given expression.
Definition: function_expression_builder.hpp:24
decltype(auto) select_smart_gpu_compute(X &x, Y &y)
Compute the expression into a representation that is GPU up to date and possibly store this represent...
Definition: helpers.hpp:434
static constexpr bool thread_safe
Indicates if the operator is thread safe or not.
Definition: invsqrt.hpp:21
static auto gpu_compute_hint(const X &x, Y &y) noexcept
Compute the result of the operation using the GPU.
Definition: invsqrt.hpp:151
static constexpr T apply(const T &x)
Apply the unary operator on x.
Definition: invsqrt.hpp:139
static constexpr bool linear
Indicates if the operator is linear.
Definition: invsqrt.hpp:20
Root namespace for the ETL library.
Definition: adapter.hpp:15
static Y & gpu_compute(const X &x, Y &y) noexcept
Compute the result of the operation using the GPU.
Definition: invsqrt.hpp:80
EGBLAS wrappers for the invsqrt operation.
static std::string desc() noexcept
Returns a textual representation of the operator.
Definition: invsqrt.hpp:96
decltype(auto) force_temporary_gpu_dim_only(E &&expr)
Force a temporary out of the expression, without copying its content.
Definition: temporary.hpp:223
constexpr size_t size(const E &expr) noexcept
Returns the size of the given ETL expression.
Definition: helpers.hpp:108
static constexpr bool vectorizable
Indicates if the expression is vectorizable using the given vector mode.
Definition: invsqrt.hpp:29
decltype(auto) smart_gpu_compute_hint(E &expr, Y &y)
Compute the expression into a representation that is GPU up to date.
Definition: helpers.hpp:368
Unary operation taking the inverse square root value.
Definition: invsqrt.hpp:19
auto invsqrt(E &&value) -> detail::unary_helper< E, invsqrt_unary_op >
Apply inverse square root on each value of the given expression.
Definition: function_expression_builder.hpp:34
static Y & gpu_compute(const X &x, Y &y) noexcept
Compute the result of the operation using the GPU.
Definition: invsqrt.hpp:168
static constexpr int complexity()
Estimate the complexity of operator.
Definition: invsqrt.hpp:42
static std::string desc() noexcept
Returns a textual representation of the operator.
Definition: invsqrt.hpp:184
static constexpr bool gpu_computable
Indicates if the operator can be computed on GPU.
Definition: invsqrt.hpp:35