StanfordLegion/legion

How do I set color_is when the two region_requirements submitted by IndexLauncher are different in partition dimensions?

AngryBear2 opened this issue · 7 comments

When I need to implement a matrix transposition, my input area needs to be partitioned by row, so my output area needs to be partitioned by column, my Rect<3> color_bounds(Point<3>(0, 0, 0), Point<3>(0, num_slice-1, 0)) . No error is reported when the input area is partitioned, but a problem occurs when the output area is partitioned. When I submit the launcher and use the color_is generated by the color_bounds, my color_bounds is divided into the first dimension. I don't report errors in the output area, and I report errors in the input area.
image
image
When I comment out part of the code in the output area, this error does not occur.
image
In this case, how do I start the IndexLauncher?

rohany commented

You need to use projection functors to map between the points of your index task launch space and points in your logical partitions. Right now your region requirements are using the identity projection functor (id 0). When your partition color space doesn't match up directly with your index task launch space, register a projection functor that performs the correct mapping, and use that as the projection id on your region requirements.

You need to use projection functors to map between the points of your index task launch space and points in your logical partitions. Right now your region requirements are using the identity projection functor (id 0). When your partition color space doesn't match up directly with your index task launch space, register a projection functor that performs the correct mapping, and use that as the projection id on your region requirements.

Thank you for your help. Is there a document or a simple example of ProjectionFunctor? I searched in Legion and found that vitrual_map.cc is used, but I still don't understand its usage.

rohany commented

I can't find an example in the legion repository, but I'll try and give you some pointers here.

You'll want to implement a class that inherits from https://gitlab.com/StanfordLegion/legion/-/blob/master/runtime/legion.h?ref_type=heads#L4403, and implement an overload of this method: https://gitlab.com/StanfordLegion/legion/-/blob/master/runtime/legion.h?ref_type=heads#L4464, while also overloading the is_functional method to return true.

What project is supposed to do, is given the partition you are launching over, the point of the launch space being considered, and the launch space itself, return the desired subregion.

Most simple projection functors look like:

Legion::LogicalRegion project(Legion::LogicalPartition upper_bound,
                                                    const DomainPoint& point,
                                                    const Domain& launch_domain) {
  auto new_point = compute_user_defined_point_transformation(point, launch_domain);
  return runtime->get_logical_subregion_by_color(upper_bound, new_point);
}

Use this function (https://gitlab.com/StanfordLegion/legion/-/blob/master/runtime/legion.h?ref_type=heads#L8652) to register your projection functor with the runtime to give it an ID.

I can't find an example in the legion repository, but I'll try and give you some pointers here.

You'll want to implement a class that inherits from https://gitlab.com/StanfordLegion/legion/-/blob/master/runtime/legion.h?ref_type=heads#L4403, and implement an overload of this method: https://gitlab.com/StanfordLegion/legion/-/blob/master/runtime/legion.h?ref_type=heads#L4464, while also overloading the is_functional method to return true.

What project is supposed to do, is given the partition you are launching over, the point of the launch space being considered, and the launch space itself, return the desired subregion.

Most simple projection functors look like:

Legion::LogicalRegion project(Legion::LogicalPartition upper_bound,
                                                    const DomainPoint& point,
                                                    const Domain& launch_domain) {
  auto new_point = compute_user_defined_point_transformation(point, launch_domain);
  return runtime->get_logical_subregion_by_color(upper_bound, new_point);
}

Use this function (https://gitlab.com/StanfordLegion/legion/-/blob/master/runtime/legion.h?ref_type=heads#L8652) to register your projection functor with the runtime to give it an ID.

Thank you, I'll try it first.

@rohany #1604

First, you do an index launch of 4 tasks (one for each node). Then, in each of those tasks, you create (or reference from the parent task) a partition of the data assigned the task. Then, you would do another index launch of size 8, one for each dore on your machine.

Hello, I'd like to ask about this parent task.I started the parent task, started the IndexLauncher in the child task, and then partitioned it. But I want the parent task to be independent, because the parent task does not do memory operations, and the child tasks are EXCLUSICVE. Therefore, I set the permission of the parent task to RELAXED, but the second parent task can be mapped only after all the subtasks of the first parent task are calculated. Can I let the second parent task start the subtasks of the second parent task earlier? Thank you.

rohany commented

I'm sorry, I don't understand your question. Can you reword your question, and maybe include a visual the task tree you are generating and how you want it to be executed? Also, please move this discussion to the relevant issue, not here.