Commit dee041f9 authored by Lee Howes's avatar Lee Howes Committed by Facebook Github Bot

Modify default alignment for UnboundedQueue to work correctly on ARM builds.

Summary: The original code provided an unsupported alignment for 32-bit ARM builds. This change makes use of hardware_destructive_interference_size, which represents exactly what the alignment field is used for.

Reviewed By: yfeldblum

Differential Revision: D6782366

fbshipit-source-id: b8e2cdf6a0bafdba96d40d729535646b1f6660df
parent e4bc13ee
......@@ -22,8 +22,10 @@
#include <glog/logging.h>
#include <folly/ConstexprMath.h>
#include <folly/concurrency/CacheLocality.h>
#include <folly/experimental/hazptr/hazptr.h>
#include <folly/lang/Align.h>
#include <folly/synchronization/SaturatingSemaphore.h>
namespace folly {
......@@ -197,7 +199,7 @@ template <
bool SingleConsumer,
bool MayBlock,
size_t LgSegmentSize = 8,
size_t LgAlign = 7,
size_t LgAlign = constexpr_log2(hardware_destructive_interference_size),
template <typename> class Atom = std::atomic>
class UnboundedQueue {
using Ticket = uint64_t;
......@@ -724,7 +726,7 @@ template <
typename T,
bool MayBlock,
size_t LgSegmentSize = 8,
size_t LgAlign = 7,
size_t LgAlign = constexpr_log2(hardware_destructive_interference_size),
template <typename> class Atom = std::atomic>
using USPSCQueue =
UnboundedQueue<T, true, true, MayBlock, LgSegmentSize, LgAlign, Atom>;
......@@ -733,7 +735,7 @@ template <
typename T,
bool MayBlock,
size_t LgSegmentSize = 8,
size_t LgAlign = 7,
size_t LgAlign = constexpr_log2(hardware_destructive_interference_size),
template <typename> class Atom = std::atomic>
using UMPSCQueue =
UnboundedQueue<T, false, true, MayBlock, LgSegmentSize, LgAlign, Atom>;
......@@ -742,7 +744,7 @@ template <
typename T,
bool MayBlock,
size_t LgSegmentSize = 8,
size_t LgAlign = 7,
size_t LgAlign = constexpr_log2(hardware_destructive_interference_size),
template <typename> class Atom = std::atomic>
using USPMCQueue =
UnboundedQueue<T, true, false, MayBlock, LgSegmentSize, LgAlign, Atom>;
......@@ -751,7 +753,7 @@ template <
typename T,
bool MayBlock,
size_t LgSegmentSize = 8,
size_t LgAlign = 7,
size_t LgAlign = constexpr_log2(hardware_destructive_interference_size),
template <typename> class Atom = std::atomic>
using UMPMCQueue =
UnboundedQueue<T, false, false, MayBlock, LgSegmentSize, LgAlign, Atom>;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment