kfr

Fast, modern C++ DSP framework, FFT, Sample Rate Conversion, FIR/IIR/Biquad Filters (SSE, AVX, AVX-512, ARM NEON)
Log | Files | Refs | README

commit af9b271f29828d85eba212cb0dd6a822ab6d45d8
parent 1a8392e329409ae60c31aff032d6a1dc72231231
Author: [email protected] <[email protected]>
Date:   Mon, 25 Jul 2016 13:52:33 +0300

Remove retarget

Diffstat:
Minclude/kfr/all.hpp | 3+--
Dinclude/kfr/base/dispatch.hpp | 200-------------------------------------------------------------------------------
Minclude/kfr/base/expression.hpp | 4----
Minclude/kfr/base/function.hpp | 1-
Minclude/kfr/base/types.hpp | 2--
Minclude/kfr/base/vec.hpp | 8++++----
Dinclude/kfr/dispatch/runtimedispatch.hpp | 173-------------------------------------------------------------------------------
Minclude/kfr/dsp/biquad.hpp | 4----
Minclude/kfr/dsp/window.hpp | 36+++---------------------------------
Minclude/kfr/expressions/basic.hpp | 2--
Minclude/kfr/expressions/conversion.hpp | 3---
Minclude/kfr/expressions/generators.hpp | 15---------------
Minclude/kfr/expressions/reduce.hpp | 6+++---
Msources.cmake | 3+--
14 files changed, 12 insertions(+), 448 deletions(-)

