Skip to content

Commit 81f008e

Browse files
committed
260129.121820.CST fix a failure with mtest due to SYMTOL_DFT
1 parent b736a59 commit 81f008e

File tree

2 files changed

+21
-6
lines changed

2 files changed

+21
-6
lines changed

fortran/common/consts.F90

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ module consts_mod
88
!
99
! Started: July 2020
1010
!
11-
! Last Modified: Wednesday, April 10, 2024 PM09:18:10
11+
! Last Modified: Thu 29 Jan 2026 12:15:58 PM CST
1212
!--------------------------------------------------------------------------------------------------!
1313

1414
!--------------------------------------------------------------------------------------------------!
@@ -175,8 +175,8 @@ module consts_mod
175175
! IEEE Standard for Floating-Point Arithmetic (IEEE 754) is respected, particularly if addition and
176176
! multiplication are commutative. However, as of 20220408, NAG nagfor does not ensure commutativity
177177
! for REAL128. Indeed, Fortran standards do not enforce IEEE 754, so compilers are not guaranteed to
178-
! respect it. Hence we set SYMTOL_DFT to a nonzero number when PRIMA_RELEASED is 1, although we do not
179-
! intend to test symmetry in production. We set SYMTOL_DFT in the same way when PRIMA_DEBUGGING is 0.
178+
! respect it. Hence we set SYMTOL_DFT to a nonzero number when PRIMA_RELEASED is 1 (although we do not
179+
! intend to test symmetry in production, it may be tested if PRIMA_DEBUGGING is set to 1).
180180
! Update 20221226: When gfortran 12 is invoked with aggressive optimization options, it is buggy
181181
! with ALL() and ANY(). We set SYMTOL_DFT to REALMAX to signify this case and disable the check.
182182
! Update 20221229: ifx 2023.0.0 20221201 cannot ensure symmetry even up to 100*EPS if invoked
@@ -186,15 +186,30 @@ module consts_mod
186186
! Update 20231002: HUAWEI BiSheng Compiler 2.1.0.B010 (flang) cannot ensure symmetry even up to
187187
! 1.0E2*EPS if invoked with -Ofast and if the floating-point numbers are in single precision.
188188
! This same is observed for arm-linux-compiler-22.1 on Kunpeng.
189-
#if (defined __GFORTRAN__ || defined __INTEL_COMPILER && PRIMA_REAL_PRECISION < 64) && PRIMA_AGGRESSIVE_OPTIONS == 1
189+
! Update 20260129: AMD AOMP 26.1 cannot ensure symmetry up to TEN*EPS if invoked with -O3 -fast-math
190+
! and if the floating-point numbers are in single precision.
191+
!
192+
#if (defined __INTEL_COMPILER && PRIMA_REAL_PRECISION < 64 || defined __GFORTRAN__) && PRIMA_AGGRESSIVE_OPTIONS == 1
193+
! ifx with single precision and aggressive optimization options, or gfortran with aggressive
194+
! optimization options
190195
real(RP), parameter :: SYMTOL_DFT = REALMAX
191196
#elif (defined __FLANG && PRIMA_REAL_PRECISION < 64) && PRIMA_AGGRESSIVE_OPTIONS == 1
197+
! HUAWEI BiSheng Compiler or ARM Compiler with aggressive optimization options and single precision
192198
real(RP), parameter :: SYMTOL_DFT = max(5.0E3_RP * EPS, TEN**max(-10, -MAXPOW10))
193199
#elif (defined __INTEL_COMPILER && PRIMA_REAL_PRECISION < 64)
200+
! ifx with single precision
194201
real(RP), parameter :: SYMTOL_DFT = max(5.0E1_RP * EPS, TEN**max(-10, -MAXPOW10))
195-
#elif (defined __NAG_COMPILER_BUILD && PRIMA_REAL_PRECISION > 64) || (PRIMA_RELEASED == 1) || (PRIMA_DEBUGGING == 0)
202+
#elif (defined __NAG_COMPILER_BUILD && PRIMA_REAL_PRECISION > 64)
203+
! NAG Fortran Compiler with quadruple precision
204+
real(RP), parameter :: SYMTOL_DFT = max(TEN * EPS, TEN**max(-10, -MAXPOW10))
205+
#elif (PRIMA_RELEASED == 1) && PRIMA_REAL_PRECISION >= 64
206+
! Double or higher precision in released mode
196207
real(RP), parameter :: SYMTOL_DFT = max(TEN * EPS, TEN**max(-10, -MAXPOW10))
208+
#elif (PRIMA_RELEASED == 1)
209+
! Single or lower precision in released mode
210+
real(RP), parameter :: SYMTOL_DFT = max(1.0E2_RP * EPS, TEN**max(-10, -MAXPOW10))
197211
#else
212+
! Otherwise
198213
real(RP), parameter :: SYMTOL_DFT = ZERO
199214
#endif
200215

fortran/tests/makefiles/Makefile.common

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ AFF := -O4
9595
DFF := -O3 -Ofast -ffast-math # As of AOCC 5.1, -Ofast implies -O3, but it is not clear whether it implies -ffast-math; -O4 and -O3 are equivalent for AOCC 5.1
9696
FFF := -O3 -ffast-math # Suggested by flang 20.1.7
9797
GFF := -Ofast # -Ofast implies -O3 and -ffast-math
98-
MFF := -O3 -ffast-math # Suggested by AOMP 22.0-2 when running `amdflang --help | grep fast`
98+
MFF := -O3 -ffast-math # Suggested by AOMP 22.0-2 when running `amdflang --help | grep fast`, -Ofast is deprecated
9999
NFF := -O4
100100
RFF := -Ofast -ffast-math # -Ofast implies -O3, but no documentation found about the relation between -Ofast and -ffast-math
101101
SFF := -fast # -fast implies -O5 and ftrap=common

0 commit comments

Comments
 (0)