summaryrefslogtreecommitdiffstats
path: root/staging_vespalib/src/vespa/vespalib/hwaccelrated/avx2.h
diff options
context:
space:
mode:
Diffstat (limited to 'staging_vespalib/src/vespa/vespalib/hwaccelrated/avx2.h')
-rw-r--r--staging_vespalib/src/vespa/vespalib/hwaccelrated/avx2.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/staging_vespalib/src/vespa/vespalib/hwaccelrated/avx2.h b/staging_vespalib/src/vespa/vespalib/hwaccelrated/avx2.h
new file mode 100644
index 00000000000..e434bfc84e6
--- /dev/null
+++ b/staging_vespalib/src/vespa/vespalib/hwaccelrated/avx2.h
@@ -0,0 +1,29 @@
+// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright (C) 2003 Fast Search & Transfer ASA
+// Copyright (C) 2003 Overture Services Norway AS
+
+#pragma once
+
+#include <vespa/vespalib/hwaccelrated/avx.h>
+
+namespace vespalib {
+
+namespace hwaccelrated {
+
+/**
+ * Generic cpu agnostic implementation.
+ */
+class Avx2Accelrator : public AvxAccelrator
+{
+public:
+ virtual float dotProduct(const float * a, const float * b, size_t sz) const;
+ virtual double dotProduct(const double * a, const double * b, size_t sz) const;
+private:
+ template <typename T>
+ VESPA_DLL_LOCAL static T dotProductSelectAlignment(const T * af, const T * bf, size_t sz);
+ template <typename T, unsigned AlignA, unsigned AlignB>
+ VESPA_DLL_LOCAL static T computeDotProduct(const T * af, const T * bf, size_t sz) __attribute__((noinline));
+};
+
+}
+}