This is an archive of the discontinued LLVM Phabricator instance.

[libomptarget] Fix a bug whereby firstprivates are not copied over to the device
ClosedPublic

Authored by grokos on May 20 2021, 4:48 PM.

Details

Summary

After D86781, the check for the TO flag when processing firstprivates is missing. As a result, sometimes the device copy of a firstprivate never gets initialized.

More specifically, D86781 tried to force lambda structs to be allocated immediately by marking them as a non-firstprivate, so that PrivateArgumentManagerTy::addArg allocates memory for them immediately. However, calling addArg with IsFirstPrivate=false makes the function skip initializing the device copy. Whether an argument is firstprivate and whether we need to allocate memory immediately are not synonyms, so this patch introduces one more control variable for immediate allocation and sets it apart from initialization.

Diff Detail

Event Timeline

grokos requested review of this revision.May 20 2021, 4:48 PM
grokos created this revision.
This revision is now accepted and ready to land.May 21 2021, 10:05 AM
This revision was landed with ongoing or failed builds.May 21 2021, 10:56 AM
This revision was automatically updated to reflect the committed changes.