Skip to content

Commit 21b8886

Browse files
[V4] Fixed capacity deque (#74)
* pop hardware warning * fix shadow warning * doc patch * modernize ring-buffer * comments * fixed-cap dequeue * round to power of 2 * fix tests/benchmark * confirm cdschecker bug fixed * harden empty/size * vet(push): comments * vet(pop): move load to position from rust/paper * stealer API * spell * fix wrong-op
1 parent 24f9365 commit 21b8886

7 files changed

Lines changed: 165 additions & 181 deletions

File tree

benchmark/src/libfork_benchmark/fib/baremetal.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ void fib_recursive_deque(benchmark::State &state) {
139139

140140
state.counters["n"] = static_cast<double>(n);
141141

142-
lf::deque<std::int64_t> deque;
142+
lf::deque<std::int64_t> deque{64};
143143
tls_deque = &deque;
144144

145145
for (auto _ : state) {

benchmark/src/libfork_benchmark/fib/lf_parts.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ struct deque_ctx {
7878

7979
using handle_type = lf::frame_handle<deque_ctx>;
8080

81-
lf::deque<handle_type> work;
81+
lf::deque<handle_type> work{64};
8282
Alloc my_allocator;
8383

8484
auto allocator() noexcept -> Alloc & { return my_allocator; }
@@ -121,7 +121,7 @@ struct poly_deque_ctx final : lf::basic_poly_context<Alloc> {
121121

122122
using handle_type = lf::frame_handle<lf::basic_poly_context<Alloc>>;
123123

124-
lf::deque<handle_type> work;
124+
lf::deque<handle_type> work{64};
125125

126126
void post(lf::await_handle<lf::basic_poly_context<Alloc>>) override {}
127127

src/core/constants.cxx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,15 @@ constexpr std::size_t k_megabyte = 1024 * k_kilobyte;
1010
constexpr std::uint32_t k_u16_max = std::numeric_limits<std::uint16_t>::max();
1111

1212
export constexpr std::size_t k_new_align = __STDCPP_DEFAULT_NEW_ALIGNMENT__;
13-
export constexpr std::size_t k_cache_line = std::hardware_destructive_interference_size;
1413
export constexpr std::size_t k_page_size = 4096; // 4 KiB on most systems.
1514

15+
#if defined(__GNUC__) && !defined(__clang__) && !defined(__INTEL_COMPILER)
16+
#pragma GCC diagnostic push
17+
#pragma GCC diagnostic ignored "-Winterference-size"
18+
#endif // #ifdef __GNUC__
19+
export constexpr std::size_t k_cache_line = std::hardware_destructive_interference_size;
20+
#if defined(__GNUC__) && !defined(__clang__) && !defined(__INTEL_COMPILER)
21+
#pragma GCC diagnostic pop
22+
#endif // #ifdef __GNUC__
23+
1624
} // namespace lf

0 commit comments

Comments
 (0)