build: support amdflang (LLVMFlang) CPU builds via non-PIE link#1635
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the build-system compiler dispatch to recognize CMake’s LLVMFlang Fortran compiler ID (as used by AMD’s amdflang) and applies a non-PIE link for CPU-only Debug/RelDebug builds to avoid ld.lld PIE relocation failures when linking against non-PIC static dependencies.
Changes:
- Add a new
LLVMFlangcompiler branch incmake/GPU.cmake. - For CPU-only (
NOT (MFC_OpenMP OR MFC_OpenACC)) Debug/RelDebug builds, add-no-pieat link time and apply-O1 -gcompile options.
drcole17
added a commit
to cmtl-wpi/MFC-drcole
that referenced
this pull request
Jul 9, 2026
Sync 8 upstream commits: BC-routine unification (MFlowCode#1629), synthetic turbulence (MFlowCode#1548), extrusion v3 (MFlowCode#1349), amdflang CPU builds (MFlowCode#1635), batched example validation (MFlowCode#1634). Conflicts (all 'both added, keep both'): - m_global_parameters_common.fpp: thermal_conduction + synthetic_turbulence GPU_DECLAREs - m_checker.fpp: thermal_conduction/visc_model + synthetic_turbulence checks - m_start_up.fpp: conduction finalize + broadened body-forces finalize condition Verified: all 3 targets build+install on gfortran CPU. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.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.
Summary
Adds an
LLVMFlangbranch to the compiler dispatch incmake/GPU.cmakeso amdflang (AMD's LLVM-basedflang, which CMake identifies asLLVMFlang, distinct from classicFlang) can build the CPU targets.Previously amdflang matched no branch in
GPU.cmake, so a CPU build received no compiler-appropriate flags and Debug/RelDebug failed to link:ld.llddefaults to producing a PIE, but the static dependencies (e.g.libfftw3) are not built-fPIC. The new branch links a non-PIE executable for the non-LTO build types, which accepts those objects.Scope / safety
NOT (MFC_OpenMP OR MFC_OpenACC), so the merged OpenMP-offload GPU path (Add AMD HPCFund (amdfund) amdflang OpenMP-offload build/run support #1632) is untouched — it sets its own flags inMFCTargets.cmakeand links via the offload wrapper.Debug/RelDebug. Release is unchanged — it already linked, via LTO's link-time PIC codegen.rocm/7.2.0):simulationCPU Debug and Release both build clean.Caveats
-c amdfundstill defaults CPU builds to gfortran (from Add AMD HPCFund (amdfund) amdflang OpenMP-offload build/run support #1632); this only unblocks amdflang when a user selects it as the CPU compiler.