This is an archive of the discontinued LLVM Phabricator instance.

[libomptarget] Fix copy-to motion for PTR_AND_OBJ entries where PTR is a struct member
ClosedPublic

Authored by grokos on Oct 16 2020, 3:01 PM.

Details

Summary

This patch fixes a problem whereby the pointee object of a PTR_AND_OBJ entry with a map(to) motion clause can be overwritten on the device even if its reference counter is >=1.

Currently, we check the reference counter of the parent struct in order to determine whether the motion clause should be respected, but since the pointee object is not part of the struct, it's got its own reference counter which should be used to enqueue the copy or discard it.

The same behavior has already been implemented in targetDataEnd (omptarget.cpp:539-540), but we somehow missed doing the same in targetDataBegin.

Diff Detail

Event Timeline

grokos requested review of this revision.Oct 16 2020, 3:01 PM
grokos created this revision.
JonChesterfield accepted this revision.Oct 16 2020, 4:07 PM

Yep, that seems clear cut. Thanks!

This revision is now accepted and ready to land.Oct 16 2020, 4:07 PM