Pragma_Examples: fix Fortran min/max/sum array reduction test discarding its device result - #191
Open
dannybaths wants to merge 1 commit into
Open
Conversation
…ts device result Signed-off-by: Daniele Bagni <30289343+dannybaths@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Pragma_Examples/OpenMP/Fortran/5_reduction_array/2_reduction_array_min_max_sum/reduction.f90reports the wrong answer for all eight of its sub-tests. Each one reports the
initialiser of its result variable rather than the reduction:
Test 1 int MAXprints the value of
-huge(imax_result),Test 4 int SUMprints0, and so on.All eight sub-tests use a bare
!$omp targetwith the reduction on an inner!$omp teams loop:A scalar referenced in a
targetregion with nomapordefaultmapclause isfirstprivate, so the value is copied in and never copied back. The device
performs the reduction correctly and the host then discards the result.
This change uses the combined construct instead, which is what the passing
sibling test
OpenMP_Language_Constructs_Fortran_Reduction_Arrayalready does:The change also removes this annotation above the test in
tests/CMakeLists.txt:That comment is a mis-diagnosis. The construct is implemented and the reduction is
computed correctly; only the data mapping was wrong.
Why
The test currently fails for a reason that has nothing to do with compiler
support, while an annotation in the test list attributes the failure to a missing
compiler feature. Anyone reading it learns the wrong lesson twice: that this
reduction form is unsupported, and that the code as written is correct.
Validation
MI300A / gfx942,
HSA_XNACK=1,amdflangfrom$ROCM_PATH/bin. Focused run onupstream
main(20e93223):On many raw clones the CTest driver does not pick up
amdflangunlessFCis setexplicitly as above.
Unpatched upstream: 1/1 FAIL. All eight sub-tests report wrong answers
(initialiser values); CTest misses the
ALL TESTS PASSEDregex.With this change: 1/1 PASS. Example lines:
AAC7 proof: current-main CTest on ROCm 10.0.0 — unpatched FAIL, patched PASS.
AAC6 no-regression: MI300A, Lmod
rocm/7.14.0, Slurm job19739onppac-pl1-s24-16— 1/1 PASS,ALL TESTS PASSED, withFC=$ROCM_PATH/bin/amdflang.