This is an archive of the discontinued LLVM Phabricator instance.

[flang][openacc] Lower data construct operand to data operand operations
ClosedPublic

Authored by clementval on May 2 2023, 11:02 AM.

Details

Summary

This patch lowers the data clause on the OpenACC data construct
to their corresponding acc data operand operation.
The copy clause is decomposed into acc.copyin before and acc.copyout after
the acc.data operation.
The copyout close is decomposed into acc.create before and acc.copyout after
the acc.data operation.
The attach clause is decomposed into acc.attach before and acc.detach after
the acc.data operation.

Depends on D149601

Diff Detail

Event Timeline

clementval created this revision.May 2 2023, 11:02 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptMay 2 2023, 11:02 AM
clementval requested review of this revision.May 2 2023, 11:02 AM

Just one missing case as far as I can tell - otherwise looks great!

flang/lib/Lower/OpenACC.cpp
1109

I think you are missing the matching delete for create.

Data clause operations which have semantics at both entry and exit of region will be decomposed:
acc copy => acc.copyin (before region) + acc.copyout (after region)
acc copyout => acc.create (before region) + acc.copyout (after region)
acc attach => acc.attach (before region) + acc.detach (after region)
acc create => acc.create (before region) + acc.delete (after region)

flang/test/Lower/OpenACC/acc-data-operands.f90
37

Unexpected tab

clementval added inline comments.May 3 2023, 11:04 AM
flang/lib/Lower/OpenACC.cpp
1109

Good catch! I'll send an update with that shortly.

Apply correct semantic for create clause

This revision is now accepted and ready to land.May 4 2023, 1:09 AM
clementval updated this revision to Diff 519534.May 4 2023, 9:37 AM

Fix data clause for copyout(zero:)

This revision was landed with ongoing or failed builds.May 4 2023, 10:37 AM
This revision was automatically updated to reflect the committed changes.