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 @@ ...@@ -22,8 +22,10 @@
#include <glog/logging.h> #include <glog/logging.h>
#include <folly/ConstexprMath.h>
#include <folly/concurrency/CacheLocality.h> #include <folly/concurrency/CacheLocality.h>
#include <folly/experimental/hazptr/hazptr.h> #include <folly/experimental/hazptr/hazptr.h>
#include <folly/lang/Align.h>
#include <folly/synchronization/SaturatingSemaphore.h> #include <folly/synchronization/SaturatingSemaphore.h>
namespace folly { namespace folly {
...@@ -197,7 +199,7 @@ template < ...@@ -197,7 +199,7 @@ template <
bool SingleConsumer, bool SingleConsumer,
bool MayBlock, bool MayBlock,
size_t LgSegmentSize = 8, size_t LgSegmentSize = 8,
size_t LgAlign = 7, size_t LgAlign = constexpr_log2(hardware_destructive_interference_size),
template <typename> class Atom = std::atomic> template <typename> class Atom = std::atomic>
class UnboundedQueue { class UnboundedQueue {
using Ticket = uint64_t; using Ticket = uint64_t;
...@@ -724,7 +726,7 @@ template < ...@@ -724,7 +726,7 @@ template <
typename T, typename T,
bool MayBlock, bool MayBlock,
size_t LgSegmentSize = 8, size_t LgSegmentSize = 8,
size_t LgAlign = 7, size_t LgAlign = constexpr_log2(hardware_destructive_interference_size),
template <typename> class Atom = std::atomic> template <typename> class Atom = std::atomic>
using USPSCQueue = using USPSCQueue =
UnboundedQueue<T, true, true, MayBlock, LgSegmentSize, LgAlign, Atom>; UnboundedQueue<T, true, true, MayBlock, LgSegmentSize, LgAlign, Atom>;
...@@ -733,7 +735,7 @@ template < ...@@ -733,7 +735,7 @@ template <
typename T, typename T,
bool MayBlock, bool MayBlock,
size_t LgSegmentSize = 8, size_t LgSegmentSize = 8,
size_t LgAlign = 7, size_t LgAlign = constexpr_log2(hardware_destructive_interference_size),
template <typename> class Atom = std::atomic> template <typename> class Atom = std::atomic>
using UMPSCQueue = using UMPSCQueue =
UnboundedQueue<T, false, true, MayBlock, LgSegmentSize, LgAlign, Atom>; UnboundedQueue<T, false, true, MayBlock, LgSegmentSize, LgAlign, Atom>;
...@@ -742,7 +744,7 @@ template < ...@@ -742,7 +744,7 @@ template <
typename T, typename T,
bool MayBlock, bool MayBlock,
size_t LgSegmentSize = 8, size_t LgSegmentSize = 8,
size_t LgAlign = 7, size_t LgAlign = constexpr_log2(hardware_destructive_interference_size),
template <typename> class Atom = std::atomic> template <typename> class Atom = std::atomic>
using USPMCQueue = using USPMCQueue =
UnboundedQueue<T, true, false, MayBlock, LgSegmentSize, LgAlign, Atom>; UnboundedQueue<T, true, false, MayBlock, LgSegmentSize, LgAlign, Atom>;
...@@ -751,7 +753,7 @@ template < ...@@ -751,7 +753,7 @@ template <
typename T, typename T,
bool MayBlock, bool MayBlock,
size_t LgSegmentSize = 8, size_t LgSegmentSize = 8,
size_t LgAlign = 7, size_t LgAlign = constexpr_log2(hardware_destructive_interference_size),
template <typename> class Atom = std::atomic> template <typename> class Atom = std::atomic>
using UMPMCQueue = using UMPMCQueue =
UnboundedQueue<T, false, false, MayBlock, LgSegmentSize, LgAlign, Atom>; 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