22
22
#include < cstdlib>
23
23
#include < iostream>
24
24
#include < limits>
25
- #include < tuple >
25
+ #include < optional >
26
26
#include < vector>
27
27
#include < algorithm>
28
- #include < mutex>
29
- #include < queue>
30
- #include < random>
31
28
#include < atomic>
32
29
#include < cassert>
33
- #include < boost/optional.hpp>
34
- #include < boost/align/aligned_allocator.hpp>
35
30
#include " d_ary_heap.tpp"
36
31
37
32
#define CACHELINE 64
@@ -68,8 +63,12 @@ class MultiQueueIO {
68
63
} __attribute__((aligned (CACHELINE)));
69
64
70
65
std::vector<
71
- PQContainer,
72
- boost::alignment::aligned_allocator<PQContainer, CACHELINE>
66
+ PQContainer
67
+ // FIXME: Disabled this due to VTR not using Boost. There is a C++ way
68
+ // of doing this, but it requires making an aligned allocator
69
+ // class. May be a good idea to add to VTR util in the future.
70
+ // Should profile for performance first; may not be worth it.
71
+ // , boost::alignment::aligned_allocator<PQContainer, CACHELINE>
73
72
> queues;
74
73
uint64_t NUM_QUEUES;
75
74
@@ -181,7 +180,7 @@ class MultiQueueIO {
181
180
#ifdef PERF
182
181
boost::optional<PQElement> __attribute__ ((noinline)) tryPop () {
183
182
#else
184
- inline boost ::optional<PQElement> tryPop () {
183
+ inline std ::optional<PQElement> tryPop () {
185
184
#endif
186
185
auto item = pop ();
187
186
if (item) return item;
@@ -191,7 +190,7 @@ class MultiQueueIO {
191
190
do {
192
191
item = pop ();
193
192
if (item) break ;
194
- if (num >= threadNum) return boost::none ;
193
+ if (num >= threadNum) return {} ;
195
194
196
195
num = numIdle.load (std::memory_order_relaxed);
197
196
@@ -212,7 +211,7 @@ class MultiQueueIO {
212
211
#ifdef PERF
213
212
boost::optional<PQElement> __attribute__ ((noinline)) pop () {
214
213
#else
215
- inline boost ::optional<PQElement> pop () {
214
+ inline std ::optional<PQElement> pop () {
216
215
#endif
217
216
uint64_t poppingQueue = NUM_QUEUES;
218
217
while (true ) {
@@ -270,13 +269,13 @@ class MultiQueueIO {
270
269
}
271
270
q.unlock ();
272
271
}
273
- return boost::none ;
272
+ return {} ;
274
273
}
275
274
276
275
#ifdef PERF
277
276
boost::optional<uint64_t > __attribute__ ((noinline)) tryPopBatch (PQElement* ret) {
278
277
#else
279
- inline boost ::optional<uint64_t > tryPopBatch (PQElement* ret) {
278
+ inline std ::optional<uint64_t > tryPopBatch (PQElement* ret) {
280
279
#endif
281
280
auto item = popBatch (ret);
282
281
if (item) return item;
@@ -286,7 +285,7 @@ class MultiQueueIO {
286
285
do {
287
286
item = popBatch (ret);
288
287
if (item) break ;
289
- if (num >= threadNum) return boost::none ;
288
+ if (num >= threadNum) return {} ;
290
289
291
290
num = numIdle.load (std::memory_order_relaxed);
292
291
@@ -308,7 +307,7 @@ class MultiQueueIO {
308
307
#ifdef PERF
309
308
boost::optional<uint64_t > __attribute__ ((noinline)) popBatch (PQElement* ret) {
310
309
#else
311
- inline boost ::optional<uint64_t > popBatch (PQElement* ret) {
310
+ inline std ::optional<uint64_t > popBatch (PQElement* ret) {
312
311
#endif
313
312
uint64_t poppingQueue = NUM_QUEUES;
314
313
while (true ) {
@@ -367,7 +366,7 @@ class MultiQueueIO {
367
366
368
367
return num;
369
368
}
370
- return boost::none ;
369
+ return {} ;
371
370
}
372
371
373
372
inline uint64_t getQueueOccupancy () const {
0 commit comments