This is an archive of the discontinued LLVM Phabricator instance.

[OpenMP][Clang] Allow ancestor device modifier only with reverse offloading
ClosedPublic

Authored by saiislam on Feb 3 2022, 3:49 AM.

Details

Summary

OpenMP Spec 5.0 [2.12.5, Restrictions]: If a device clause in which the
ancestor device-modifier appears is present on the target construct,
then a requires directive with the reverse_offload clause must be
specified.

Diff Detail

Event Timeline

saiislam created this revision.Feb 3 2022, 3:49 AM
saiislam requested review of this revision.Feb 3 2022, 3:49 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 3 2022, 3:49 AM
ABataev added inline comments.Feb 3 2022, 4:26 AM
clang/test/OpenMP/target_device_codegen.cpp
43–47

Do we have a codegen test for the ancestor modifier?

saiislam added inline comments.Feb 3 2022, 5:14 AM
clang/test/OpenMP/target_device_codegen.cpp
43–47

We shouldn't have a test for ancestor modifier because it can only be used when requires reverse_offload is specified and Spec 5.2 says that if an implementation is not supporting a requirement (reverse offload in this case) then it should give compile-time error termination [1].

I am going to propose this change in a different phab review.

[1] OpenMP API Specification 5.2, Section 8.2.1, lines 12-13, page 212.

ABataev added inline comments.Feb 3 2022, 5:20 AM
clang/test/OpenMP/target_device_codegen.cpp
43–47

I'm not asking about runtime test but the unit test. We should check at least that using this modifier does not crash the compiler. Could you restore this test here and add #pragma omp requires reverse_offload instead?

saiislam updated this revision to Diff 405591.Feb 3 2022, 5:26 AM
saiislam marked an inline comment as done.

Restored device ancestor codegen unit test with requires reverese_offload.

This revision is now accepted and ready to land.Feb 3 2022, 5:27 AM
This revision was landed with ongoing or failed builds.Feb 4 2022, 4:17 AM
This revision was automatically updated to reflect the committed changes.