OpenMP_VV icon indicating copy to clipboard operation
OpenMP_VV copied to clipboard

Undefined behaviour with tests/4.5/target_teams_distribute/test_target_teams_distribute_nowait.F90

Open tob2 opened this issue 2 years ago • 2 comments

The testcase defines INTEGER(INT64),DIMENSION(N, N_TASKS):: work_storage, does not map work_storage and then:

https://github.com/SOLLVE/sollve_vv/blob/ea88f50028a5e56709ca1b4467e05c4689a374fb/tests/4.5/target_teams_distribute/test_target_teams_distribute_nowait.F90#L45-L46

Namely, it runs asynchronous and maps a disjunct array sections/storage of the array.

When run asynchronously, I do see fails here when the unmapping happens for one target region while another is still running.

I believe this violates the following wording of OpenMP 5.1 (= 5.2), "Restrictions to the map clause are as follows:"

  • If an array appears as a list item in a map clause, multiple parts of the array have corresponding storage in the device data environment prior to a task encountering the construct associated with the map clause, and the corresponding storage for those parts was created by maps from more than one earlier construct, the behavior is unspecified.

Thus:

  • I belief that "array" refers in this case to the containing array, i.e. to the whole of work_storage – and not to the array item / array section work_storage(1:N, x).

  • I note that the wording was added for 5.1 and the testcase is for 4.5, but I read the 5.1 wording as clarification/correction and not as a non-backwards compatible change.

  • For completeness, the 5.1 wording was added for the non-publicly accessible OpenMP Spec Issue 1909

Do you concur that the wording above makes the testcase invalid? If not/if unsure, we could ask the experts.

@nolanbaker31 @tmh97 @spophale – thoughts?

tob2 avatar May 13 '22 09:05 tob2