MLX
 
Loading...
Searching...
No Matches
neon_fp16_simd.h File Reference
#include <arm_neon.h>
#include "mlx/backend/cpu/simd/base_simd.h"

Go to the source code of this file.

Classes

struct  mlx::core::simd::Simd< float16_t, N >
 

Namespaces

namespace  mlx
 
namespace  mlx::core
 
namespace  mlx::core::simd
 

Macros

#define DEFINE_NEON_UNARY_OP(name, op)
 
#define DEFINE_NEON_BINARY_OP(name, op)
 
#define DEFINE_NEON_COMPARISON(Op, op)
 

Functions

Simd< float16_t, Nmlx::core::simd::abs (Simd< float16_t, N > a)
 
Simd< float16_t, Nmlx::core::simd::ceil (Simd< float16_t, N > a)
 
Simd< float16_t, Nmlx::core::simd::floor (Simd< float16_t, N > a)
 
Simd< float16_t, Nmlx::core::simd::sqrt (Simd< float16_t, N > a)
 
Simd< float16_t, Nmlx::core::simd::rsqrt (Simd< float16_t, N > a)
 
Simd< float16_t, Nmlx::core::simd::recip (Simd< float16_t, N > a)
 
Simd< float16_t, Nmlx::core::simd::rint (Simd< float16_t, N > a)
 
Simd< float16_t, Nmlx::core::simd::operator! (Simd< float16_t, N > v)
 
Simd< float16_t, Nmlx::core::simd::operator- (Simd< float16_t, N > v)
 
Simd< float16_t, Nmlx::core::simd::maximum (Simd< float16_t, N > a, Simd< float16_t, N > b)
 
template<typename T>
Simd< float16_t, Nmlx::core::simd::maximum (Simd< float16_t, N > a, T b)
 
template<typename T>
Simd< float16_t, Nmlx::core::simd::maximum (T a, Simd< float16_t, N > b)
 
Simd< float16_t, Nmlx::core::simd::minimum (Simd< float16_t, N > a, Simd< float16_t, N > b)
 
template<typename T>
Simd< float16_t, Nmlx::core::simd::minimum (Simd< float16_t, N > a, T b)
 
template<typename T>
Simd< float16_t, Nmlx::core::simd::minimum (T a, Simd< float16_t, N > b)
 
Simd< float16_t, Nmlx::core::simd::operator+ (Simd< float16_t, N > a, Simd< float16_t, N > b)
 
template<typename T>
Simd< float16_t, Nmlx::core::simd::operator+ (Simd< float16_t, N > a, T b)
 
template<typename T>
Simd< float16_t, Nmlx::core::simd::operator+ (T a, Simd< float16_t, N > b)
 
Simd< float16_t, Nmlx::core::simd::operator- (Simd< float16_t, N > a, Simd< float16_t, N > b)
 
template<typename T>
Simd< float16_t, Nmlx::core::simd::operator- (Simd< float16_t, N > a, T b)
 
template<typename T>
Simd< float16_t, Nmlx::core::simd::operator- (T a, Simd< float16_t, N > b)
 
Simd< float16_t, Nmlx::core::simd::operator* (Simd< float16_t, N > a, Simd< float16_t, N > b)
 
template<typename T>
Simd< float16_t, Nmlx::core::simd::operator* (Simd< float16_t, N > a, T b)
 
template<typename T>
Simd< float16_t, Nmlx::core::simd::operator* (T a, Simd< float16_t, N > b)
 
Simd< float16_t, Nmlx::core::simd::operator/ (Simd< float16_t, N > a, Simd< float16_t, N > b)
 
template<typename T>
Simd< float16_t, Nmlx::core::simd::operator/ (Simd< float16_t, N > a, T b)
 
template<typename T>
Simd< float16_t, Nmlx::core::simd::operator/ (T a, Simd< float16_t, N > b)
 
template<typename T>
Simd< bool, Nmlx::core::simd::operator== (Simd< float16_t, N > a, T b)
 
template<typename T>
Simd< bool, Nmlx::core::simd::operator== (T a, Simd< float16_t, N > b)
 
Simd< bool, Nmlx::core::simd::operator== (Simd< float16_t, N > a, Simd< float16_t, N > b)
 
template<typename T>
Simd< bool, Nmlx::core::simd::operator>= (Simd< float16_t, N > a, T b)
 
template<typename T>
Simd< bool, Nmlx::core::simd::operator>= (T a, Simd< float16_t, N > b)
 
Simd< bool, Nmlx::core::simd::operator>= (Simd< float16_t, N > a, Simd< float16_t, N > b)
 
template<typename T>
Simd< bool, Nmlx::core::simd::operator<= (Simd< float16_t, N > a, T b)
 
template<typename T>
Simd< bool, Nmlx::core::simd::operator<= (T a, Simd< float16_t, N > b)
 
