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

1899 Improve performance of Runnable and surrounding machinery #1963

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
852db4b
#1899: context: combine SetContext and FromNode
lifflander Aug 5, 2022
aadcc8c
#1899: context: remove template from collection
lifflander Aug 5, 2022
888e88e
#1899: runnable: store contexts directly instead of using pointers
lifflander Sep 7, 2022
486e858
#1899: runnable: fix TD construct/destruct
lifflander Sep 7, 2022
902a733
#1899: runnable: remove Base class for contexts
lifflander Sep 7, 2022
0192e55
#1899: runnable: allocate through pool
lifflander Sep 7, 2022
2111af5
#1899: runnable: use raw pointer for RunnableNew
lifflander Sep 7, 2022
3d03ee5
#1899: runnable: fix linking problem
lifflander Sep 12, 2022
f7dbca2
#1899: runnable: switch to bare pointer
lifflander Sep 12, 2022
9f99fe3
#1899: registry: completely remove old manual registry
lifflander Sep 12, 2022
a2812e0
#1899: runnable: remove tag as a runnable parameter
lifflander Sep 12, 2022
ca3c4b5
#1899: active: fix debug print
lifflander Sep 12, 2022
bc52656
#1899: runnable: make message const& in builder
lifflander Sep 14, 2022
1866bba
#1899: runnable: disable more fcontext code when compile-time disabled
lifflander Sep 14, 2022
53e6512
#1899: runnable: do not reference message to enqueue
lifflander Sep 14, 2022
4473309
#1899: td: disable suspended epochs when fcontext is disabled
lifflander Sep 14, 2022
77b053b
#1899: td: take message by const&
lifflander Sep 14, 2022
892c29a
#1899: scheduler: don't transition to idle right away
lifflander Sep 14, 2022
087d68e
#1899: scheduler: fix bad rebase with endif
lifflander Sep 20, 2022
3b3d77d
#1899: runnable: add missing getter for trace context
lifflander Sep 20, 2022
7fbf2d2
#1899: runnable: fix missing endif from merge
lifflander Sep 22, 2022
b54d08e
#1899: runnable: fix double free
lifflander Sep 26, 2022
cdd8cf0
#1899: runnable: stop accessing msg_ if const& is invalid
lifflander Sep 26, 2022
69fb406
#1899: runnable: add missing end for continuation causing leak
lifflander Sep 26, 2022
aba1bbc
#1899: envelope: fix bug with lack of epoch propagation on put messages
lifflander Sep 26, 2022
ba19bad
#1899: TD: make testEpochTerminated print verbose (mis-marked)
lifflander Sep 26, 2022
8568fb7
#1899: runnable: try moving trace context section up to fix Mac bug
lifflander Sep 27, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions docs/md/registry.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
\page registry Registry
\brief Registered handlers

The registry component `vt::registry::Registry`, accessed via
`vt::theRegistry()` holds type-safe active handlers for execution across a
distributed machine.

- The \ref active-messenger uses the registry to store/dispatch active
function and active functor handlers.
- The \ref objgroup uses the registry to store/dispatch active member
Expand Down
5 changes: 0 additions & 5 deletions src/vt/collective/collective_ops.cc
Original file line number Diff line number Diff line change
Expand Up @@ -334,11 +334,6 @@ void CollectiveAnyOps<instance>::output(
}
}

template <runtime::RuntimeInstType instance>
HandlerType CollectiveAnyOps<instance>::registerHandler(ActiveClosureFnType fn) {
return theRegistry()->registerActiveHandler(fn);
}

template struct CollectiveAnyOps<collective_default_inst>;

} /* end namespace vt */
3 changes: 0 additions & 3 deletions src/vt/collective/collective_ops.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
#include "vt/config.h"
#include "vt/context/context.h"
#include "vt/runtime/runtime_headers.h"
#include "vt/registry/registry.h"

#include <string>

Expand Down Expand Up @@ -77,8 +76,6 @@ struct CollectiveAnyOps {
bool error = false, bool decorate = true, bool formatted = false,
bool abort_out = false
);

static HandlerType registerHandler(ActiveClosureFnType fn);
};

using CollectiveOps = CollectiveAnyOps<collective_default_inst>;
Expand Down
1 change: 0 additions & 1 deletion src/vt/collective/reduce/reduce.impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@

#include "vt/config.h"
#include "vt/collective/collective_alg.h"
#include "vt/registry/registry.h"
#include "vt/registry/auto/auto_registry_interface.h"
#include "vt/messaging/active.h"
#include "vt/messaging/message.h"
Expand Down
4 changes: 2 additions & 2 deletions src/vt/context/context.cc
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
*/

#include "vt/context/context.h"
#include "vt/context/runnable_context/from_node.h"
#include "vt/context/runnable_context/set_context.h"

