Skip to content

Commit

Permalink
legion: Run post-end tasks individually
Browse files Browse the repository at this point in the history
  • Loading branch information
magnatelee committed May 9, 2018
1 parent 1594a39 commit 1c1188f
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 9 deletions.
30 changes: 21 additions & 9 deletions runtime/legion/legion_context.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4789,17 +4789,11 @@ namespace Legion {
}
if (!to_perform.empty())
{
for (std::vector<PostTaskArgs>::const_iterator it =
for (std::vector<PostTaskArgs>::iterator it =
to_perform.begin(); it != to_perform.end(); it++)
{
if (it->instance.exists())
{
it->context->post_end_task(it->result, it->size, false/*owned*/);
// Once we've copied the data then we can destroy the instance
it->instance.destroy();
}
else
it->context->post_end_task(it->result, it->size, true/*owned*/);
DeferredPostTaskArgs args(*it);
runtime->issue_runtime_meta_task(args, LG_THROUGHPUT_WORK_PRIORITY);
}
}
if (launch_next_op != NULL)
Expand Down Expand Up @@ -6625,6 +6619,24 @@ namespace Legion {
pargs->proxy_this->process_post_end_tasks();
}

//--------------------------------------------------------------------------
/*static*/ void InnerContext::handle_deferred_post_end_task(
const void *args)
//--------------------------------------------------------------------------
{
const PostTaskArgs *pargs = &((const DeferredPostTaskArgs*)args)->args;
if (pargs->instance.exists())
{
pargs->context->post_end_task(
pargs->result, pargs->size, false/*owned*/);
// Once we've copied the data then we can destroy the instance
pargs->instance.destroy();
}
else
pargs->context->post_end_task(
pargs->result, pargs->size, true/*owned*/);
}

//--------------------------------------------------------------------------
void InnerContext::inline_child_task(TaskOp *child)
//--------------------------------------------------------------------------
Expand Down
12 changes: 12 additions & 0 deletions runtime/legion/legion_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -620,6 +620,17 @@ namespace Legion {
PhysicalInstance instance;
RtEvent wait_on;
};
struct DeferredPostTaskArgs : public LgTaskArgs<DeferredPostTaskArgs> {
public:
static const LgTaskID TASK_ID = LG_DEFERRED_POST_END_ID;
public:
DeferredPostTaskArgs(PostTaskArgs &a)
: LgTaskArgs<DeferredPostTaskArgs>(
a.context->owner_task->get_unique_op_id()),
args(a.context, a.result, a.size, a.instance, a.wait_on) { }
public:
PostTaskArgs args;
};
struct PostDecrementArgs : public LgTaskArgs<PostDecrementArgs> {
public:
static const LgTaskID TASK_ID = LG_POST_DECREMENT_TASK_ID;
Expand Down Expand Up @@ -1001,6 +1012,7 @@ namespace Legion {
static void handle_prepipeline_stage(const void *args);
static void handle_dependence_stage(const void *args);
static void handle_post_end_task(const void *args);
static void handle_deferred_post_end_task(const void *args);
public:
void free_remote_contexts(void);
void send_remote_context(AddressSpaceID remote_instance,
Expand Down
1 change: 1 addition & 0 deletions runtime/legion/legion_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@ namespace Legion {
LG_DEFERRED_COMPLETE_ID,
LG_DEFERRED_COMMIT_ID,
LG_DEFERRED_COLLECT_ID,
LG_DEFERRED_POST_END_ID,
LG_PRE_PIPELINE_ID,
LG_TRIGGER_DEPENDENCE_ID,
LG_TRIGGER_COMPLETE_ID,
Expand Down
5 changes: 5 additions & 0 deletions runtime/legion/runtime.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19867,6 +19867,11 @@ namespace Legion {
InnerContext::handle_post_end_task(args);
break;
}
case LG_DEFERRED_POST_END_ID:
{
InnerContext::handle_deferred_post_end_task(args);
break;
}
case LG_DEFERRED_READY_TRIGGER_ID:
{
const Operation::DeferredReadyArgs *deferred_ready_args =
Expand Down

0 comments on commit 1c1188f

Please sign in to comment.