Simd< bool, Nmlx::core::simd::operator<= (Simd< float16_t, N > a, Simd< float16_t, N > b)
 
template<typename T>
Simd< bool, Nmlx::core::simd::operator> (Simd< float16_t, N > a, T b)
 
template<typename T>
Simd< bool, Nmlx::core::simd::operator> (T a, Simd< float16_t, N > b)
 
Simd< bool, Nmlx::core::simd::operator> (Simd< float16_t, N > a, Simd< float16_t, N > b)
 
template<typename T>
Simd< bool, Nmlx::core::simd::operator< (Simd< float16_t, N > a, T b)
 
template<typename T>
Simd< bool, Nmlx::core::simd::operator< (T a, Simd< float16_t, N > b)
 
Simd< bool, Nmlx::core::simd::operator< (Simd< float16_t, N > a, Simd< float16_t, N > b)
 
template<typename T>
Simd< bool, Nmlx::core::simd::operator!= (Simd< float16_t, N > a, T b)
 
template<typename T>
Simd< bool, Nmlx::core::simd::operator!= (T a, Simd< float16_t, N > b)
 
Simd< bool, Nmlx::core::simd::operator!= (Simd< float16_t, N > a, Simd< float16_t, N > b)
 
Simd< float16_t, Nmlx::core::simd::operator|| (Simd< float16_t, N > a, Simd< float16_t, N > b)
 
template<typename T>
Simd< float16_t, Nmlx::core::simd::operator|| (Simd< float16_t, N > a, T b)
 
template<typename T>
Simd< float16_t, Nmlx::core::simd::operator|| (T a, Simd< float16_t, N > b)
 
Simd< float16_t, Nmlx::core::simd::operator&& (Simd< float16_t, N > a, Simd< float16_t, N > b)
 
template<typename T>
Simd< float16_t, Nmlx::core::simd::operator&& (Simd< float16_t, N > a, T b)
 
template<typename T>
Simd< float16_t, Nmlx::core::simd::operator&& (T a, Simd< float16_t, N > b)
 
template<>
Simd< bool, Nmlx::core::simd::isnan (Simd< float16_t, N > v)
 
template<>
Simd< float16_t, Nmlx::core::simd::clamp (Simd< float16_t, N > v, Simd< float16_t, N > min, Simd< float16_t, N > max)
 
template<typename T>
Simd< float16_t, Nmlx::core::simd::fma (Simd< float16_t, N > x, Simd< float16_t, N > y, T z)
 
template<typename MaskT>
Simd< float16_t, Nmlx::core::simd::select (Simd< MaskT, N > mask, Simd< float16_t, N > x, Simd< float16_t, N > y)
 
float16_t mlx::core::simd::max (Simd< float16_t, N > x)
 
float16_t mlx::core::simd::min (Simd< float16_t, N > x)
 
float16_t mlx::core::simd::sum (Simd< float16_t, N > x)
 
float16_t mlx::core::simd::prod (Simd< float16_t, N > x)
 

Variables

constexpr int mlx::core::simd::N = 8
 

Macro Definition Documentation

◆ DEFINE_NEON_BINARY_OP

#define DEFINE_NEON_BINARY_OP ( name,
op )
Value:
inline Simd<float16_t, N> name(Simd<float16_t, N> a, Simd<float16_t, N> b) { \
return op(a.value, b.value); \
} \
template <typename T> \
Simd<float16_t, N> name(Simd<float16_t, N> a, T b) { \
return op(a.value, Simd<float16_t, N>(b).value); \
} \
template <typename T> \
Simd<float16_t, N> name(T a, Simd<float16_t, N> b) { \
return op(Simd<float16_t, N>(a).value, b.value); \
}

◆ DEFINE_NEON_COMPARISON

#define DEFINE_NEON_COMPARISON ( Op,
op )
Value:
template <typename T> \
Simd<bool, N> operator Op(Simd<float16_t, N> a, T b) { \
auto out = op(a.value, Simd<float16_t, N>(b).value); \
return Simd<uint16_t, N>(*(uint16_t*)(&out)); \
} \
template <typename T> \
Simd<bool, N> operator Op(T a, Simd<float16_t, N> b) { \
auto out = op(Simd<float16_t, N>(a).value, b.value); \
return Simd<uint16_t, N>(*(uint16_t*)(&out)); \
} \
inline Simd<bool, N> operator Op( \
Simd<float16_t, N> a, Simd<float16_t, N> b) { \
auto out = op(a.value, b.value); \
return Simd<uint16_t, N>(*(uint16_t*)(&out)); \
}

◆ DEFINE_NEON_UNARY_OP

#define DEFINE_NEON_UNARY_OP ( name,
op )
Value:
inline Simd<float16_t, N> name(Simd<float16_t, N> a) { \
return Simd<float16_t, N>{op(a.value)}; \
}