StanfordLegion / legion

The Legion Parallel Programming System
https://legion.stanford.edu
Apache License 2.0
680 stars 145 forks source link

reduction task with empty launch bounds #1079

Open ipdemes opened 3 years ago

ipdemes commented 3 years ago

We were unable to execute a reduction task which launch bounds are empty. At least this seems to be not supported by DefaultMapper: we get an error like:

LEGION ERROR: Invalid mapper output from invocation of 'slice_task' call on mapper Default Mapper on Processor 1d00000000000001. Mapper failed to specify an slices for task redop (ID 3). (from file /home/irina/install_dir/src/flecsi-third-party_clean/legion/runtime//legion/legion_tasks.cc:5110)

Simple reproducer code:

using namespace Legion;

enum TaskIDs {
  TOP_LEVEL_TASK_ID,
  REDOP_TASK_ID
};

void top_level_task(const Task *, const std::vector<PhysicalRegion> &,
                    Context ctx, Runtime *runtime) {

  printf("Top level task\n");
  //reduction task
  ArgumentMap idx_arg_map;
  Rect<1> color_bounds_redop(0, -1);
  IndexSpaceT<1> color_is_redop =
      runtime->create_index_space(ctx, color_bounds_redop);

  IndexLauncher redop_launcher(REDOP_TASK_ID, color_is_redop,
                               TaskArgument(NULL, 0), idx_arg_map);
  auto f = runtime->execute_index_space(ctx, redop_launcher,
      LEGION_REDOP_SUM_INT32);

  std::cout <<"redop = " << f.get<int>() <<std::endl;

}//top level task

//------------------------------------------------------------------------
// reduction task

int reduction_task(const Task *task, const std::vector<PhysicalRegion> &regions,
                Context ctx, Runtime *runtime) {

    return 5;

}
//------------------------------------------------------------------------
int main(int argc, char **argv) {

  Runtime::set_top_level_task_id(TOP_LEVEL_TASK_ID);
  {
    TaskVariantRegistrar registrar(TOP_LEVEL_TASK_ID, "top_level");
    registrar.add_constraint(ProcessorConstraint(Processor::LOC_PROC));
    registrar.set_inner();
    registrar.set_replicable();
    Runtime::preregister_task_variant<top_level_task>(registrar, "top_level");
  }

  {
    TaskVariantRegistrar registrar(REDOP_TASK_ID, "redop");
    registrar.add_constraint(ProcessorConstraint(Processor::LOC_PROC));
    Runtime::preregister_task_variant<int, reduction_task>(registrar, "redop");
  }

  Runtime::start(argc, argv);

  printf("SUCCESS!\n");

  return 0;
}

For this code we were using control_replication branch with hash eabd10a2199ce324da68a29570c7454b02f70f4d

lightsighter commented 3 years ago

Please pull and try again with c258e03d150