StanfordLegion/legion

Legion: handling multiple layout constraint sets for one region requirement

Closed this issue · 5 comments

If I try to run the following small program with Legion. This small program contains three tasks and tries to add multiple layout constraint sets for a single region requirement of a task.

In particular, the program runs fine if you comment lines 270, 280, and 285 of the file main.cc.

If you do not comment line 270, you get

LEGION ERROR: Invalid mapper output. Mapper Default Mapper on Processor 1d00000000000001 selected variant 2 for task init_task (ID 18). But instance selected for region requirement 0 fails to satisfy the corresponding Field layout constraint.

If you do not comment line 280, you get

[0 - 70000fd07000]    0.138703 {4}{runtime}: [warning 1012] LEGION WARNING: Ignoring request to create instance in memory 1e00000000000000 with no fields. (from file /Users/direnzo/Codes/legion/runtime/legion/legion_instances.cc:3786)
For more information see:
http://legion.stanford.edu/messages/warning_code.html#warning_code_1012

[0 - 70000fd07000]    0.138733 {5}{default_mapper}: Default mapper failed allocation of size 0 bytes for region  requirement 1 of task stencil_task (UID 20) in memory 1e00000000000000 (SYSTEM_MEM) for processor 1d00000000000001 (LOC_PROC). This means the working set     of your application is too big for the allotted capacity of the given memory under the default mapper's mapping scheme. You have three choices: ask Realm to allocate more memory, write a custom mapper to better manage working sets, or find a bigger machine.

if you do not comment lines 280 and 285 you get

LEGION ERROR: Invalid mapper output. Mapper Default Mapper on Processor 1d00000000000001 selected variant 3 for task stencil_task (ID 20). But instance selected for region requirement 1 fails to satisfy the corresponding Field layout constraint.

I guess that something in the default mapper of the runtime does not deal with the allocation of instances that comply with multiple layout constraint sets. My understanding is that this should be possible considering that one might want to specify multiple FieldConstraint for one region requirement.

constraintTest.tar.gz

@elliottslaughter, can you add this issue to #1032?

This looks like an issue with the default mapper assuming that there is exactly one layout constraint for each region requirement in a task which doesn't have to be the case. Anybody can work on the default mapper without touching the runtime code, so I'll defer this to other people.

I think you are right, the default mapper will create an instance at this loop https://gitlab.com/StanfordLegion/legion/-/blob/master/runtime/mappers/default_mapper.cc#L1939 using the first constraint set that is provided by the multimap (if it does not contain a FieldConstraint). If constraints are provided in separate sets, the first set will dominate over the others. There should be some kind of logic to search first for the constraint sets that contain a FieldConstraint and combine them with the constraint sets that do not specify any field, which supposedly should be applied to all the fields of the region requirement.

@mariodirenzo - please close or add to this issue

Thanks for working on this issue