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
Lums/sc 18061/combined #3366
Lums/sc 18061/combined #3366
Conversation
… verify unit tests.
…ent allocators [skip ci]
This pull request has been linked to Shortcut Story #18061: Implement DataBlockAllocator for Core task graph. |
/** | ||
* @todo Use proper checks for preprocessor directives to selectively include | ||
* test with `std::execution` policy. | ||
*/ | ||
#if 0 |
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.
Can we remove this in order to get testing on all platforms?
* Data chunks will be aligned to page boundaries. | ||
* Assumed to be 4k. | ||
* | ||
* @todo Determine page size at compile-time for the target architecture. |
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.
(minor aside: I believe this is not arch-specific, at least on linux, with "huge pages" support)
@@ -70,7 +74,8 @@ class generator { | |||
template <class Block, class StateMachine> | |||
class ProducerNode : public Source<Block, StateMachine> { | |||
using Base = Source<Block, StateMachine>; | |||
std::atomic<size_t> i_{0}; | |||
// This causes initialization problems | |||
// std::atomic<size_t> i_{0}; |
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.
Do we need this for correctness?
* storage as a `shared_ptr<std::byte>`. | ||
*/ | ||
using storage_t = std::shared_ptr<std::byte>; | ||
using span_t = tcb::span<std::byte>; |
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.
nit: existing code is using span
without namespace.
This PR includes updates (and/or implementations) for sc-18059, sc-18060, and sc-18061. (There was some trouble with rebasing during this PR, so there appear to be many more commits than there actually were -- there are many apparent duplicates.)
The PR includes the following files (omitting CMakeLists.txt and various trivial files):
data_block
├── data_block.cc
├── data_block.h
├── pool_allocator.cc
├── pool_allocator.h
└── test
├── unit_data_block.cc
├── unit_data_block.h
├── unit_pool_allocator.cc
└── unit_pool_allocator.h
Implementation of
DataBlock
andDataBlock
allocator. The allocator is a simplepool (free list) allocator of fixed-size chunks of bytes. A
DataBlock
is acontainer that has a
shared_ptr
to a single chunk.ports
├── fsm.cc
├── fsm.h
├── fsm.md
├── policies.h
├── ports.cc
├── ports.h
├── sink_state_machine.svg
├── source_state_machine.svg
└── test
├── helpers.h
├── pseudo_nodes.cc
├── pseudo_nodes.h
├── unit_concurrency.cc
├── unit_concurrency.h
├── unit_fsm.cc
├── unit_fsm.h
├── unit_ports.cc
├── unit_ports.h
├── unit_pseudo_nodes.cc
└── unit_pseudo_nodes.h
Implementation of the
Source
andSink
ports, which are the primary data structuresfor transferring data between nodes in the task graph. The transfer is controlled by
a finite state machine (defined in fsm.h and documented in fsm.md). Unit tests
include tests for the state maching, for the ports themselves, and for the use of
ports in a very rudimentary task graph setting. For these latter tests we use "pseudo
nodes", which are also tested. Also included are unit tests to verify that execution
of pseudo nodes does in fact occur concurrently.
utils
├── range_join.cc
├── range_join.h
├── spinlock.cc
├── spinlock.h
└── test
├── unit_range_join.cc
└── unit_spinlock.cc
We needed a few utilities for implementing the classes above. To create single
contiguous views of multiple
DataBlock
s we implemented ajoin
view, which issimilar to
std::ranges::join_view
. In anticipation of future lightweight synchronization needsin scheduling, we also implemented a spin lock (or, really, a spin mutex, which can be
locked with
std::lock_guard
, etc.). Also included are unit tests for both.TYPE: FEATURE
DESC: Implementation of
DataBlock
,DataBlock
allocator,join
view, and updates toSource
andSink
.