[OpenMP] Avoid checking parent reference count in targetDataBegin

Authored by jdenny on Jul 10 2021, 9:01 AM.


[OpenMP] Avoid checking parent reference count in targetDataBegin

This patch is an attempt to do for targetDataBegin what D104924 does
for targetDataEnd:

  • Eliminates a lock/unlock of the data mapping table.
  • Clarifies the logic that determines whether a struct member's host-to-device transfer occurs. The old logic, which checks the parent struct's reference count, is a leftover from back when we had a different map interface (as pointed out at https://reviews.llvm.org/D104924#2846972).

Additionally, it eliminates the DeviceTy::getMapEntryRefCnt, which
is no longer used after this patch.

While D104924 does not change the computation of IsLast, I found I
needed to change the computation of IsNew for this patch. As far as
I can tell, the change is correct, and this patch does not cause any
additional openmp tests to fail. However, I'm not sure I've thought
of all use cases. Please advise.

Reviewed By: jdoerfert, jhuber6, protze.joachim, tianshilei1992, grokos, RaviNarayanaswamy

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