[Openmp-commits] [PATCH] D132532: [libomptarget] Avoid deleting the same entry multiple times

Johannes Doerfert via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Wed Aug 24 07:41:25 PDT 2022


jdoerfert added a comment.

In D132532#3745645 <https://reviews.llvm.org/D132532#3745645>, @ye-luo wrote:

> In D132532#3745640 <https://reviews.llvm.org/D132532#3745640>, @jdoerfert wrote:
>
>> I thought about this but IIRC, this doesn't work either. Now you have no way to prevent races between the copy back and copy to since the entry is gone while the copy back runs.
>
> I thought about the racing. If race to write the same data, there is no harm. If race to write different data, the source of race is user program which needs to protect the race anyway.

I still believe there is a problem.

T1: copy back old device memory into HostMem after entry has been deleted
T2: copy from HostMem into some new device region as the entry is new

We cannot use events or anything to prevent this race on the host memory and since maps should be atomic we break the program.

Where am I wrong?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D132532



More information about the Openmp-commits mailing list