tesseract++ 0.0.1
N-dimensional tensor library for embedded systems
Loading...
Searching...
No Matches
kernel_helpers.h
Go to the documentation of this file.
1
8#ifndef KERNEL_HELPERS_H
9#define KERNEL_HELPERS_H
10
11#include "config.h"
13
14namespace detail
15{
16
17 template <typename T, my_size_t Bits, typename Arch>
19 {
21
28 typename K::VecType a,
29 typename K::VecType b,
30 typename K::VecType c) noexcept
31 {
32 if constexpr (requires { K::fmadd(a, b, c); })
33 {
34 return K::fmadd(a, b, c);
35 }
36 else
37 {
38 return K::add(K::mul(a, b), c);
39 }
40 }
41 };
42
43} // namespace detail
44
45#endif // KERNEL_HELPERS_H
Global configuration for the tesseract tensor library.
#define FORCE_INLINE
Hint the compiler to always inline a function.
Definition config.h:26
Definition BaseExpr.h:4
Definition microkernel_base.h:16
T VecType
Definition microkernel_base.h:18
static FORCE_INLINE VecType mul(VecType a, VecType b) noexcept
static FORCE_INLINE VecType add(VecType a, VecType b) noexcept
Definition kernel_helpers.h:19
static FORCE_INLINE K::VecType fmadd_safe(typename K::VecType a, typename K::VecType b, typename K::VecType c) noexcept
Fused multiply-add with fallback for architectures without native FMA.
Definition kernel_helpers.h:27