-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes, move spinlock to cc, minor changes #42
base: develop
Are you sure you want to change the base?
Conversation
::DWORD length = 0; | ||
std::byte buffer_stack[4096]; | ||
cc::array<std::byte> buffer_heap; | ||
DWORD buffer_length = CC_COUNTOF(buffer_stack); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hm, could we think about renaming CC_COUNTOF? it's a bit too short and ambiguous for my tastes. especially for something that is actually not used that often
@@ -16,6 +16,9 @@ | |||
|
|||
#include <task-dispatcher/common/system_info.hh> | |||
|
|||
// the size of a task in cachelines (= 64B) | |||
#define TD_FIXED_TASK_SIZE 2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is not really public api, right? and does it have to be a macro? a detail:: constexpr/enum value might be a better fit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, was thinking of making it a CMake exposed option at the time but an enum val is just as good for now
src/task-dispatcher/scheduler.cc
Outdated
@@ -102,7 +101,7 @@ struct Scheduler::worker_thread_t | |||
// same restrictions as for _resumable_fibers apply (worker_fiber_t::is_waiting_cleaned_up) | |||
resumable_fiber_mpsc_queue pinned_resumable_fibers = {}; | |||
// note that this queue uses a spinlock instead of being lock free (TODO) | |||
SpinLock pinned_resumable_fibers_lock = {}; | |||
cc::spin_lock pinned_resumable_fibers_lock = {}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why the = {}
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Redundant
src/task-dispatcher/td-lean.hh
Outdated
batch < num_batches; // | ||
++batch, start = batch * batch_size, end = cc::min((batch + 1) * batch_size, num_elements)) | ||
{ | ||
tasks[batch].lambda([=] { func(start, end, batch); }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this by design that the func is copied?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, the task is persisted, the original lambda will be dead once it's executed
cc::spin_lock
)num_physical_cores