Skip to content
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

Merged
merged 107 commits into from Aug 5, 2022
Merged

Lums/sc 18061/combined #3366

merged 107 commits into from Aug 5, 2022

Conversation

lums658
Copy link
Contributor

@lums658 lums658 commented Jul 14, 2022

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 and DataBlock allocator. The allocator is a simple
pool (free list) allocator of fixed-size chunks of bytes. A DataBlock is a
container 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 and Sink ports, which are the primary data structures
for 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 DataBlocks we implemented a join view, which is
similar to std::ranges::join_view. In anticipation of future lightweight synchronization needs
in 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 to Source and Sink.

ihnorton and others added 30 commits June 23, 2022 14:30
@shortcut-integration
Copy link

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
Copy link
Member

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.
Copy link
Member

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};
Copy link
Member

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>;
Copy link
Member

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.

@ihnorton ihnorton merged commit de7eafb into dev Aug 5, 2022
@ihnorton ihnorton deleted the lums/sc-18061/combined branch August 5, 2022 02:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants