This is an archive of the discontinued LLVM Phabricator instance.

[OpenMP] Fix `target data` exit for array extension
ClosedPublic

Authored by jdenny on Aug 5 2020, 12:30 PM.

Details

Summary

For example:

#pragma omp target data map(tofrom:arr[0:100])
{
  #pragma omp target exit data map(delete:arr[0:100])
  #pragma omp target enter data map(alloc:arr[98:2])
}

Without this patch, the transfer at the end of the target data region
is broken and fails depending on the target device. According to my
read of the spec, the transfer shouldn't even be attempted because
arr[0:100] isn't (fully) present there. To fix that, this patch
makes DeviceTy::getTgtPtrBegin return null for this case.

Diff Detail

Event Timeline

jdenny created this revision.Aug 5 2020, 12:30 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 5 2020, 12:30 PM
jdenny requested review of this revision.Aug 5 2020, 12:30 PM
grokos accepted this revision.Aug 5 2020, 12:51 PM

Looks good.

This revision is now accepted and ready to land.Aug 5 2020, 12:51 PM
This revision was automatically updated to reflect the committed changes.
jdenny added inline comments.Aug 5 2020, 2:34 PM
openmp/libomptarget/src/omptarget.cpp
509

Ah, I broke reference count decrements for implicit mappings. I think it should be true -> !IsImplicit. I'll work on another patch.