Skip to content

Commit

Permalink
#2389: trace: handle recursive invoke case outside scheduler
Browse files Browse the repository at this point in the history
  • Loading branch information
lifflander committed Feb 14, 2025
1 parent d19c264 commit 04dbb51
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
4 changes: 3 additions & 1 deletion src/vt/context/runnable_context/trace.cc
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,9 @@ void Trace::start(TimeType time) {
}

// If our scheduler depth is zero, we need to end the between scheduler event
if (theSched()->getSchedulerDepth() == 0) {
if (theSched()->getSchedulerDepth() == 0 and not theTrace()->inInvokeContext()) {
at_sched_depth_zero_ = true;
theTrace()->setInInvokeContext(true);
theTrace()->beginSchedulerLoop();
}

Expand Down Expand Up @@ -102,6 +103,7 @@ void Trace::finish(TimeType time) {

if (at_sched_depth_zero_) {
theTrace()->endSchedulerLoop();
theTrace()->setInInvokeContext(false);
}
}

Expand Down
24 changes: 19 additions & 5 deletions src/vt/trace/trace.h
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,22 @@ struct Trace : runtime::component::Component<Trace>, TraceLite {
*/
bool inIdleEvent() const;

/**
* \brief Set if we are inside an invoke context
*
* \param[in] set the variable value to set
*/
void setInInvokeContext(bool set) {
inside_invoke_context_ = set;
}

/**
* \brief Return if we are inside an invoke context
*
* \return whether we are inside an invoke context
*/
bool inInvokeContext() const { return inside_invoke_context_; }

friend void insertNewUserEvent(UserEventIDType event, std::string const& name);

template <typename SerializerT>
Expand All @@ -385,7 +401,8 @@ struct Trace : runtime::component::Component<Trace>, TraceLite {
| trace_enabled_cur_phase_
| flush_event_
| between_sched_event_type_
| between_sched_event_;
| between_sched_event_
| inside_invoke_context_;

s.skip(log_file_); // definition unavailable
}
Expand All @@ -398,15 +415,12 @@ struct Trace : runtime::component::Component<Trace>, TraceLite {
int incremental_flush_mode = 0;

private:


ObjGroupProxyType spec_proxy_ = vt::no_obj_group;



// Processing event between top-level loops.
TraceEntryIDType between_sched_event_type_ = no_trace_entry_id;
TraceProcessingTag between_sched_event_;
bool inside_invoke_context_ = false;
};

}} //end namespace vt::trace
Expand Down

0 comments on commit 04dbb51

Please sign in to comment.