[Openmp-commits] [PATCH] D84422: [OpenMP] Fix `present` for exit from `omp target data`

Joel E. Denny via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Mon Jul 27 12:40:58 PDT 2020


jdenny added a comment.

In D84422#2176802 <https://reviews.llvm.org/D84422#2176802>, @grokos wrote:

> In D84422#2173500 <https://reviews.llvm.org/D84422#2173500>, @jdenny wrote:
>
> > I've added a comment to the runtime code that performs the check.  As you can see, the check is performed regardless.  It's just a question of whether the runtime treats it as an error.  I don't think performance is an issue.
> >
> > My concern here is that it will be hard to justify changes to the runtime if I cannot formulate a use case.
>
>
> Thinking about it, I don't think there can be a case where something is present upon entering a target region and not be present when we're exiting. Whatever code comprises the target region is code executed on the device - it cannot modify the state of host objects (i.e. libomptarget) in any possible way. E.g. the kernel cannot invoke libomptarget functions, allocate memory, map/unmap data etc.
>
> The only case where something like this would be possible is if we have multiple host threads executing async offloading. In such a case, one thread may launch a target region at a moment when the requested mapping is `present` on the device and while the kernel is executing some other thread performs a `target data exit` on the desired mapping. Upon exiting the kernel, the mapping will no longer be present but this is clearly a race condition (user's fault), so I don't think we should pay attention to such a scenario.


Exactly.  As far as I can tell, the runtime simply needs a comment that explains this issue in the case of `omp target`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D84422





More information about the Openmp-commits mailing list