diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2016-10-12 21:47:19 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2016-10-12 21:47:19 +0000 |
commit | 435fbd6ffe10ffed5b2698e81cb85455d8629c7d (patch) | |
tree | bc30b4f4d88711a5854818413e56b333f57f1768 /staging_vespalib | |
parent | c6cb3eb699e3048b2a11cc137f16c8cbb372a793 (diff) |
Remove the traits-like stuff all together.
Diffstat (limited to 'staging_vespalib')
-rw-r--r-- | staging_vespalib/src/vespa/vespalib/hwaccelrated/avxprivate.hpp | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/staging_vespalib/src/vespa/vespalib/hwaccelrated/avxprivate.hpp b/staging_vespalib/src/vespa/vespalib/hwaccelrated/avxprivate.hpp index b4d4696ea1f..87a043b3428 100644 --- a/staging_vespalib/src/vespa/vespalib/hwaccelrated/avxprivate.hpp +++ b/staging_vespalib/src/vespa/vespalib/hwaccelrated/avxprivate.hpp @@ -25,25 +25,18 @@ T sumT(const V & v) { return sum; } -template <typename T, size_t VLEN> -struct TypeSpecifics { - static constexpr const size_t V_SZ = VLEN; - typedef T V __attribute__ ((vector_size (V_SZ))); - static T sum(const V & v) { return sumT<T, V>(v); } -}; - template <typename T, size_t VLEN, unsigned AlignA, unsigned AlignB, size_t VectorsPerChunk> static T computeDotProduct(const T * af, const T * bf, size_t sz) __attribute__((noinline)); template <typename T, size_t VLEN, unsigned AlignA, unsigned AlignB, size_t VectorsPerChunk> T computeDotProduct(const T * af, const T * bf, size_t sz) { - using TT = TypeSpecifics<T, VLEN>; - constexpr const size_t ChunkSize = TT::V_SZ*VectorsPerChunk/sizeof(T); - typename TT::V partial[VectorsPerChunk]; + constexpr const size_t ChunkSize = VLEN*VectorsPerChunk/sizeof(T); + typedef T V __attribute__ ((vector_size (VLEN))); + typedef T A __attribute__ ((vector_size (VLEN), aligned(AlignA))); + typedef T B __attribute__ ((vector_size (VLEN), aligned(AlignB))); + V partial[VectorsPerChunk]; memset(partial, 0, sizeof(partial)); - typedef T A __attribute__ ((vector_size (TT::V_SZ), aligned(AlignA))); - typedef T B __attribute__ ((vector_size (TT::V_SZ), aligned(AlignB))); const A * a = reinterpret_cast<const A *>(af); const B * b = reinterpret_cast<const B *>(bf); @@ -60,7 +53,7 @@ T computeDotProduct(const T * af, const T * bf, size_t sz) for (size_t i(1); i < VectorsPerChunk; i++) { partial[0] += partial[i]; } - return sum + TT::sum(partial[0]); + return sum + sumT<T, V>(partial[0]); } } |