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

#1480: Treat pending asynchronous operations like message in flight to prevent TD hang detection false positives #1517

Merged
merged 5 commits into from
Aug 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 4 additions & 2 deletions src/vt/messaging/async_op.cc
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ namespace vt { namespace messaging {

AsyncOp::AsyncOp() {
cur_epoch_ = theMsg()->getEpoch();
theTerm()->produce(cur_epoch_);
theTerm()->addLocalDependency(cur_epoch_);
}

AsyncOp::AsyncOp(AsyncOp&& in) {
Expand All @@ -56,8 +56,10 @@ AsyncOp::AsyncOp(AsyncOp&& in) {
}

/*virtual*/ AsyncOp::~AsyncOp() {
// This case only occurs in a moved-from instance, in which case the
// move-ee will make the matching calls
if (cur_epoch_ != no_epoch) {
theTerm()->consume(cur_epoch_);
theTerm()->releaseLocalDependency(cur_epoch_);
}
}

Expand Down
18 changes: 18 additions & 0 deletions src/vt/termination/termination.cc
Original file line number Diff line number Diff line change
Expand Up @@ -940,6 +940,24 @@ void TerminationDetector::addEpochStateDependency(EpochType ep) {
}
}

void TerminationDetector::addLocalDependency(EpochType epoch) {
if (epoch != any_epoch_sentinel) {
addEpochStateDependency(epoch);
}
theTerm()->produce(epoch);
any_epoch_state_.incrementDependency();
hang_.incrementDependency();
}

void TerminationDetector::releaseLocalDependency(EpochType epoch) {
hang_.decrementDependency();
any_epoch_state_.decrementDependency();
theTerm()->consume(epoch);
if (epoch != any_epoch_sentinel) {
removeEpochStateDependency(epoch);
}
}

void TerminationDetector::finishNoActivateEpoch(EpochType const& epoch) {
auto ready_iter = epoch_ready_.find(epoch);
if (ready_iter == epoch_ready_.end()) {
Expand Down
14 changes: 14 additions & 0 deletions src/vt/termination/termination.h
Original file line number Diff line number Diff line change
Expand Up @@ -622,6 +622,20 @@ struct TerminationDetector :
);

public:
/**
* \brief Add a local work dependency on an epoch to stop propagation
*
* \param[in] epoch the epoch
*/
void addLocalDependency(EpochType epoch);

/**
* \brief Release a local work dependency on an epoch to resume propagation
*
* \param[in] epoch the epoch
*/
void releaseLocalDependency(EpochType epoch);

/**
* \internal \brief Make a dependency between two epochs
*
Expand Down