#if vt_check_enabled(trace_only)
namespace vt { namespace runnable {
Expand Down Expand Up @@ -111,7 +111,7 @@ void Context::setTask(runnable::RunnableNew* in_task) {
NodeType Context::getFromNodeCurrentTask() const {
#if !vt_check_enabled(trace_only)
if (getTask() != nullptr) {
auto from = getTask()->get<ctx::FromNode>();
auto from = getTask()->get<ctx::SetContext>();
if (from != nullptr) {
return from->get();
}
Expand Down
107 changes: 0 additions & 107 deletions src/vt/context/runnable_context/base.h

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//@HEADER
// *****************************************************************************
//
// from_node.h
// collection.cc
// DARMA/vt => Virtual Transport
//
// Copyright 2019-2021 National Technology & Engineering Solutions of Sandia, LLC
Expand Down Expand Up @@ -41,41 +41,24 @@
//@HEADER
*/

#if !defined INCLUDED_VT_CONTEXT_RUNNABLE_CONTEXT_FROM_NODE_H
#define INCLUDED_VT_CONTEXT_RUNNABLE_CONTEXT_FROM_NODE_H

#include "vt/context/runnable_context/base.h"
#include "vt/context/runnable_context/collection.h"

namespace vt { namespace ctx {

/**
* \struct FromNode
*
* \brief Get the node that instigated the current task running. Typically the
* logical node that caused an handler or event to run.
*/
struct FromNode final : Base {
void Collection::begin() {
set_();
}

/**
* \brief Construct a \c FromNode
*
* \param[in] in_node the node
*/
explicit FromNode(NodeType const in_node)
: node_(in_node)
{ }
void Collection::end() {
clear_();
}

/**
* \brief Get the node that instigated the current task
*
* \return the node
*/
NodeType get() const { return node_; }
void Collection::suspend() {
end();
}

private:
NodeType node_ = uninitialized_destination; /**< The from node */
};
void Collection::resume() {
begin();
}

}} /* end namespace vt::ctx */

#endif /*INCLUDED_VT_CONTEXT_RUNNABLE_CONTEXT_FROM_NODE_H*/
20 changes: 11 additions & 9 deletions src/vt/context/runnable_context/collection.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
#if !defined INCLUDED_VT_CONTEXT_RUNNABLE_CONTEXT_COLLECTION_H
#define INCLUDED_VT_CONTEXT_RUNNABLE_CONTEXT_COLLECTION_H

#include "vt/context/runnable_context/base.h"
#include <functional>

namespace vt { namespace vrt { namespace collection {

Expand All @@ -61,32 +61,34 @@ namespace vt { namespace ctx {
* \brief Context for a collection element that is running. Includes the index
* and proxy for the collection.
*/
template <typename IndexT>
struct Collection final : Base {
struct Collection {

Collection() = default;

/**
* \brief Construct a \c Collection
*
* \param[in] elm the collection element to extract the index and proxy
*/
template <typename IndexT>
explicit Collection(vrt::collection::Indexable<IndexT>* elm);

/**
* \brief Set the collection context
*/
void begin() final override;
void begin();

/**
* \brief Remove the collection context
*/
void end() final override;
void end();

void suspend() final override;
void resume() final override;
void suspend();
void resume();

private:
IndexT idx_ = {}; /**< the collection element index */
VirtualProxyType proxy_ = no_vrt_proxy; /**< the collection proxy */
std::function<void()> set_; /**< Set context function */
std::function<void()> clear_; /**< Clear context function */
};

}} /* end namespace vt::ctx */
Expand Down
33 changes: 10 additions & 23 deletions src/vt/context/runnable_context/collection.impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,30 +51,17 @@
namespace vt { namespace ctx {

template <typename IndexT>
/*explicit*/ Collection<IndexT>::Collection(
/*explicit*/ Collection::Collection(
vrt::collection::Indexable<IndexT>* elm
) : idx_(elm->getIndex()),
proxy_(elm->getProxy())
{ }

template <typename IndexT>
void Collection<IndexT>::begin() {
vrt::collection::CollectionContextHolder<IndexT>::set(&idx_, proxy_);
}

template <typename IndexT>
void Collection<IndexT>::end() {
vrt::collection::CollectionContextHolder<IndexT>::clear();
}

template <typename IndexT>
void Collection<IndexT>::suspend() {
end();
}

template <typename IndexT>
void Collection<IndexT>::resume() {
begin();
) {
auto idx_ = elm->getIndex();
auto proxy_ = elm->getProxy();
set_ = [=]{
vrt::collection::CollectionContextHolder<IndexT>::set(&idx_, proxy_);
};
clear_ = []{
vrt::collection::CollectionContextHolder<IndexT>::clear();
};
}

}} /* end namespace vt::ctx */
Expand Down
8 changes: 4 additions & 4 deletions src/vt/context/runnable_context/continuation.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,16 @@
#if !defined INCLUDED_VT_CONTEXT_RUNNABLE_CONTEXT_CONTINUATION_H
#define INCLUDED_VT_CONTEXT_RUNNABLE_CONTEXT_CONTINUATION_H

#include "vt/context/runnable_context/base.h"

namespace vt { namespace ctx {

/**
* \struct Continuation
*
* \brief A continuation that runs after a task is complete.
*/
struct Continuation final : Base {
struct Continuation {

Continuation() = default;

/**
* \brief Construct a \c Continuation
Expand All @@ -67,7 +67,7 @@ struct Continuation final : Base {
/**
* \brief After the task runs, invoke the continuation if non-null
*/
void end() final override {
void end() {
if (cont_) {
cont_();
}
Expand Down
Loading