RegionDirectory::synchronize(WD) copies out too much data
The synchronize method copies out all chunks of each registered region instead of only the chunks generated by the task which is being synchronized. This is an issue with nested tasks as a taskwait inside a parent task will copyout more than needed and it may end in a "concurrent or commutative detected" in other children tasks. For example:
#pragma omp register([4]a)
#pragma omp task inout(a[0;2]) copy_deps //TASK_0
{
#pragma omp task inout(a[0;1]) copy_deps //TASK_0_0
a[0] += 1;
#pragma omp taskwait //TW_0
}
#pragma omp task inout(a[2;2]) copy_deps //TASK_1
{
#pragma omp task inout(a[2;1]) copy_deps //TASK_1_0
a[0] += 1;
#pragma omp taskwait //TW_1
}
#pragma omp taskwait //TW_GLOBAL
The TW_0 will copy out all chunks registered for the region [4]a
instead of only flush the chunk of TASK_0. If after that, the TASK_1_0 tries to copy in a[2:1]
will realize that this chunk is a newer version than expected and throw the warning.