feat(tulip): implement some more SIMD
This commit is contained in:
+28
-4
@@ -1,6 +1,7 @@
|
||||
#ifndef TULIP_OPS_HPP
|
||||
#define TULIP_OPS_HPP
|
||||
|
||||
#include "./simd/traits.hpp"
|
||||
#include "./tensor_fwd.hpp"
|
||||
#include "./tensor_shape.hpp"
|
||||
#include "./type_traits.hpp"
|
||||
@@ -67,10 +68,33 @@ private:
|
||||
}
|
||||
};
|
||||
|
||||
struct plus : generic_binary_op<std::plus<>> {};
|
||||
struct minus : generic_binary_op<std::minus<>> {};
|
||||
struct multiply : generic_binary_op<std::multiplies<>> {};
|
||||
struct divide : generic_binary_op<std::divides<>> {};
|
||||
struct plus : generic_binary_op<std::plus<>> {
|
||||
template <typename T, typename Isa>
|
||||
static auto apply_pack(simd::detail::pack_t<T, Isa> lhs, simd::detail::pack_t<T, Isa> rhs) noexcept {
|
||||
return simd::detail::add<T, Isa>(lhs, rhs);
|
||||
}
|
||||
};
|
||||
|
||||
struct minus : generic_binary_op<std::minus<>> {
|
||||
template <typename T, typename Isa>
|
||||
static auto apply_pack(simd::detail::pack_t<T, Isa> lhs, simd::detail::pack_t<T, Isa> rhs) noexcept {
|
||||
return simd::detail::sub<T, Isa>(lhs, rhs);
|
||||
}
|
||||
};
|
||||
|
||||
struct multiply : generic_binary_op<std::multiplies<>> {
|
||||
template <typename T, typename Isa>
|
||||
static auto apply_pack(simd::detail::pack_t<T, Isa> lhs, simd::detail::pack_t<T, Isa> rhs) noexcept {
|
||||
return simd::detail::mul<T, Isa>(lhs, rhs);
|
||||
}
|
||||
};
|
||||
|
||||
struct divide : generic_binary_op<std::divides<>> {
|
||||
template <typename T, typename Isa>
|
||||
static auto apply_pack(simd::detail::pack_t<T, Isa> lhs, simd::detail::pack_t<T, Isa> rhs) noexcept {
|
||||
return simd::detail::div<T, Isa>(lhs, rhs);
|
||||
}
|
||||
};
|
||||
|
||||
struct matmul {
|
||||
template <typename L, typename R>
|
||||
|
||||
Reference in New Issue
Block a user