-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add a work stealing benchmark * Replace implementation of MPMCQ This replaces the existing queue implementation with a new version that supports dequeue_all. The dequeue_all will be used in a subsequent PR, which will implement a better work stealing algorithm. * Add multiple queues per core This adds a fixed set of queues per core that are used in a round-robin fashion. This allows more efficient stealing, which will be part of the next commit. * Fairness The new stealing mechanism can work with fairness, but works less well. It is more likely that a steal will take the fairness token, and hence we get some less good behaviour.
- Loading branch information
Showing
9 changed files
with
480 additions
and
206 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// Copyright Microsoft and Project Verona Contributors. | ||
// SPDX-License-Identifier: MIT | ||
#pragma once | ||
|
||
#include <cstddef> | ||
|
||
// WrapIndex is a simple class that wraps around an index. | ||
template<size_t N> | ||
class WrapIndex | ||
{ | ||
size_t index; | ||
|
||
public: | ||
WrapIndex() : index(0) {} | ||
|
||
// Returns the next index and wraps around. | ||
size_t operator++() | ||
{ | ||
index = (index + 1) % N; | ||
return index; | ||
} | ||
|
||
size_t operator--(int) | ||
{ | ||
auto result = index; | ||
if (result == 0) | ||
index = N - 1; | ||
else | ||
index--; | ||
return result; | ||
} | ||
|
||
operator size_t() const | ||
{ | ||
return index; | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.