HomePhabricator

[OPENMP]Add support for allocate vars in untied tasks.

Authored by ABataev on Sep 15 2020, 8:21 AM.

Description

[OPENMP]Add support for allocate vars in untied tasks.

Local vars, marked with pragma allocate, mustbe allocate by the call of
the runtime function and cannot be allocated as other local variables.
Instead, we allocate a space for the pointer in private record and store
the address, returned by kmpc_alloc call in this pointer.
So, for untied tasks

#pragma omp task untied
{
  S s;
   #pragma omp allocate(s) allocator(allocator)
  s = x;
}

compiler generates something like this:

struct task_with_privates {
  S *ptr;
};

void entry(task_with_privates *p) {
  S *s = p->s;
  switch(partid) {
  case 1:
    p->s = (S*)kmpc_alloc();
    kmpc_omp_task();
    br exit;
  case 2:
    *s = x;
    kmpc_omp_task();
    br exit;
  case 2:
    ~S(s);
    kmpc_free((void*)s);
    br exit;
  }
exit:
}

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D86558

Details

Committed
ABataevSep 15 2020, 10:39 AM
Reviewer
jdoerfert
Differential Revision
D86558: [OPENMP]Add support for allocate vars in untied tasks.
Parents
rG3bc3983f229f: Fix bot failure after ccb4124a4172
Branches
Unknown
Tags
Unknown