This is an archive of the discontinued LLVM Phabricator instance.

[Clang][OpenMP] Avoid unnecessary privatization of mapper array when there is no user defined mapper
ClosedPublic

Authored by tianshilei1992 on Oct 24 2020, 10:25 AM.

Details

Summary

In current implementation, if it requires an outer task, the mapper array will be privatized no matter whether it has mapper. In fact, when there is no mapper, the mapper array only contains number of nullptr. In the libomptarget, the use of mapper array is if (mappers_array && mappers_array[i]), which means we can directly set mapper array to nullptr if there is no mapper. This can avoid unnecessary data copy.

In this patch, the data privatization will not be emitted if the mapper array is nullptr. When it comes to the emit of task body, the nullptr will be used directly.

Diff Detail

Event Timeline

Herald added a project: Restricted Project. · View Herald TranscriptOct 24 2020, 10:25 AM
tianshilei1992 requested review of this revision.Oct 24 2020, 10:25 AM

Fixed an issue that caused compiler crash

Fixed some test cases

jdoerfert accepted this revision.Oct 25 2020, 10:14 AM

4 tests seem to fail still, otherwise this LGTM.

This revision is now accepted and ready to land.Oct 25 2020, 10:14 AM

Fixed two test cases

tianshilei1992 retitled this revision from [Clang][OpenMP][WIP] Avoid unnecessary privatization of mapper array when there is no user defined mapper to [Clang][OpenMP] Avoid unnecessary privatization of mapper array when there is no user defined mapper.Oct 26 2020, 11:55 AM

Rebased the patch

This revision was landed with ongoing or failed builds.Oct 26 2020, 9:02 PM
This revision was automatically updated to reflect the committed changes.