summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Benjamin Barenblat <bbaren@google.com>2022-12-08 10:59:50 -0800
committerGravatar Copybara-Service <copybara-worker@google.com>2022-12-08 11:00:50 -0800
commitc353e2597f7f24afbcd3bb34753d3e580bcee8ad (patch)
tree81f326f5832392405cb5a60b0bc4f46f2084f2ed
parent523b86994f1e705e27e99cdf6527ec1f010e69d1 (diff)
Eliminate AArch64-specific code paths from LowLevelHash
After internal investigation, it’s no longer clear that the alternative LowLevelHash mixer committed in a05366d851c5cb88065272f951e03955197e7c11 unequivocally improves performance on AArch64. It unnecessarily reduces performance on Apple Silicon and the AWS Graviton. It also lowers hash quality, which offsets much of the performance gain it provides on the Arm Neoverse N1 (see https://github.com/abseil/abseil-cpp/issues/1093). Switch back to the original mixer. Closes: https://github.com/abseil/abseil-cpp/issues/1093 PiperOrigin-RevId: 493941913 Change-Id: I84c789b2f88c91dec22f6f0f6e8c5129d2939a6f
-rw-r--r--absl/hash/BUILD.bazel1
-rw-r--r--absl/hash/CMakeLists.txt1
-rw-r--r--absl/hash/internal/low_level_hash.cc12
-rw-r--r--absl/hash/internal/low_level_hash_test.cc48
4 files changed, 0 insertions, 62 deletions
diff --git a/absl/hash/BUILD.bazel b/absl/hash/BUILD.bazel
index bcc316f9..4a95f054 100644
--- a/absl/hash/BUILD.bazel
+++ b/absl/hash/BUILD.bazel
@@ -157,7 +157,6 @@ cc_library(
deps = [
"//absl/base:config",
"//absl/base:endian",
- "//absl/numeric:bits",
"//absl/numeric:int128",
],
)
diff --git a/absl/hash/CMakeLists.txt b/absl/hash/CMakeLists.txt
index 15691254..0514c296 100644
--- a/absl/hash/CMakeLists.txt
+++ b/absl/hash/CMakeLists.txt
@@ -140,7 +140,6 @@ absl_cc_library(
COPTS
${ABSL_DEFAULT_COPTS}
DEPS
- absl::bits
absl::config
absl::endian
absl::int128
diff --git a/absl/hash/internal/low_level_hash.cc b/absl/hash/internal/low_level_hash.cc
index e05e7885..c917457a 100644
--- a/absl/hash/internal/low_level_hash.cc
+++ b/absl/hash/internal/low_level_hash.cc
@@ -15,7 +15,6 @@
#include "absl/hash/internal/low_level_hash.h"
#include "absl/base/internal/unaligned_access.h"
-#include "absl/numeric/bits.h"
#include "absl/numeric/int128.h"
namespace absl {
@@ -23,20 +22,9 @@ ABSL_NAMESPACE_BEGIN
namespace hash_internal {
static uint64_t Mix(uint64_t v0, uint64_t v1) {
-#if !defined(__aarch64__)
- // The default bit-mixer uses 64x64->128-bit multiplication.
absl::uint128 p = v0;
p *= v1;
return absl::Uint128Low64(p) ^ absl::Uint128High64(p);
-#else
- // The default bit-mixer above would perform poorly on some ARM microarchs,
- // where calculating a 128-bit product requires a sequence of two
- // instructions with a high combined latency and poor throughput.
- // Instead, we mix bits using only 64-bit arithmetic, which is faster.
- uint64_t p = v0 ^ absl::rotl(v1, 40);
- p *= v1 ^ absl::rotl(v0, 39);
- return p ^ (p >> 11);
-#endif
}
uint64_t LowLevelHash(const void* data, size_t len, uint64_t seed,
diff --git a/absl/hash/internal/low_level_hash_test.cc b/absl/hash/internal/low_level_hash_test.cc
index ae930b34..589a3d8f 100644
--- a/absl/hash/internal/low_level_hash_test.cc
+++ b/absl/hash/internal/low_level_hash_test.cc
@@ -452,54 +452,6 @@ TEST(LowLevelHashTest, VerifyGolden) {
0xdd497891465a2cc1, 0x6f1fe8c57a33072e, 0x2c9f4ec078c460c0,
0x9a725bde8f6a1437, 0x6ce545fa3ef61e4d,
};
-#elif defined(__aarch64__)
- constexpr uint64_t kGolden[kNumGoldenOutputs] = {
- 0x45c0aadee165dcbe, 0x25ed8587f6f20d06, 0x5f23ae668ce7926d,
- 0xfef74d1da0846719, 0x54478408e68cb7d4, 0xee27ddaf88c6fe68,
- 0xb7ac7031e81867ca, 0xf1168f818ec6c36d, 0x1dd0b734a83b019a,
- 0xd6ae30d4142b54fe, 0xcd860c721ccb80fb, 0x068acf8493794756,
- 0xd4ada0be58681307, 0x13ffe0f64ca540ed, 0xffc1d7a3401aec02,
- 0xd81c4d865cf95fb9, 0x1dd0793acede62e0, 0xa6722abbca8fe4cf,
- 0x5453d3e4111a7e40, 0xf29b3e3204c9dcd2, 0x23be2980e43117f7,
- 0x74e2ccbc286f08eb, 0x19ef7c0f9496003a, 0xbfbf1c3e49b27987,
- 0x6e6c179eb4a82c70, 0x07f4e184216bc4fc, 0xf17fbc4254927554,
- 0xe57696b70a45b1b6, 0x6d3b144631b320e8, 0xccf8729792c75a2d,
- 0xe832495b41fa980b, 0x5c96cfdc7b227d34, 0xc4dca234ef4e43f4,
- 0x5fc801abf9abe307, 0xe41e3c5076d88f4d, 0x522346200ddec3c3,
- 0x72bed1946fd7aaa4, 0x0ac1f84dcc335f96, 0x3af78db5e0a47670,
- 0x6100ebf1481f1caf, 0xf5fd10037fc651a3, 0xa01227d8944665f3,
- 0x7217681c4bbc9420, 0x4adee538e3eb10d1, 0x35e1761ad96de9a7,
- 0x8b370aef9613bfba, 0x824506f749eeaf59, 0x85e805fa04423991,
- 0xb61e9c33283c3de7, 0xc79721bbcb039ed6, 0x04e1c19a3a1e6639,
- 0x6aaf6346b68dd638, 0x601a4b496be6d0c4, 0x3ece355f91c41787,
- 0xd2fc8998448d7888, 0xd7529804f843efa9, 0xabdcc38a288536aa,
- 0xdd323e48a9718648, 0x2090279c0030a52a, 0xe2f90faca88a3cd1,
- 0x3e0c4e92fc50e4aa, 0xa26d308798e801dd, 0x432eefeedee8c02e,
- 0xca4ce494614b77df, 0xbba82911e838066d, 0x4b00821016adee4b,
- 0x4cf6e526dfb5a20f, 0x5b8466495142cba2, 0xe28ac1406e88a68c,
- 0x8511e5f9d3100999, 0x05acbfe02798890b, 0x74c249c7ce4a8425,
- 0xdbe7468d09bc34bc, 0x11079ab10e3b9b58, 0xb7788dec9032035a,
- 0xb7e8daa786513f80, 0x34c3288831f46b45, 0x014cce5f0c21ecc6,
- 0xc6a8f7b024551a28, 0x49784e902e207fd8, 0x4720d32af0b55158,
- 0x8df3ec5de0c1da00, 0xf4db677b2c9e6853, 0xaa419abea78d312d,
- 0x181e0f91bd757443, 0xa8c45136fada083b, 0x91303b93f5f0582c,
- 0x883b95c6ddc62a08, 0x93186a8875fe952b, 0xd94f533928e957e2,
- 0x6ba343003e10c172, 0xc8623b620c715d6a, 0x8ca0c512e180e244,
- 0xdc9b74c2536b6216, 0x8eb5fdc61b295d96, 0x2ad83966b37c95ba,
- 0xb90bf154ac5edec9, 0x902cf847b326cfb3, 0x7b02d0c0ca7808ca,
- 0x492f310d003ea15f, 0x3eb6497a47c95990, 0x5d46b0ced31428b7,
- 0x081afa67d1986157, 0x043482ec286b20eb, 0xc103c8f18c1a2a53,
- 0xe8e9995a81481e83, 0x6bb3295822bc90b5, 0xeec75297a3fa5672,
- 0x591c8440c4857412, 0x74947f455aaf24ad, 0xcf0e571586ec77a9,
- 0x0c2553ea8c0400ad, 0x380219118066255f, 0x7595adb88b15ebe2,
- 0xb33c00696c64ae23, 0xa143516ddd7c9857, 0x39179af229248d26,
- 0x65d387a6f2ee2079, 0x89f8a9b21cd2f195, 0xbfef032d25df92e6,
- 0x6b7e18a36c69da71, 0x4b3b15f6c28974e6, 0x032a75917f6c544c,
- 0xe3b97ecca6d287cd, 0xa4a563110d3cda81, 0x35e09e8134f4e7f1,
- 0xc9419dd03a9a390e, 0x7b86fae9000fd329, 0x1e044f8d54fe74c3,
- 0x9c4991d7a47e9666, 0xfb485f3a1df4fdb6, 0xb11519969eeb94ff,
- 0x3224ea1c44caeb8d, 0x86570bbd7cc6b80d,
- };
#else
constexpr uint64_t kGolden[kNumGoldenOutputs] = {
0xe5a40d39ab796423, 0x1766974bf7527d81, 0x5c3bbbe230db17a8,