Skip to content

Commit b14a3d2

Browse files
committed
#2389: trace: handle recursive invoke case outside scheduler
1 parent 6fef21d commit b14a3d2

File tree

2 files changed

+22
-6
lines changed

2 files changed

+22
-6
lines changed

src/vt/context/runnable_context/trace.cc

+3-1
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,9 @@ void Trace::start(TimeType time) {
7171
}
7272

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

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

103104
if (at_sched_depth_zero_) {
104105
theTrace()->endSchedulerLoop();
106+
theTrace()->setInInvokeContext(false);
105107
}
106108
}
107109

src/vt/trace/trace.h

+19-5
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,22 @@ struct Trace : runtime::component::Component<Trace>, TraceLite {
361361
*/
362362
bool inIdleEvent() const;
363363

364+
/**
365+
* \brief Set if we are inside an invoke context
366+
*
367+
* \param[in] set the variable value to set
368+
*/
369+
void setInInvokeContext(bool set) {
370+
inside_invoke_context_ = set;
371+
}
372+
373+
/**
374+
* \brief Return if we are inside an invoke context
375+
*
376+
* \return whether we are inside an invoke context
377+
*/
378+
bool inInvokeContext() const { return inside_invoke_context_; }
379+
364380
friend void insertNewUserEvent(UserEventIDType event, std::string const& name);
365381

366382
template <typename SerializerT>
@@ -385,7 +401,8 @@ struct Trace : runtime::component::Component<Trace>, TraceLite {
385401
| trace_enabled_cur_phase_
386402
| flush_event_
387403
| between_sched_event_type_
388-
| between_sched_event_;
404+
| between_sched_event_
405+
| inside_invoke_context_;
389406

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

400417
private:
401-
402-
403418
ObjGroupProxyType spec_proxy_ = vt::no_obj_group;
404419

405-
406-
407420
// Processing event between top-level loops.
408421
TraceEntryIDType between_sched_event_type_ = no_trace_entry_id;
409422
TraceProcessingTag between_sched_event_;
423+
bool inside_invoke_context_ = false;
410424
};
411425

412426
}} //end namespace vt::trace

0 commit comments

Comments
 (0)