Skip to content

Commit

Permalink
fix CacheLocality under gcc on aarch64 with defaults
Browse files Browse the repository at this point in the history
Summary: By default, gcc on aarch64 uses `std::hardware_destructive_interference_size = 256`. Fix `CacheLocality` to support this value. This could alternatively be tweaked by passing special flags to gcc, but it is simpler to adjust the source file rather than adjust how gcc is invoked when not strictly necessary.

Reviewed By: Orvid

Differential Revision: D68521496

fbshipit-source-id: d5e2cfcaa731961a58622489764e898dbefc2b97
  • Loading branch information
yfeldblum authored and facebook-github-bot committed Jan 23, 2025
1 parent 9a021af commit 9e54a45
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion folly/concurrency/CacheLocality.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,8 @@ class SimpleAllocator {
allocator->freelist_ = ptr;
}

constexpr static size_t kMallocAlign = 128;
constexpr static size_t kMallocAlign =
std::max(size_t(128), hardware_destructive_interference_size);
static_assert(
kMallocAlign % hardware_destructive_interference_size == 0,
"Large allocations should be cacheline-aligned");
Expand Down

0 comments on commit 9e54a45

Please sign in to comment.