From 533e57a729c2a982fa425688362f35586a4be1df Mon Sep 17 00:00:00 2001 From: Andrew Nolan Date: Thu, 1 Oct 2026 10:07:46 -0700 Subject: [PATCH 1/2] Disable floating point contractions on GPU archs Also disabling fuse, multiply, add optimazation explicity where needed. --- components/omega/src/CMakeLists.txt | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/components/omega/src/CMakeLists.txt b/components/omega/src/CMakeLists.txt index a2f1ae537f58..ae1a07e462bf 100644 --- a/components/omega/src/CMakeLists.txt +++ b/components/omega/src/CMakeLists.txt @@ -27,6 +27,22 @@ target_compile_definitions( OMEGA_VECTOR_LENGTH=${OMEGA_VECTOR_LENGTH} ) +# Disable floating point contraction (e.g. fused multiply-add) for GPU +# architectures. Needed for ERS and PEM test to pass COMPARE step +if (OMEGA_ARCH STREQUAL "CUDA") + target_compile_options(OmegaLibFlags INTERFACE + $<$:--fmad=false -Xcompiler -ffp-contract=off> + ) +elseif (OMEGA_ARCH STREQUAL "HIP") + target_compile_options(OmegaLibFlags INTERFACE + $<$:-ffp-contract=off> + ) +elseif (OMEGA_ARCH STREQUAL "SYCL") + target_compile_options(OmegaLibFlags INTERFACE + $<$:-fp-model=precise -ffp-contract=off> + ) +endif() + if(OMEGA_SINGLE_PRECISION) target_compile_definitions( OmegaLibFlags From 63fc21ec1880f55b5b150944e0b348e8be9b8d21 Mon Sep 17 00:00:00 2001 From: Youngsung Kim Date: Fri, 23 Oct 2026 09:46:36 -0400 Subject: [PATCH 2/2] Add OMEGA_DISABLE_FP_CONTRACT CMake option Put the flags that disable floating point contraction on CUDA, HIP and SYCL behind a CMake option, OMEGA_DISABLE_FP_CONTRACT, which defaults to ON. Building with -DOMEGA_DISABLE_FP_CONTRACT=OFF leaves contraction to the compiler, as before, for comparing performance. --- components/omega/OmegaBuild.cmake | 1 + components/omega/src/CMakeLists.txt | 25 ++++++++++++++----------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/components/omega/OmegaBuild.cmake b/components/omega/OmegaBuild.cmake index bcbec9e954d4..2d4eb54fe10d 100644 --- a/components/omega/OmegaBuild.cmake +++ b/components/omega/OmegaBuild.cmake @@ -28,6 +28,7 @@ macro(common) option(OMEGA_LOG_FLUSH "Turn on unbuffered logging (default OFF)." OFF) option(OMEGA_TEST_CDASH "Turn on CDash support (default ON)." ON) option(OMEGA_EXTERNAL_PROF "Integration of Omega timers with external profiling tools (default OFF)." OFF) + option(OMEGA_DISABLE_FP_CONTRACT "Disable floating point contraction on GPU architectures (default ON)." ON) if("${OMEGA_BUILD_TYPE}" STREQUAL "Debug" OR "${OMEGA_BUILD_TYPE}" STREQUAL "DEBUG") set(OMEGA_DEBUG ON) diff --git a/components/omega/src/CMakeLists.txt b/components/omega/src/CMakeLists.txt index ae1a07e462bf..288318ae2066 100644 --- a/components/omega/src/CMakeLists.txt +++ b/components/omega/src/CMakeLists.txt @@ -28,19 +28,22 @@ target_compile_definitions( ) # Disable floating point contraction (e.g. fused multiply-add) for GPU -# architectures. Needed for ERS and PEM test to pass COMPARE step -if (OMEGA_ARCH STREQUAL "CUDA") - target_compile_options(OmegaLibFlags INTERFACE - $<$:--fmad=false -Xcompiler -ffp-contract=off> - ) -elseif (OMEGA_ARCH STREQUAL "HIP") - target_compile_options(OmegaLibFlags INTERFACE +# architectures. Needed for ERS and PEM test to pass COMPARE step. +# Controlled by OMEGA_DISABLE_FP_CONTRACT (default ON) +if (OMEGA_DISABLE_FP_CONTRACT) + if (OMEGA_ARCH STREQUAL "CUDA") + target_compile_options(OmegaLibFlags INTERFACE + $<$:--fmad=false -Xcompiler -ffp-contract=off> + ) + elseif (OMEGA_ARCH STREQUAL "HIP") + target_compile_options(OmegaLibFlags INTERFACE $<$:-ffp-contract=off> - ) -elseif (OMEGA_ARCH STREQUAL "SYCL") - target_compile_options(OmegaLibFlags INTERFACE + ) + elseif (OMEGA_ARCH STREQUAL "SYCL") + target_compile_options(OmegaLibFlags INTERFACE $<$:-fp-model=precise -ffp-contract=off> - ) + ) + endif() endif() if(OMEGA_SINGLE_PRECISION)