[PATCH] D79972: [OpenMP5.0] map item can be non-contiguous for target update

Chi Chun Chen via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed May 27 15:50:02 PDT 2020


cchen added a comment.

In D79972#2058608 <https://reviews.llvm.org/D79972#2058608>, @ABataev wrote:

> In D79972#2058555 <https://reviews.llvm.org/D79972#2058555>, @cchen wrote:
>
> > In D79972#2058516 <https://reviews.llvm.org/D79972#2058516>, @ABataev wrote:
> >
> > > Is my guess correct that for OpenMP >= 50 for target update directive we always emit `possibly non-continuous` runtime calls?
> >
> >
> > My intent is to emit `possibly non-contiguous` runtime calls only if the analysis in Sema set the IsNonContiguous flag to true.
>
>
> But this analysis only checks for the directive and the version,nothing else.


The context of the checks for the directive and version:

  bool NotWhole =
    checkArrayExpressionDoesNotReferToWholeSize(SemaRef, OASE, CurType);
  bool NotUnity =
    checkArrayExpressionDoesNotReferToUnitySize(SemaRef, OASE, CurType);
  
  if (AllowWholeSizeArraySection) {
    // Any array section is currently allowed. Allowing a whole size array
    // section implies allowing a unity array section as well.
    //
    // If this array section refers to the whole dimension we can still
    // accept other array sections before this one, except if the base is a
    // pointer. Otherwise, only unitary sections are accepted.
    if (NotWhole || IsPointer)
      AllowWholeSizeArraySection = false;
  } else if (DKind == OMPD_target_update &&
             SemaRef.getLangOpts().OpenMP >= 50) {
    IsNonContiguousRef = true;
  } else if (AllowUnitySizeArraySection && NotUnity) {
    // A unity or whole array section is not allowed and that is not
    // compatible with the properties of the current array section.
    SemaRef.Diag(
      ELoc, diag::err_array_section_does_not_specify_contiguous_storage)
      << OASE->getSourceRange();
    return false;
  }

The original analysis checks for non-contiguous by finding if there is more than one "array-section" expression with length greater than one. Therefore, I added my check there to allow more than one array-section with length greater than one by depending on the existing analysis (and also set IsNonContiguous to true so that we can pass it to codegen rather than doing analysis in codegen). This change allows me to pass all the existing lit test but still emit the "non-contiguous" runtime.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D79972/new/

https://reviews.llvm.org/D79972





More information about the cfe-commits mailing list