Skip to content

Commit 1d6c33d

Browse files
Nicoshevfacebook-github-bot
authored andcommitted
Enable hardware accelerated crc32c for ARM on Linux (#13432)
Summary: Pull Request resolved: #13432 We've noticed the default CRC32c function gets executed when running on aarch64 cpus within our servers Issue is that ROCKSDB_AUXV_GETAUXVAL_PRESENT evaluates to false This fix allows the usage of hardware-accelerated crc32 within our fleet Reviewed By: jaykorean Differential Revision: D70423483 fbshipit-source-id: 601da3fbf156e3e40695eb76ee5d37f67f83d427
1 parent ebaeb03 commit 1d6c33d

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

util/crc32c_arm64.cc

+7-5
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#if defined(__linux__)
1111
#include <asm/hwcap.h>
1212
#endif
13-
#ifdef ROCKSDB_AUXV_GETAUXVAL_PRESENT
13+
#if defined(ROCKSDB_AUXV_GETAUXVAL_PRESENT) || defined(__linux__)
1414
#include <sys/auxv.h>
1515
#endif
1616
#ifndef HWCAP_CRC32
@@ -52,9 +52,10 @@
5252
extern bool pmull_runtime_flag;
5353

5454
uint32_t crc32c_runtime_check(void) {
55-
#if defined(ROCKSDB_AUXV_GETAUXVAL_PRESENT) || defined(__FreeBSD__)
55+
#if defined(ROCKSDB_AUXV_GETAUXVAL_PRESENT) || defined(__FreeBSD__) || \
56+
defined(__linux__)
5657
uint64_t auxv = 0;
57-
#if defined(ROCKSDB_AUXV_GETAUXVAL_PRESENT)
58+
#if defined(ROCKSDB_AUXV_GETAUXVAL_PRESENT) || defined(__linux__)
5859
auxv = getauxval(AT_HWCAP);
5960
#elif defined(__FreeBSD__)
6061
elf_aux_info(AT_HWCAP, &auxv, sizeof(auxv));
@@ -81,9 +82,10 @@ uint32_t crc32c_runtime_check(void) {
8182
}
8283

8384
bool crc32c_pmull_runtime_check(void) {
84-
#if defined(ROCKSDB_AUXV_GETAUXVAL_PRESENT) || defined(__FreeBSD__)
85+
#if defined(ROCKSDB_AUXV_GETAUXVAL_PRESENT) || defined(__FreeBSD__) || \
86+
defined(__linux__)
8587
uint64_t auxv = 0;
86-
#if defined(ROCKSDB_AUXV_GETAUXVAL_PRESENT)
88+
#if defined(ROCKSDB_AUXV_GETAUXVAL_PRESENT) || defined(__linux__)
8789
auxv = getauxval(AT_HWCAP);
8890
#elif defined(__FreeBSD__)
8991
elf_aux_info(AT_HWCAP, &auxv, sizeof(auxv));

0 commit comments

Comments
 (0)