From ea1ee567fbb20fea5d4815c015bcf9ebae0a5bd2 Mon Sep 17 00:00:00 2001 From: Spencer Bryngelson Date: Fri, 2 Oct 2026 22:42:08 -0500 Subject: [PATCH 1/2] Add -fopenmp-assume-no-thread-state to the amdflang offload flags No MFC kernel changes OpenMP ICVs on the device, so the per-kernel thread-state bookkeeping can go. On AFAR 24.3 (MI210) every benchmark case gets 1.17-1.35x faster (geomean 1.21x); 207 tests pass. This is the only part of -fopenmp-target-fast (dropped in #1450) not already set. --- cmake/MFCTargets.cmake | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cmake/MFCTargets.cmake b/cmake/MFCTargets.cmake index e2ed8e7361..39e4a4e0ac 100644 --- a/cmake/MFCTargets.cmake +++ b/cmake/MFCTargets.cmake @@ -205,13 +205,16 @@ exit 0 # (a suffix of loop iterations silently skipped), which -O3 happens to # mask today. Codegen is unchanged on amdflang; it is a win on upstream # flang. + # assume-no-thread-state: no kernel changes OpenMP ICVs on the device, so + # the per-kernel thread-state bookkeeping is dropped (~1.2x on AFAR 24.3). target_compile_options(${a_target} PRIVATE -fopenmp --offload-arch=gfx90a -O3 -fopenmp-assume-threads-oversubscription -fopenmp-assume-teams-oversubscription - -fopenmp-assume-no-nested-parallelism) + -fopenmp-assume-no-nested-parallelism + -fopenmp-assume-no-thread-state) # attributor-max-pi-accesses: amdflang generates device code for the WHOLE # image at link time, and once the image carries enough target regions the # device link's Attributor exceeds its AAPointerInfo access cap on a From 198c5c0a232c36093337d1c67cf14514f5f000e1 Mon Sep 17 00:00:00 2001 From: Spencer Bryngelson Date: Fri, 2 Oct 2026 23:30:26 -0500 Subject: [PATCH 2/2] Update m_global_parameters.fpp --- src/simulation/m_global_parameters.fpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/simulation/m_global_parameters.fpp b/src/simulation/m_global_parameters.fpp index e72afb668c..5832989527 100644 --- a/src/simulation/m_global_parameters.fpp +++ b/src/simulation/m_global_parameters.fpp @@ -9,7 +9,7 @@ module m_global_parameters #ifdef MFC_MPI - use mpi !< Message passing interface (MPI) module + use mpi #endif use m_derived_types