This is an archive of the discontinued LLVM Phabricator instance.

Expand coverage of this_image semantics testing
ClosedPublic

Authored by rouson on Apr 7 2022, 11:56 AM.

Details

Summary

Add a test with a range of this_image() intrinsic function
invocations, including a comprehensive set of standard-conforming
keyword and non-keyword arguments with and without optional
arguments present and with argument positions covering all
possible orderings. Also test that several non-conforming
this_image() invocations generate the correct error messages.

Diff Detail

Event Timeline

rouson created this revision.Apr 7 2022, 11:56 AM
Herald added a project: Restricted Project. · View Herald Transcript
Herald added a subscriber: jdoerfert. · View Herald Transcript
rouson requested review of this revision.Apr 7 2022, 11:56 AM
ktras requested changes to this revision.May 2 2022, 1:16 PM

I have only one small suggestion, please see the suggested code edit.

flang/test/Semantics/this_image02.f90
84

Since team is an optional argument, I would recommend using the keyword argument here to explicitly test whether the team argument is being restricted to a scalar of team_type or not.

This revision now requires changes to proceed.May 2 2022, 1:16 PM
ktras added inline comments.May 2 2022, 5:29 PM
flang/test/Semantics/this_image02.f90
31

The implementation of this_image does not currently support this call, so please add the following error message before it.
!ERROR: missing mandatory 'dim=' argument

klausler added inline comments.
flang/test/Semantics/this_image02.f90
31

Don't change tests to match buggy behavior.

ktras added inline comments.May 4 2022, 2:20 PM
flang/test/Semantics/this_image02.f90
31

I believe that @rouson is working on contributing tests for parallel features but is not currently looking at editing source. It seems to me in this situation there are three options:

  1. Do not add an error for this line of code and add an XFAIL directive
  2. Do not add an error and do not add XFAIL directive and push a failing test
  3. Add the error and when the support is added, the error is removed in the same patch

Based on looking at other tests in the past that had error directives that would go away once certain features were supported, I thought this case was similar and thought the last option was best.

@klausler Since your comment seems to say this is not the best approach, which is the best option for this test and what matches the workflow of the developers?

klausler added inline comments.May 4 2022, 2:26 PM
flang/test/Semantics/this_image02.f90
31

Probably the first option, if the bug can't be fixed. But fixing the bug would be best.

ktras added inline comments.May 4 2022, 2:28 PM
flang/test/Semantics/this_image02.f90
31

@klausler Thanks for your feedback.

rouson updated this revision to Diff 430744.May 19 2022, 11:10 AM
rouson marked 6 inline comments as done.

Add XFAIL directive and responding to one review comment by adding a keyword argument.

ktras added a comment.EditedMay 24 2022, 3:52 PM

The test is looking great, but I have recognized a couple more changes I would suggest. Please see the inline comments. I would also recommend adding a non-standard conforming call where a constant, either a named constant or a literal constant, is being passed to the dim argument and where its value is out of bounds of the corank of the coarray argument.

flang/test/Semantics/this_image02.f90
25

When the coarray argument is present, but the dim argument is not present, the result will be an array of rank one, so this could be moved to the non-standard conforming section of the test and it could be replaced with a call where the result is assigned to an array.

26

Similar to the comments on the line above, to keep this in the standards conforming section of your test, please replace the variable that the result of the call is being assigned to with an array.

ktras requested changes to this revision.May 24 2022, 3:53 PM

Please see my comment above.

This revision now requires changes to proceed.May 24 2022, 3:53 PM
rouson updated this revision to Diff 432158.May 25 2022, 5:55 PM
rouson set the repository for this revision to rG LLVM Github Monorepo.

This update fixes the standard-conforming this_image() invocations in which the optional dim argument is not present.

ktras accepted this revision.May 26 2022, 9:19 AM

LGTM

This revision is now accepted and ready to land.May 26 2022, 9:19 AM
rouson marked 2 inline comments as done.May 26 2022, 4:33 PM
This revision was automatically updated to reflect the committed changes.