This is an archive of the discontinued LLVM Phabricator instance.

[flang][openacc] Add initial support to lower assumed size array in data operand
ClosedPublic

Authored by clementval on Apr 21 2023, 3:39 PM.

Details

Summary

Add lowering for assumed size array in data clause to the newly
added data operand operations.

Depends on D148840

Diff Detail

Event Timeline

clementval created this revision.Apr 21 2023, 3:39 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptApr 21 2023, 3:39 PM
clementval requested review of this revision.Apr 21 2023, 3:39 PM
jeanPerier added inline comments.Apr 24 2023, 1:15 AM
flang/lib/Lower/OpenACC.cpp
117

For assumed shapes, "dimInfo.getLowerBound()" are not be the lower bounds of the entity/
E.g, this will not be 10 in the example below:

subroutine acc_enter_data_assumed(a, n, m)
  integer :: n, m
  real :: a(10:)

Does it matter in mlir::acc::DataBoundsOp ?

flang/test/Lower/OpenACC/acc-enter-data.f90
242

I am not familiar with what create does, but don't you need to document a byte stride too in this case and below as it is done above for create(a)?

clementval added inline comments.Apr 24 2023, 10:10 AM
flang/test/Lower/OpenACC/acc-enter-data.f90
242

That's a good question. The operation is designed in a way that this information is optional but maybe that was not the intent. @razvanlupusoru Should we always add it?

flang/lib/Lower/OpenACC.cpp
117

DataBoundsOp requires lowerbound to be normalized to 0. Additionally, the non-normalized lowerbound of 10 should be passed as startIdx.

flang/test/Lower/OpenACC/acc-enter-data.f90
242

Although optional from the point-of-view of the acc.bounds operation, the assumption is that in the non-specified case, the stride is 1. Since descriptors are not normalized to have a stride of 1, the load of stride from descriptor should indeed be included in the acc.bounds operation.

clementval added inline comments.Apr 24 2023, 11:23 AM
flang/lib/Lower/OpenACC.cpp
117

Working on it.

  • Add stride information extracted from the descriptor
  • Add test for assumed size array with non default lower bound

clang-format

  • Update case when there is no lower/upper bound provided
clementval marked 4 inline comments as done.Apr 24 2023, 1:32 PM

Fix the TODO for pointer/allocatable

Simplify TODO check

razvanlupusoru accepted this revision.Apr 24 2023, 2:47 PM

The examples are great and match what I expected from the acc.bounds operation. Thank you.

This revision is now accepted and ready to land.Apr 24 2023, 2:47 PM

Remove unwanted test for allocatable/pointer

Aside from the test failure, LGTM

flang/test/Lower/OpenACC/acc-enter-data.f90
44

Looks liked "real, pointer :: d" in "attach(d)" is firing the new TODO and causing a test failure.

clementval added inline comments.Apr 25 2023, 9:30 AM
flang/test/Lower/OpenACC/acc-enter-data.f90
44

You are correct. I had an update for that but somehow it didn't make it to this patch. I'll update it.

Remove attach clause handled incorrectly

This revision was landed with ongoing or failed builds.Apr 25 2023, 1:27 PM
This revision was automatically updated to reflect the committed changes.