-
Notifications
You must be signed in to change notification settings - Fork 9
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
#2092: Runtime optimizations stage 3 #2093
base: develop
Are you sure you want to change the base?
Changes from all commits
9e01957
ea06303
3c805d8
58d0cfd
eabfece
51e14d9
a52ad25
f6887f4
47d4c11
ea30a6f
341fba0
6675e49
85f8124
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -67,19 +67,18 @@ struct RunnableMaker { | |
* \internal \brief Construct the builder. Shall not be called directly. | ||
* | ||
* \param[in] in_impl the runnable | ||
* \param[in] in_msg the associated message | ||
* \param[in] in_has_msg whether we have a message | ||
* \param[in] in_handler the handler | ||
* \param[in] in_han_type the type of handler | ||
* \param[in] in_from_node the from node for the runnable | ||
*/ | ||
RunnableMaker( | ||
RunnableNew* in_impl, MsgSharedPtr<MsgT> const& in_msg, | ||
RunnableNew* in_impl, bool in_has_msg, | ||
HandlerType in_handler, NodeType in_from_node | ||
) : impl_(in_impl), | ||
msg_(in_msg), | ||
has_msg_(in_has_msg), | ||
handler_(in_handler), | ||
from_node_(in_from_node), | ||
has_msg_(in_msg != nullptr) | ||
from_node_(in_from_node) | ||
{ } | ||
RunnableMaker(RunnableMaker const&) = delete; | ||
RunnableMaker(RunnableMaker&&) = default; | ||
|
@@ -119,7 +118,7 @@ struct RunnableMaker { | |
RunnableMaker&& withTDEpochFromMsg(bool is_term = false) { | ||
is_term_ = is_term; | ||
if (not is_term) { | ||
impl_->addContextTD(msg_); | ||
impl_->addContextTD(impl_->getMsg()); | ||
} | ||
return std::move(*this); | ||
} | ||
|
@@ -219,7 +218,7 @@ struct RunnableMaker { | |
template <typename ElmT> | ||
RunnableMaker&& withLBData(ElmT* elm) { | ||
#if vt_check_enabled(lblite) | ||
impl_->addContextLB(elm, msg_.get()); | ||
impl_->addContextLB(elm, reinterpret_cast<MsgT*>(impl_->getMsg().get())); | ||
#endif | ||
return std::move(*this); | ||
} | ||
|
@@ -239,7 +238,7 @@ struct RunnableMaker { | |
uint64_t idx1, uint64_t idx2, uint64_t idx3, uint64_t idx4 | ||
) { | ||
impl_->addContextTrace( | ||
msg_, trace_event, handler_, from_node_, idx1, idx2, idx3, idx4 | ||
impl_->getMsg(), trace_event, handler_, from_node_, idx1, idx2, idx3, idx4 | ||
); | ||
return std::move(*this); | ||
} | ||
|
@@ -309,13 +308,12 @@ struct RunnableMaker { | |
|
||
private: | ||
RunnableNew* impl_ = nullptr; | ||
MsgSharedPtr<MsgT> const& msg_; | ||
bool has_msg_ = false; | ||
HandlerType handler_ = uninitialized_handler; | ||
bool set_handler_ = false; | ||
NodeType from_node_ = uninitialized_destination; | ||
bool is_done_ = false; | ||
bool is_term_ = false; | ||
bool has_msg_ = true; | ||
}; | ||
|
||
/** | ||
|
@@ -331,19 +329,19 @@ struct RunnableMaker { | |
*/ | ||
template <typename U> | ||
RunnableMaker<U> makeRunnable( | ||
MsgSharedPtr<U> const& msg, bool is_threaded, HandlerType handler, NodeType from | ||
MsgSharedPtr<U>&& msg, bool is_threaded, HandlerType handler, NodeType from | ||
) { | ||
auto r = new RunnableNew(msg, is_threaded); | ||
auto r = new RunnableNew(std::move(msg), is_threaded); | ||
#if vt_check_enabled(trace_enabled) | ||
auto const han_type = HandlerManager::getHandlerRegistryType(handler); | ||
if (han_type == auto_registry::RegistryTypeEnum::RegVrt or | ||
han_type == auto_registry::RegistryTypeEnum::RegGeneral or | ||
han_type == auto_registry::RegistryTypeEnum::RegObjGroup) { | ||
r->addContextTrace(msg, handler, from); | ||
r->addContextTrace(r->getMsg(), handler, from); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @lifflander @stmcgovern Can one of you please respond to Phil's comment about this? |
||
} | ||
#endif | ||
r->addContextSetContext(r, from); | ||
return RunnableMaker<U>{r, msg, handler, from}; | ||
return RunnableMaker<U>{r, true, handler, from}; | ||
} | ||
|
||
/** | ||
|
@@ -362,7 +360,7 @@ inline RunnableMaker<BaseMsgType> makeRunnableVoid( | |
auto r = new RunnableNew(is_threaded); | ||
// @todo: figure out how to trace this? | ||
r->addContextSetContext(r, from); | ||
return RunnableMaker<BaseMsgType>{r, nullptr, handler, from}; | ||
return RunnableMaker<BaseMsgType>{r, false, handler, from}; | ||
} | ||
|
||
}} /* end namespace vt::runnable */ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -95,7 +95,7 @@ template <typename UserMsgT> | |
user_msg.template to<BaseMsgType>(), handler, sys_msg->from_node, nullptr | ||
); | ||
} else { | ||
runnable::makeRunnable(user_msg, true, handler, sys_msg->from_node) | ||
runnable::makeRunnable(std::move(user_msg), true, handler, sys_msg->from_node) | ||
.withTDEpochFromMsg() | ||
.enqueue(); | ||
} | ||
|
@@ -146,7 +146,7 @@ template <typename UserMsgT> | |
msg.template to<BaseMsgType>(), handler, node, action | ||
); | ||
} else { | ||
runnable::makeRunnable(msg, true, handler, node) | ||
runnable::makeRunnable(std::move(msg), true, handler, node) | ||
.withTDEpoch(epoch, not is_valid_epoch) | ||
.withContinuation(action) | ||
.enqueue(); | ||
|
@@ -195,7 +195,7 @@ template <typename UserMsgT, typename BaseEagerMsgT> | |
user_msg.template to<BaseMsgType>(), handler, sys_msg->from_node, nullptr | ||
); | ||
} else { | ||
runnable::makeRunnable(user_msg, true, handler, sys_msg->from_node) | ||
runnable::makeRunnable(std::move(user_msg), true, handler, sys_msg->from_node) | ||
.withTDEpochFromMsg() | ||
.enqueue(); | ||
} | ||
|
@@ -428,14 +428,14 @@ template <typename MsgT, typename BaseT> | |
); | ||
|
||
auto base_msg = user_msg.template to<BaseMsgType>(); | ||
return messaging::PendingSend(base_msg, [=](MsgPtr<BaseMsgType> in) { | ||
return messaging::PendingSend(std::move(base_msg), [=](MsgPtr<BaseMsgType>&& in) mutable { | ||
bool const is_obj = HandlerManager::isHandlerObjGroup(typed_handler); | ||
if (is_obj) { | ||
objgroup::dispatchObjGroup( | ||
user_msg.template to<BaseMsgType>(), typed_handler, node, nullptr | ||
); | ||
} else { | ||
runnable::makeRunnable(user_msg, true, typed_handler, node) | ||
runnable::makeRunnable(std::move(user_msg), true, typed_handler, node) | ||
.withTDEpochFromMsg() | ||
.enqueue(); | ||
} | ||
Comment on lines
430
to
441
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why does this lambda keep using |
||
|
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 is
base
declared asconst&
here, necessitating the additional reference count bump and then move of the copy? Can ownership transfer flow further up the 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.
@lifflander @stmcgovern Can one of you please respond to Phil's comment about this?