diff --git a/include/kfr/all.hpp b/include/kfr/all.hpp @@ -30,7 +30,6 @@ #include "base/complex.hpp" #include "base/constants.hpp" #include "base/digitreverse.hpp" -#include "base/dispatch.hpp" #include "base/function.hpp" #include "base/gamma.hpp" #include "base/hyperbolic.hpp" @@ -52,7 +51,7 @@ #include "base/univector.hpp" #include "base/vec.hpp" #include "dispatch/cpuid.hpp" -#include "dispatch/runtimedispatch.hpp" +#include "dispatch/cpuid_auto.hpp" #include "expressions/basic.hpp" #include "expressions/conversion.hpp" #include "expressions/generators.hpp" diff --git a/include/kfr/base/dispatch.hpp b/include/kfr/base/dispatch.hpp @@ -1,200 +0,0 @@ -/** - * Copyright (C) 2016 D Levin (http://www.kfrlib.com) - * This file is part of KFR - * - * KFR is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * KFR is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with KFR. - * - * If GPL is not suitable for your project, you must purchase a commercial license to use KFR. - * Buying a commercial license is mandatory as soon as you develop commercial activities without - * disclosing the source code of your own applications. - * See http://www.kfrlib.com for details. - */ -#pragma once - -#include "kfr.h" - -#include "types.hpp" - -namespace kfr -{ - -namespace internal -{ - -template <typename Fn, cpu_t newcpu, typename = void> -struct retarget_impl -{ - using type = Fn; -}; - -template <typename Fn, cpu_t newcpu> -struct retarget_impl<Fn, newcpu, void_t<typename Fn::template retarget_this<newcpu>>> -{ - using type = typename Fn::template retarget_this<newcpu>; -}; -} - -template <typename Fn, cpu_t newcpu> -using retarget = typename internal::retarget_impl<Fn, newcpu>::type; - -template <cpu_t newcpu, typename Fn, typename NewFn = retarget<Fn, newcpu>, - KFR_ENABLE_IF(std::is_constructible<NewFn, Fn&&>::value)> -KFR_INLINE NewFn retarget_func(Fn&& fn) -{ - return NewFn(std::move(fn)); -} - -template <cpu_t newcpu, typename Fn, typename NewEmptyFn = retarget<Fn, newcpu>, - KFR_ENABLE_IF(!std::is_constructible<NewEmptyFn, Fn&&>::value && std::is_empty<NewEmptyFn>::value && - std::is_constructible<NewEmptyFn>::value)> -KFR_INLINE NewEmptyFn retarget_func(Fn&&) -{ - return NewEmptyFn(); -} - -namespace internal -{ - -template <cpu_t a> -struct cpu_caller; - -template <> -struct cpu_caller<cpu_t::avx2> -{ - constexpr static cpu_t a = cpu_t::avx2; - - template <typename Fn, typename... Args> - KFR_NOINLINE static KFR_USE_CPU(avx2) result_of<Fn(Args...)> call(Fn&& fn, Args&&... args) - { - return fn(std::forward<Args>(args)...); - } - - template <typename Fn, typename... Args> - KFR_NOINLINE static KFR_USE_CPU(avx2) result_of<Fn(Args...)> retarget_call(Fn&& fn, Args&&... args) - { - return (retarget_func<a>(std::forward<Fn>(fn)))(std::forward<Args>(args)...); - } -}; - -template <> -struct cpu_caller<cpu_t::avx1> -{ - constexpr static cpu_t a = cpu_t::avx1; - - template <typename Fn, typename... Args> - KFR_NOINLINE static KFR_USE_CPU(avx) result_of<Fn(Args...)> call(Fn&& fn, Args&&... args) - { - return fn(std::forward<Args>(args)...); - } - - template <typename Fn, typename... Args> - KFR_NOINLINE static KFR_USE_CPU(avx) result_of<Fn(Args...)> retarget_call(Fn&& fn, Args&&... args) - { - return (retarget_func<a>(std::forward<Fn>(fn)))(std::forward<Args>(args)...); - } -}; - -template <> -struct cpu_caller<cpu_t::sse41> -{ - constexpr static cpu_t a = cpu_t::sse41; - - template <typename Fn, typename... Args> - KFR_NOINLINE static KFR_USE_CPU(sse41) result_of<Fn(Args...)> call(Fn&& fn, Args&&... args) - { - return fn(std::forward<Args>(args)...); - } - - template <typename Fn, typename... Args> - KFR_NOINLINE static KFR_USE_CPU(sse41) result_of<Fn(Args...)> retarget_call(Fn&& fn, Args&&... args) - { - return (retarget_func<a>(std::forward<Fn>(fn)))(std::forward<Args>(args)...); - } -}; - -template <> -struct cpu_caller<cpu_t::ssse3> -{ - constexpr static cpu_t a = cpu_t::ssse3; - - template <typename Fn, typename... Args> - KFR_NOINLINE static KFR_USE_CPU(ssse3) result_of<Fn(Args...)> call(Fn&& fn, Args&&... args) - { - return fn(std::forward<Args>(args)...); - } - - template <typename Fn, typename... Args> - KFR_NOINLINE static KFR_USE_CPU(ssse3) result_of<Fn(Args...)> retarget_call(Fn&& fn, Args&&... args) - { - return (retarget_func<a>(std::forward<Fn>(fn)))(std::forward<Args>(args)...); - } -}; - -template <> -struct cpu_caller<cpu_t::sse3> -{ - constexpr static cpu_t a = cpu_t::sse3; - - template <typename Fn, typename... Args> - KFR_NOINLINE static KFR_USE_CPU(sse3) result_of<Fn(Args...)> call(Fn&& fn, Args&&... args) - { - return fn(std::forward<Args>(args)...); - } - - template <typename Fn, typename... Args> - KFR_NOINLINE static KFR_USE_CPU(sse3) result_of<Fn(Args...)> retarget_call(Fn&& fn, Args&&... args) - { - return (retarget_func<a>(std::forward<Fn>(fn)))(std::forward<Args>(args)...); - } -}; - -template <> -struct cpu_caller<cpu_t::sse2> -{ - constexpr static cpu_t a = cpu_t::sse2; - - template <typename Fn, typename... Args> - KFR_NOINLINE static KFR_USE_CPU(sse2) result_of<Fn(Args...)> call(Fn&& fn, Args&&... args) - { - return fn(std::forward<Args>(args)...); - } - - template <typename Fn, typename... Args> - KFR_NOINLINE static KFR_USE_CPU(sse2) result_of<Fn(Args...)> retarget_call(Fn&& fn, Args&&... args) - { - return (retarget_func<a>(std::forward<Fn>(fn)))(std::forward<Args>(args)...); - } -}; - -template <cpu_t c, typename Fn, typename... Args, KFR_ENABLE_IF(c == cpu_t::native)> -KFR_INLINE auto dispatch_impl(Fn&& fn, Args&&... args) -> decltype(fn(std::forward<Args>(args)...)) -{ - using targetFn = retarget<Fn, cpu_t::native>; - targetFn newfn = retarget_func<c>(std::forward<Fn>(fn)); - return newfn(std::forward<Args>(args)...); -} - -template <cpu_t c, typename Fn, typename... Args, KFR_ENABLE_IF(c != cpu_t::native && c != cpu_t::runtime)> -KFR_INLINE auto dispatch_impl(Fn&& fn, Args&&... args) -> decltype(fn(std::forward<Args>(args)...)) -{ - return internal::cpu_caller<c>::retarget_call(std::forward<Fn>(fn), std::forward<Args>(args)...); -} -} - -template <cpu_t c, typename Fn, typename... Args> -KFR_INLINE auto dispatch(Fn&& fn, Args&&... args) -> decltype(fn(std::forward<Args>(args)...)) -{ - return internal::dispatch_impl<c>(std::forward<Fn>(fn), std::forward<Args>(args)...); -} -} diff --git a/include/kfr/base/expression.hpp b/include/kfr/base/expression.hpp @@ -22,7 +22,6 @@ */ #pragma once -#include "dispatch.hpp" #include "types.hpp" #include "vec.hpp" @@ -173,9 +172,6 @@ struct expression_function : expression<Args...> using value_type = typename generic_result<Fn, ctypes_t<value_type_of<Args>...>>::type; - template <cpu_t newcpu> - using retarget_this = expression_function<retarget<Fn, newcpu>, retarget<Args, newcpu>...>; - expression_function(Fn&& fn, Args&&... args) noexcept : expression<Args...>(std::forward<Args>(args)...), fn(std::forward<Fn>(fn)) { diff --git a/include/kfr/base/function.hpp b/include/kfr/base/function.hpp @@ -22,7 +22,6 @@ */ #pragma once -#include "dispatch.hpp" #include "expression.hpp" #include "shuffle.hpp" #include "types.hpp" diff --git a/include/kfr/base/types.hpp b/include/kfr/base/types.hpp @@ -72,8 +72,6 @@ struct fn_##fn \ { \ constexpr fn_##fn() noexcept = default; \ - template <cpu_t newcpu> \ - using retarget_this = typename tpl<newcpu>::fn_##fn; \ template <typename... Args> \ KFR_INLINE decltype(fn(std::declval<Args>()...)) operator()(Args&&... args) const \ { \ diff --git a/include/kfr/base/vec.hpp b/include/kfr/base/vec.hpp @@ -717,10 +717,10 @@ struct mask : public vec<T, N> { } -// template <typename M, typename = u8[sizeof(T) == sizeof(M)]> -// constexpr KFR_INLINE mask(mask<M, N> value) : base(reinterpret_cast<const vec<T, N>&>(value)) -// { -// } + // template <typename M, typename = u8[sizeof(T) == sizeof(M)]> + // constexpr KFR_INLINE mask(mask<M, N> value) : base(reinterpret_cast<const vec<T, N>&>(value)) + // { + // } constexpr KFR_INLINE mask operator~() const { return bitcast<T>(~ubitcast(this->v)); } constexpr KFR_INLINE mask operator&(vec<T, N> x) const { diff --git a/include/kfr/dispatch/runtimedispatch.hpp b/include/kfr/dispatch/runtimedispatch.hpp @@ -1,173 +0,0 @@ -/** - * Copyright (C) 2016 D Levin (http://www.kfrlib.com) - * This file is part of KFR - * - * KFR is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * KFR is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with KFR. - * - * If GPL is not suitable for your project, you must purchase a commercial license to use KFR. - * Buying a commercial license is mandatory as soon as you develop commercial activities without - * disclosing the source code of your own applications. - * See http://www.kfrlib.com for details. - */ -#pragma once - -#include "../base/dispatch.hpp" -#include "../base/types.hpp" -#include "cpuid_auto.hpp" - -namespace kfr -{ - -namespace internal -{ - -template <typename Fn, typename... Args> -KFR_CPU_INTRIN(sse2) -auto with_cpu_impl(ccpu_t<cpu_t::sse2>, Fn&& fn, Args&&... args) -{ - return fn(std::forward<Args>(args)...); -} - -template <typename Fn, typename... Args> -KFR_CPU_INTRIN(sse3) -auto with_cpu_impl(ccpu_t<cpu_t::sse3>, Fn&& fn, Args&&... args) -{ - return fn(std::forward<Args>(args)...); -} - -template <typename Fn, typename... Args> -KFR_CPU_INTRIN(ssse3) -auto with_cpu_impl(ccpu_t<cpu_t::ssse3>, Fn&& fn, Args&&... args) -{ - return fn(std::forward<Args>(args)...); -} - -template <typename Fn, typename... Args> -KFR_CPU_INTRIN(sse41) -auto with_cpu_impl(ccpu_t<cpu_t::sse41>, Fn&& fn, Args&&... args) -{ - return fn(std::forward<Args>(args)...); -} - -template <typename Fn, typename... Args> -KFR_CPU_INTRIN(sse42) -auto with_cpu_impl(ccpu_t<cpu_t::sse42>, Fn&& fn, Args&&... args) -{ - return fn(std::forward<Args>(args)...); -} - -template <typename Fn, typename... Args> -KFR_CPU_INTRIN(avx) -auto with_cpu_impl(ccpu_t<cpu_t::avx>, Fn&& fn, Args&&... args) -{ - return fn(std::forward<Args>(args)...); -} - -template <typename Fn, typename... Args> -KFR_CPU_INTRIN(avx2) -auto with_cpu_impl(ccpu_t<cpu_t::avx2>, Fn&& fn, Args&&... args) -{ - return fn(std::forward<Args>(args)...); -} -} - -template <cpu_t cpu, typename Fn, typename... Args> -KFR_INTRIN auto with_cpu(ccpu_t<cpu>, Fn&& fn, Args&&... args) -{ - return internal::with_cpu_impl(ccpu<cpu>, std::forward<Fn>(fn), std::forward<Args>(args)...); -} - -template <cpu_t cpu, typename Fn> -struct fn_with_cpu -{ - template <typename... Args> - KFR_INTRIN auto operator()(Args&&... args) -> decltype(std::declval<Fn>()(std::forward<Args>(args)...)) - { - return internal::with_cpu_impl(ccpu<cpu>, std::forward<Fn>(fn), std::forward<Args>(args)...); - } - Fn fn; -}; - -template <cpu_t cpu, typename Fn> -KFR_INTRIN fn_with_cpu<cpu, Fn> make_with_cpu(ccpu_t<cpu>, Fn&& fn) -{ - return { std::forward<Fn>(fn) }; -} - -namespace internal -{ - -template <typename Fn, cpu_t, cpu_t...> -struct runtime_dispatcher; - -template <typename Fn, cpu_t oldest> -struct runtime_dispatcher<Fn, oldest> -{ - using targetFn = retarget<Fn, oldest>; - - template <typename... Args> - KFR_INLINE static result_of<targetFn(Args&&...)> call(Fn&& fn, cpu_t, Args&&... args) - { - return cpu_caller<oldest>::retarget_call(std::forward<Fn>(fn), std::forward<Args>(args)...); - } -}; - -template <typename Fn, cpu_t newest, cpu_t next, cpu_t... cpus> -struct runtime_dispatcher<Fn, newest, next, cpus...> -{ - using nextdispatcher = runtime_dispatcher<Fn, next, cpus...>; - - using targetFn = retarget<Fn, newest>; - - template <typename... Args, - KFR_ENABLE_IF(is_callable<targetFn, Args&&...>::value&& is_enabled<targetFn>::value)> - KFR_SINTRIN auto call(Fn&& fn, cpu_t set, Args&&... args) - -> decltype(nextdispatcher::call(std::forward<Fn>(fn), set, std::forward<Args>(args)...)) - { - return set >= newest - ? cpu_caller<newest>::retarget_call(std::forward<Fn>(fn), std::forward<Args>(args)...) - : nextdispatcher::call(std::forward<Fn>(fn), set, std::forward<Args>(args)...); - } - template <typename... Args, - KFR_ENABLE_IF(!(is_callable<targetFn, Args&&...>::value && is_enabled<targetFn>::value))> - KFR_SINTRIN auto call(Fn&& fn, cpu_t set, Args&&... args) - -> decltype(nextdispatcher::call(std::forward<Fn>(fn), set, std::forward<Args>(args)...)) - { - return nextdispatcher::call(std::forward<Fn>(fn), set, std::forward<Args>(args)...); - } -}; - -template <typename Fn, cpu_t newest, cpu_t... cpus, typename... Args> -KFR_INLINE auto runtimedispatch(cvals_t<cpu_t, newest, cpus...>, Fn&& fn, Args&&... args) - -> decltype(internal::runtime_dispatcher<Fn, newest, cpus...>::call(std::forward<Fn>(fn), get_cpu(), - std::forward<Args>(args)...)) -{ - return internal::runtime_dispatcher<Fn, newest, cpus...>::call(std::forward<Fn>(fn), get_cpu(), - std::forward<Args>(args)...); -} - -template <cpu_t c, typename Fn, typename... Args, KFR_ENABLE_IF(c == cpu_t::runtime)> -KFR_INLINE auto dispatch(Fn&& fn, Args&&... args) -> decltype(fn(std::forward<Args>(args)...)) -{ - return runtimedispatch(std::forward<Fn>(fn), std::forward<Args>(args)...); -} -} - -template <typename Fn, typename cpulist = decltype(cpu_all), typename... Args> -KFR_INLINE auto runtimedispatch(Fn&& fn, Args&&... args) - -> decltype(internal::runtimedispatch<Fn>(cpulist(), std::forward<Fn>(fn), std::forward<Args>(args)...)) -{ - return internal::runtimedispatch(cpulist(), std::forward<Fn>(fn), std::forward<Args>(args)...); -} -} diff --git a/include/kfr/dsp/biquad.hpp b/include/kfr/dsp/biquad.hpp @@ -130,10 +130,6 @@ public: { using value_type = T; - template <cpu_t newcpu> - using retarget_this = - typename in_biquad<newcpu>::template expression_biquads<filters, T, retarget<E1, newcpu>>; - expression_biquads(const biquad_block<T, filters>& bq, E1&& e1) : expression<E1>(std::forward<E1>(e1)), bq(bq) { diff --git a/include/kfr/dsp/window.hpp b/include/kfr/dsp/window.hpp @@ -118,8 +118,6 @@ struct expression_rectangular : input_expression { using value_type = T; - template <cpu_t newcpu> - using retarget_this = expression_rectangular<T>; expression_rectangular(size_t size, T = T(), window_symmetry = window_symmetry::symmetric) : m_size(size) { } @@ -141,8 +139,6 @@ struct expression_triangular : input_expression { using value_type = T; - template <cpu_t newcpu> - using retarget_this = expression_triangular<T>; expression_triangular(size_t size, T = T(), window_symmetry symmetry = window_symmetry::symmetric) : linspace(size, symmetry), m_size(size) { @@ -165,8 +161,6 @@ struct expression_bartlett : input_expression { using value_type = T; - template <cpu_t newcpu> - using retarget_this = expression_bartlett<T>; expression_bartlett(size_t size, T = T(), window_symmetry symmetry = window_symmetry::symmetric) : linspace(size, symmetry), m_size(size) { @@ -189,8 +183,6 @@ struct expression_cosine : input_expression { using value_type = T; - template <cpu_t newcpu> - using retarget_this = expression_cosine<T>; expression_cosine(size_t size, T = T(), window_symmetry symmetry = window_symmetry::symmetric) : linspace(size, symmetry), m_size(size) { @@ -213,8 +205,6 @@ struct expression_hann : input_expression { using value_type = T; - template <cpu_t newcpu> - using retarget_this = expression_hann<T>; expression_hann(size_t size, T = T(), window_symmetry symmetry = window_symmetry::symmetric) : linspace(size, symmetry), m_size(size) { @@ -237,9 +227,6 @@ struct expression_bartlett_hann : input_expression { using value_type = T; - template <cpu_t newcpu> - using retarget_this = expression_bartlett_hann<T>; - expression_bartlett_hann(size_t size, T = T(), window_symmetry symmetry = window_symmetry::symmetric) : linspace(size, symmetry), m_size(size) { @@ -263,8 +250,6 @@ struct expression_hamming : input_expression { using value_type = T; - template <cpu_t newcpu> - using retarget_this = expression_hamming<T>; expression_hamming(size_t size, T alpha = 0.54, window_symmetry symmetry = window_symmetry::symmetric) : linspace(size, symmetry), alpha(alpha), m_size(size) { @@ -288,8 +273,6 @@ struct expression_bohman : input_expression { using value_type = T; - template <cpu_t newcpu> - using retarget_this = expression_bohman<T>; expression_bohman(size_t size, T = T(), window_symmetry symmetry = window_symmetry::symmetric) : linspace(size, symmetry), m_size(size) { @@ -313,8 +296,6 @@ struct expression_blackman : input_expression { using value_type = T; - template <cpu_t newcpu> - using retarget_this = expression_blackman<T>; expression_blackman(size_t size, T alpha = 0.16, window_symmetry symmetry = window_symmetry::symmetric) : linspace(size, symmetry), a0((1 - alpha) * 0.5), a1(0.5), a2(alpha * 0.5), m_size(size) { @@ -339,8 +320,6 @@ struct expression_blackman_harris : input_expression { using value_type = T; - template <cpu_t newcpu> - using retarget_this = expression_blackman_harris<T>; expression_blackman_harris(size_t size, T = T(), window_symmetry symmetry = window_symmetry::symmetric) : linspace(size, symmetry), m_size(size) { @@ -365,8 +344,6 @@ struct expression_kaiser : input_expression { using value_type = T; - template <cpu_t newcpu> - using retarget_this = expression_kaiser<T>; expression_kaiser(size_t size, T beta = 0.5, window_symmetry symmetry = window_symmetry::symmetric) : linspace(size, symmetry), beta(beta), m(reciprocal(modzerobessel(make_vector(beta))[0])), m_size(size) @@ -392,8 +369,6 @@ struct expression_flattop : input_expression { using value_type = T; - template <cpu_t newcpu> - using retarget_this = expression_flattop<T>; expression_flattop(size_t size, T = T(), window_symmetry symmetry = window_symmetry::symmetric) : linspace(size, symmetry), m_size(size) { @@ -422,9 +397,6 @@ struct expression_gaussian : input_expression { using value_type = T; - template <cpu_t newcpu> - using retarget_this = expression_gaussian<T>; - expression_gaussian(size_t size, T alpha = 2.5, window_symmetry symmetry = window_symmetry::symmetric) : linspace(size, symmetry), alpha(alpha), m_size(size) { @@ -448,8 +420,6 @@ struct expression_lanczos : input_expression { using value_type = T; - template <cpu_t newcpu> - using retarget_this = expression_lanczos<T>; expression_lanczos(size_t size, T alpha = 2.5, window_symmetry symmetry = window_symmetry::symmetric) : linspace(size, symmetry), alpha(alpha), m_size(size) { @@ -525,7 +495,7 @@ KFR_INLINE internal::expression_bartlett_hann<T> window_bartlett_hann(size_t siz } template <typename T = fbase> KFR_INLINE internal::expression_hamming<T> window_hamming(size_t size, T alpha = 0.54, - ctype_t<T> = ctype_t<T>()) + ctype_t<T> = ctype_t<T>()) { return internal::expression_hamming<T>(size, alpha); } @@ -549,7 +519,7 @@ KFR_INLINE internal::expression_blackman_harris<T> window_blackman_harris( } template <typename T = fbase> KFR_INLINE internal::expression_kaiser<T> window_kaiser(size_t size, T beta = T(0.5), - ctype_t<T> = ctype_t<T>()) + ctype_t<T> = ctype_t<T>()) { return internal::expression_kaiser<T>(size, beta); } @@ -560,7 +530,7 @@ KFR_INLINE internal::expression_flattop<T> window_flattop(size_t size, ctype_t<T } template <typename T = fbase> KFR_INLINE internal::expression_gaussian<T> window_gaussian(size_t size, T alpha = 2.5, - ctype_t<T> = ctype_t<T>()) + ctype_t<T> = ctype_t<T>()) { return internal::expression_gaussian<T>(size, alpha); } diff --git a/include/kfr/expressions/basic.hpp b/include/kfr/expressions/basic.hpp @@ -263,8 +263,6 @@ struct expression_sequence : expression<E...> { public: using base = expression<E...>; - template <cpu_t newcpu> - using retarget_this = expression_sequence<retarget<E, newcpu>...>; template <typename... Expr_> KFR_INLINE expression_sequence(const size_t (&segments)[base::size], Expr_&&... expr) noexcept diff --git a/include/kfr/expressions/conversion.hpp b/include/kfr/expressions/conversion.hpp @@ -35,9 +35,6 @@ namespace internal template <typename From, typename E> struct expression_convert : expression<E> { - template <cpu_t newcpu> - using retarget_this = expression_convert<From, retarget<E, newcpu>>; - KFR_INLINE expression_convert(E&& expr) noexcept : expression<E>(std::forward<E>(expr)) {} template <typename T, size_t N> diff --git a/include/kfr/expressions/generators.hpp b/include/kfr/expressions/generators.hpp @@ -109,9 +109,6 @@ public: template <typename T, size_t width = get_vector_width<T, cpu>(1, 2)> struct generator_linear : generator<T, width, generator_linear<T, width>> { - template <cpu_t newcpu> - using retarget_this = typename in_generators<newcpu>::template generator_linear<T>; - constexpr generator_linear(T start, T step) noexcept : step(step), vstep(step* width) { this->resync(start); @@ -129,9 +126,6 @@ public: template <typename T, size_t width = get_vector_width<T, cpu>(1, 2)> struct generator_exp : generator<T, width, generator_exp<T, width>> { - template <cpu_t newcpu> - using retarget_this = typename in_generators<newcpu>::template generator_exp<T>; - generator_exp(T start, T step) noexcept : step(step), vstep(exp(make_vector(step* width))[0] - 1) { this->resync(start); @@ -152,9 +146,6 @@ public: template <typename T, size_t width = get_vector_width<T, cpu>(1, 2)> struct generator_exp2 : generator<T, width, generator_exp2<T, width>> { - template <cpu_t newcpu> - using retarget_this = typename in_generators<newcpu>::template generator_exp2<T>; - generator_exp2(T start, T step) noexcept : step(step), vstep(exp2(make_vector(step* width))[0] - 1) { this->resync(start); @@ -175,9 +166,6 @@ public: template <typename T, size_t width = get_vector_width<T, cpu>(1, 2)> struct generator_cossin : generator<T, width, generator_cossin<T, width>> { - template <cpu_t newcpu> - using retarget_this = typename in_generators<newcpu>::template generator_cossin<T>; - generator_cossin(T start, T step) : step(step), alpha(2 * sqr(sin(width / 2 * step / 2))), beta(-sin(width / 2 * step)) { @@ -203,9 +191,6 @@ public: template <typename T, size_t width = get_vector_width<T, cpu>(2, 4)> struct generator_sin : generator<T, width, generator_sin<T, width>> { - template <cpu_t newcpu> - using retarget_this = typename in_generators<newcpu>::template generator_sin<T>; - generator_sin(T start, T step) : step(step), alpha(2 * sqr(sin(width * step / 2))), beta(sin(width * step)) { diff --git a/include/kfr/expressions/reduce.hpp b/include/kfr/expressions/reduce.hpp @@ -96,9 +96,9 @@ protected: } mutable size_t counter; - retarget<ReduceFn, cpu> reducefn; - retarget<TransformFn, cpu> transformfn; - retarget<FinalFn, cpu> finalfn; + ReduceFn reducefn; + TransformFn transformfn; + FinalFn finalfn; mutable vec<T, width> value; }; diff --git a/sources.cmake b/sources.cmake @@ -24,7 +24,6 @@ set( ${PROJECT_SOURCE_DIR}/include/kfr/base/complex.hpp ${PROJECT_SOURCE_DIR}/include/kfr/base/constants.hpp ${PROJECT_SOURCE_DIR}/include/kfr/base/digitreverse.hpp - ${PROJECT_SOURCE_DIR}/include/kfr/base/dispatch.hpp ${PROJECT_SOURCE_DIR}/include/kfr/base/expression.hpp ${PROJECT_SOURCE_DIR}/include/kfr/base/function.hpp ${PROJECT_SOURCE_DIR}/include/kfr/base/gamma.hpp @@ -54,7 +53,7 @@ set( ${PROJECT_SOURCE_DIR}/include/kfr/dft/reference_dft.hpp ${PROJECT_SOURCE_DIR}/include/kfr/dft/conv.hpp ${PROJECT_SOURCE_DIR}/include/kfr/dispatch/cpuid.hpp - ${PROJECT_SOURCE_DIR}/include/kfr/dispatch/runtimedispatch.hpp + ${PROJECT_SOURCE_DIR}/include/kfr/dispatch/cpuid_auto.hpp ${PROJECT_SOURCE_DIR}/include/kfr/dsp/biquad.hpp ${PROJECT_SOURCE_DIR}/include/kfr/dsp/biquad_design.hpp ${PROJECT_SOURCE_DIR}/include/kfr/dsp/impulse.hpp