From 06210a9350c7448d8ef22cb6308d17e75a3b1f2e Mon Sep 17 00:00:00 2001 From: Henning Baldersheim Date: Fri, 15 Dec 2023 15:26:30 +0100 Subject: Revert "Balder/separate hot cold path tomake fast path faster" --- vespalib/src/vespa/vespalib/hwaccelrated/avx2.cpp | 8 ++++---- vespalib/src/vespa/vespalib/hwaccelrated/avx2.h | 4 ++-- vespalib/src/vespa/vespalib/hwaccelrated/avx512.cpp | 8 ++++---- vespalib/src/vespa/vespalib/hwaccelrated/avx512.h | 4 ++-- vespalib/src/vespa/vespalib/hwaccelrated/generic.cpp | 8 ++++---- vespalib/src/vespa/vespalib/hwaccelrated/generic.h | 4 ++-- vespalib/src/vespa/vespalib/hwaccelrated/iaccelrated.cpp | 16 ++++++++-------- vespalib/src/vespa/vespalib/hwaccelrated/iaccelrated.h | 8 ++++---- .../src/vespa/vespalib/hwaccelrated/private_helpers.hpp | 4 ++-- 9 files changed, 32 insertions(+), 32 deletions(-) (limited to 'vespalib') diff --git a/vespalib/src/vespa/vespalib/hwaccelrated/avx2.cpp b/vespalib/src/vespa/vespalib/hwaccelrated/avx2.cpp index c6a9cc7ae9e..bbba4109fc2 100644 --- a/vespalib/src/vespa/vespalib/hwaccelrated/avx2.cpp +++ b/vespalib/src/vespa/vespalib/hwaccelrated/avx2.cpp @@ -26,13 +26,13 @@ Avx2Accelrator::squaredEuclideanDistance(const double * a, const double * b, siz } void -Avx2Accelrator::and256(size_t offset, const std::vector> &src, void *dest) const noexcept { - helper::andChunks<32u, 8u>(offset, src, dest); +Avx2Accelrator::and64(size_t offset, const std::vector> &src, void *dest) const noexcept { + helper::andChunks<32u, 2u>(offset, src, dest); } void -Avx2Accelrator::or256(size_t offset, const std::vector> &src, void *dest) const noexcept { - helper::orChunks<32u, 8u>(offset, src, dest); +Avx2Accelrator::or64(size_t offset, const std::vector> &src, void *dest) const noexcept { + helper::orChunks<32u, 2u>(offset, src, dest); } } diff --git a/vespalib/src/vespa/vespalib/hwaccelrated/avx2.h b/vespalib/src/vespa/vespalib/hwaccelrated/avx2.h index 61ca1573601..934d815d67b 100644 --- a/vespalib/src/vespa/vespalib/hwaccelrated/avx2.h +++ b/vespalib/src/vespa/vespalib/hwaccelrated/avx2.h @@ -16,8 +16,8 @@ public: double squaredEuclideanDistance(const int8_t * a, const int8_t * b, size_t sz) const noexcept override; double squaredEuclideanDistance(const float * a, const float * b, size_t sz) const noexcept override; double squaredEuclideanDistance(const double * a, const double * b, size_t sz) const noexcept override; - void and256(size_t offset, const std::vector> &src, void *dest) const noexcept override; - void or256(size_t offset, const std::vector> &src, void *dest) const noexcept override; + void and64(size_t offset, const std::vector> &src, void *dest) const noexcept override; + void or64(size_t offset, const std::vector> &src, void *dest) const noexcept override; }; } diff --git a/vespalib/src/vespa/vespalib/hwaccelrated/avx512.cpp b/vespalib/src/vespa/vespalib/hwaccelrated/avx512.cpp index 5b3a7deb564..035f33cb25e 100644 --- a/vespalib/src/vespa/vespalib/hwaccelrated/avx512.cpp +++ b/vespalib/src/vespa/vespalib/hwaccelrated/avx512.cpp @@ -36,13 +36,13 @@ Avx512Accelrator::squaredEuclideanDistance(const double * a, const double * b, s } void -Avx512Accelrator::and256(size_t offset, const std::vector> &src, void *dest) const noexcept { - helper::andChunks<64, 4>(offset, src, dest); +Avx512Accelrator::and64(size_t offset, const std::vector> &src, void *dest) const noexcept { + helper::andChunks<64, 1>(offset, src, dest); } void -Avx512Accelrator::or256(size_t offset, const std::vector> &src, void *dest) const noexcept { - helper::orChunks<64, 4>(offset, src, dest); +Avx512Accelrator::or64(size_t offset, const std::vector> &src, void *dest) const noexcept { + helper::orChunks<64, 1>(offset, src, dest); } } diff --git a/vespalib/src/vespa/vespalib/hwaccelrated/avx512.h b/vespalib/src/vespa/vespalib/hwaccelrated/avx512.h index fbfdd021619..38eab0a2549 100644 --- a/vespalib/src/vespa/vespalib/hwaccelrated/avx512.h +++ b/vespalib/src/vespa/vespalib/hwaccelrated/avx512.h @@ -18,8 +18,8 @@ public: double squaredEuclideanDistance(const int8_t * a, const int8_t * b, size_t sz) const noexcept override; double squaredEuclideanDistance(const float * a, const float * b, size_t sz) const noexcept override; double squaredEuclideanDistance(const double * a, const double * b, size_t sz) const noexcept override; - void and256(size_t offset, const std::vector> &src, void *dest) const noexcept override; - void or256(size_t offset, const std::vector> &src, void *dest) const noexcept override; + void and64(size_t offset, const std::vector> &src, void *dest) const noexcept override; + void or64(size_t offset, const std::vector> &src, void *dest) const noexcept override; }; } diff --git a/vespalib/src/vespa/vespalib/hwaccelrated/generic.cpp b/vespalib/src/vespa/vespalib/hwaccelrated/generic.cpp index b6b8436a389..a8e5535cc21 100644 --- a/vespalib/src/vespa/vespalib/hwaccelrated/generic.cpp +++ b/vespalib/src/vespa/vespalib/hwaccelrated/generic.cpp @@ -173,13 +173,13 @@ GenericAccelrator::squaredEuclideanDistance(const double * a, const double * b, } void -GenericAccelrator::and256(size_t offset, const std::vector> &src, void *dest) const noexcept { - helper::andChunks<16, 16>(offset, src, dest); +GenericAccelrator::and64(size_t offset, const std::vector> &src, void *dest) const noexcept { + helper::andChunks<16, 4>(offset, src, dest); } void -GenericAccelrator::or256(size_t offset, const std::vector> &src, void *dest) const noexcept { - helper::orChunks<16, 16>(offset, src, dest); +GenericAccelrator::or64(size_t offset, const std::vector> &src, void *dest) const noexcept { + helper::orChunks<16,4>(offset, src, dest); } } diff --git a/vespalib/src/vespa/vespalib/hwaccelrated/generic.h b/vespalib/src/vespa/vespalib/hwaccelrated/generic.h index 5cbabc3de53..16c8bab71da 100644 --- a/vespalib/src/vespa/vespalib/hwaccelrated/generic.h +++ b/vespalib/src/vespa/vespalib/hwaccelrated/generic.h @@ -26,8 +26,8 @@ public: double squaredEuclideanDistance(const int8_t * a, const int8_t * b, size_t sz) const noexcept override; double squaredEuclideanDistance(const float * a, const float * b, size_t sz) const noexcept override; double squaredEuclideanDistance(const double * a, const double * b, size_t sz) const noexcept override; - void and256(size_t offset, const std::vector> &src, void *dest) const noexcept override; - void or256(size_t offset, const std::vector> &src, void *dest) const noexcept override; + void and64(size_t offset, const std::vector> &src, void *dest) const noexcept override; + void or64(size_t offset, const std::vector> &src, void *dest) const noexcept override; }; } diff --git a/vespalib/src/vespa/vespalib/hwaccelrated/iaccelrated.cpp b/vespalib/src/vespa/vespalib/hwaccelrated/iaccelrated.cpp index 77d168a2c5d..d707553b504 100644 --- a/vespalib/src/vespa/vespalib/hwaccelrated/iaccelrated.cpp +++ b/vespalib/src/vespa/vespalib/hwaccelrated/iaccelrated.cpp @@ -153,8 +153,8 @@ verifyOr64(const IAccelrated & accel, const std::vector> & simpleOrWith(expected, optionallyInvert(vRefs[j].second, vectors[j])); } - uint64_t dest[32] __attribute((aligned(64))); - accel.or256(offset * sizeof(uint64_t), vRefs, dest); + uint64_t dest[8] __attribute((aligned(64))); + accel.or64(offset*sizeof(uint64_t), vRefs, dest); int diff = memcmp(&expected[offset], dest, sizeof(dest)); if (diff != 0) { LOG_ABORT("Accelerator fails to compute correct 64 bytes OR"); @@ -174,8 +174,8 @@ verifyAnd64(const IAccelrated & accel, const std::vector> simpleAndWith(expected, optionallyInvert(vRefs[j].second, vectors[j])); } - uint64_t dest[32] __attribute((aligned(64))); - accel.and256(offset * sizeof(uint64_t), vRefs, dest); + uint64_t dest[8] __attribute((aligned(64))); + accel.and64(offset*sizeof(uint64_t), vRefs, dest); int diff = memcmp(&expected[offset], dest, sizeof(dest)); if (diff != 0) { LOG_ABORT("Accelerator fails to compute correct 64 bytes AND"); @@ -186,9 +186,9 @@ void verifyOr64(const IAccelrated & accel) { std::vector> vectors(3) ; for (auto & v : vectors) { - fill(v, 64); + fill(v, 16); } - for (size_t offset = 0; offset < 32; offset++) { + for (size_t offset = 0; offset < 8; offset++) { for (size_t i = 1; i < vectors.size(); i++) { verifyOr64(accel, vectors, offset, i, false); verifyOr64(accel, vectors, offset, i, true); @@ -200,9 +200,9 @@ void verifyAnd64(const IAccelrated & accel) { std::vector> vectors(3); for (auto & v : vectors) { - fill(v, 64); + fill(v, 16); } - for (size_t offset = 0; offset < 32; offset++) { + for (size_t offset = 0; offset < 8; offset++) { for (size_t i = 1; i < vectors.size(); i++) { verifyAnd64(accel, vectors, offset, i, false); verifyAnd64(accel, vectors, offset, i, true); diff --git a/vespalib/src/vespa/vespalib/hwaccelrated/iaccelrated.h b/vespalib/src/vespa/vespalib/hwaccelrated/iaccelrated.h index e6bd86957db..806e77caced 100644 --- a/vespalib/src/vespa/vespalib/hwaccelrated/iaccelrated.h +++ b/vespalib/src/vespa/vespalib/hwaccelrated/iaccelrated.h @@ -31,10 +31,10 @@ public: virtual double squaredEuclideanDistance(const int8_t * a, const int8_t * b, size_t sz) const noexcept = 0; virtual double squaredEuclideanDistance(const float * a, const float * b, size_t sz) const noexcept = 0; virtual double squaredEuclideanDistance(const double * a, const double * b, size_t sz) const noexcept = 0; - // AND 256 bytes from multiple, optionally inverted sources - virtual void and256(size_t offset, const std::vector> &src, void *dest) const noexcept = 0; - // OR 256 bytes from multiple, optionally inverted sources - virtual void or256(size_t offset, const std::vector> &src, void *dest) const noexcept = 0; + // AND 64 bytes from multiple, optionally inverted sources + virtual void and64(size_t offset, const std::vector> &src, void *dest) const noexcept = 0; + // OR 64 bytes from multiple, optionally inverted sources + virtual void or64(size_t offset, const std::vector> &src, void *dest) const noexcept = 0; static const IAccelrated & getAccelerator() __attribute__((noinline)); }; diff --git a/vespalib/src/vespa/vespalib/hwaccelrated/private_helpers.hpp b/vespalib/src/vespa/vespalib/hwaccelrated/private_helpers.hpp index 3185d6e77cd..c884f0d7bb9 100644 --- a/vespalib/src/vespa/vespalib/hwaccelrated/private_helpers.hpp +++ b/vespalib/src/vespa/vespalib/hwaccelrated/private_helpers.hpp @@ -43,7 +43,7 @@ void andChunks(size_t offset, const std::vector> & src, void * dest) { typedef uint64_t Chunk __attribute__ ((vector_size (ChunkSize))); static_assert(sizeof(Chunk) == ChunkSize, "sizeof(Chunk) == ChunkSize"); - static_assert(ChunkSize*Chunks == 256, "ChunkSize*Chunks == 256"); + static_assert(ChunkSize*Chunks == 64, "ChunkSize*Chunks == 64"); Chunk * chunk = static_cast(dest); const Chunk * tmp = cast(src[0].first, offset); for (size_t n=0; n < Chunks; n++) { @@ -62,7 +62,7 @@ void orChunks(size_t offset, const std::vector> & src, void * dest) { typedef uint64_t Chunk __attribute__ ((vector_size (ChunkSize))); static_assert(sizeof(Chunk) == ChunkSize, "sizeof(Chunk) == ChunkSize"); - static_assert(ChunkSize*Chunks == 256, "ChunkSize*Chunks == 256"); + static_assert(ChunkSize*Chunks == 64, "ChunkSize*Chunks == 64"); Chunk * chunk = static_cast(dest); const Chunk * tmp = cast(src[0].first, offset); for (size_t n=0; n < Chunks; n++) { -- cgit v1.2.3