1
0
Fork 0
forked from suyu/suyu
suyu/src
Lioncash c51f8563a6
ring_buffer: Use std::hardware_destructive_interference_size to determine alignment size for avoiding false sharing
MSVC 19.11 (A.K.A. VS 15.3)'s C++ standard library implements P0154R1
(http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0154r1.html)
which defines two new constants within the <new> header, std::hardware_destructive_interference_size
and std::hardware_constructive_interference_size.

std::hardware_destructive_interference_size defines the minimum
recommended offset between two concurrently-accessed objects to avoid
performance degradation due to contention introduced by the
implementation (with the lower-bound being at least alignof(max_align_t)).
In other words, the minimum offset between objects necessary to avoid
false-sharing.

std::hardware_constructive_interference_size on the other hand defines
the maximum recommended size of contiguous memory occupied by two
objects accessed wth temporal locality by concurrent threads (also
defined to be at least alignof(max_align_t)). In other words the maximum
size to promote true-sharing.

So we can simply use this facility to determine the ideal alignment
size. Unfortunately, only MSVC supports this right now, so we need to
enclose it within an ifdef for the time being.
2018-09-18 23:35:57 -04:00
..
audio_core time_stretch: Remove unused <array> include 2018-09-17 15:08:34 -04:00
common ring_buffer: Use std::hardware_destructive_interference_size to determine alignment size for avoiding false sharing 2018-09-18 23:35:57 -04:00
core Merge pull request #1348 from ogniK5377/GetImageSize 2018-09-18 22:15:18 -04:00
input_common Port #4141 from citra: Joystick hotplug support (#1275) 2018-09-10 21:29:59 -04:00
tests Merge pull request #1327 from FearlessTobi/port-4171 2018-09-17 09:54:31 -04:00
video_core Merge pull request #1342 from lioncash/trunc 2018-09-18 22:11:48 -04:00
yuzu Merge pull request #1326 from FearlessTobi/port-4182 2018-09-17 09:51:47 -04:00
yuzu_cmd Invalid default value of username in yuzu_cmd (#1334) 2018-09-18 19:58:28 -04:00
.clang-format Remove special rules for Windows.h and library includes 2016-09-21 00:16:33 -07:00
CMakeLists.txt audio_core: Add initial code for keeping track of audout state. 2018-07-27 22:33:31 -04:00