tetl 0.1.0
Embedded Template Library
Loading...
Searching...
No Matches
hardware_interference_size.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSL-1.0
2// SPDX-FileCopyrightText: Copyright (C) 2021 Tobias Hienzsch
3
4#ifndef TETL_NEW_HARDWARE_INTERFERENCE_SIZE_HPP
5#define TETL_NEW_HARDWARE_INTERFERENCE_SIZE_HPP
6
7#include <etl/_cstddef/max_align_t.hpp>
8
9/// Cache line sizes for ARM values are not strictly correct since cache
10/// line sizes depend on implementations, not architectures. There are even
11/// implementations with cache line sizes configurable at boot time.
12#if defined(__aarch64__)
13 #define TETL_CACHELINE_SIZE 64
14#elif defined(__ARM_ARCH_5T__)
15 #define TETL_CACHELINE_SIZE 32
16#elif defined(__ARM_ARCH_7A__)
17 #define TETL_CACHELINE_SIZE 64
18#elif defined(__PPC64__)
19 #define TETL_CACHELINE_SIZE 128
20#elif defined(__i386__) || defined(__x86_64__)
21 #define TETL_CACHELINE_SIZE 64
22#else
23 #define TETL_CACHELINE_SIZE alignof(max_align_t)
24#endif
25
26namespace etl {
27
28/// \brief Minimum offset between two objects to avoid false sharing. Guaranteed
29/// to be at least alignof(max_align_t).
31
32/// \brief Maximum size of contiguous memory to promote true sharing. Guaranteed
33/// to be at least alignof(max_align_t).
35
36} // namespace etl
37
38#endif // TETL_NEW_HARDWARE_INTERFERENCE_SIZE_HPP
Definition adjacent_find.hpp:9
constexpr auto hardware_constructive_interference_size
Minimum offset between two objects to avoid false sharing. Guaranteed to be at least alignof(max_alig...
Definition hardware_interference_size.hpp:30
constexpr auto hardware_destructive_interference_size
Maximum size of contiguous memory to promote true sharing. Guaranteed to be at least alignof(max_alig...
Definition hardware_interference_size.hpp:34