Pragma_Examples: fix Fortran min/max/sum array reduction test discarding its device result - #191
Conversation
…ts device result Signed-off-by: Daniele Bagni <30289343+dannybaths@users.noreply.github.com>
|
@dannybaths please make sure to always mention the environment you are in so we can reproduce 1-1. |
|
please make sure to test the same rocm versions when you test on aac7 and aac6 so we compare apples to apples |
|
it would also be very helpful to test across 3 rocm versions because the compiler moves very fast so maybe check ROCm 7.2.4 ROCm 7.14 and ROCm 10, and the AFARs too since those are the ones that have the latest on the Fortran compiler |
|
Bob already changed this test so I am closing this PR, thanks @dannybaths |
|
Good catch. I got the same analysis and posted in the compiler channel. I rewrite the test to fix the problem. It is kind of a strange corner case that is unexpected. |
|
There is one item here that may be glossed over. That is the setting of the FC compiler. The test script sets: The analysis set FC to point to export FC="${ROCM_PATH}/bin/amdflang". We need to confirm that the ftn is set to point to the amdflang compiler. |
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.