qbmm: hoist s_mom_inv's internal procedures to module scope - #1688
Open
sbryngelson wants to merge 1 commit into
Open
qbmm: hoist s_mom_inv's internal procedures to module scope#1688sbryngelson wants to merge 1 commit into
sbryngelson wants to merge 1 commit into
Conversation
The five procedures contained in s_mom_inv (s_coeff_selector, s_chyqmom, s_hyqmom, f_quad, f_quad2D) reference nothing from their host scope: every apparently-shared name is shadowed by the procedure's own dummy or local. Containment was organizational only. Calling a sibling internal procedure from device code needs the host frame chain, which CCE 21 rejects at runtime: OpenMP Execution Error: m_qbmm.fpp:984 - unsupported access to Fortran host-associated variable in GPU internal procedure (cray_inline=True inlines s_hyqmom into s_chyqmom, so the abort surfaces at the call site.) Module scope removes the construct entirely. Change is move-only: apart from the removed 'contains', all 922 lines are byte-identical after dedent. Verified on Frontier, CCE 21.0.2, 6/6: tests 0501B3DA, 6784C02E, 83291843 pass under both --gpu mp and --gpu acc.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR resolves a CCE 21.0.x OpenMP offload runtime abort in QBMM by eliminating calls between sibling internal procedures from device code, hoisting the five procedures previously contained within s_mom_inv to module scope in m_qbmm.
Changes:
- Removed the internal
containsblock insides_mom_invand endeds_mom_invbefore the helper procedures. - Hoisted
s_coeff_selector,s_chyqmom,s_hyqmom,f_quad, andf_quad2Dto module scope while keeping their bodies unchanged. - Preserved module encapsulation (module is
privateby default; only the existing public symbols remain exported).
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.
Problem
The five procedures contained in
s_mom_inv—s_coeff_selector,s_chyqmom,s_hyqmom,f_quad,f_quad2D— are internal procedures called from device code. On CCE 21.0.2 everyQBMM test aborts at runtime:
Line 984 is
call s_hyqmom(myrho, up, M1)insides_chyqmom. Both are internal procedures ofs_mom_inv, sos_chyqmomreaches its sibling through the host frame chain, which CCE 21does not support on device. (
cray_inline=Trueinliness_hyqmomintos_chyqmom, which iswhy the abort surfaces at the call site rather than at the callee.)
Why hoisting is safe
None of the five references anything from its host scope. Every name that appears to be
shared is shadowed by the procedure's own dummy or local:
wght,abscX,abscY,momins_chyqmompres,rho,c,coeffs_coeff_selectorq,r,s,wght_inf_quadmoms,M1,M3,myrho,up,i1sgm_eps,nmom,nnodeparameters (compile-time constants)weight,R0,nbContainment was organizational, not functional. Module scope removes the construct entirely
rather than working around the compiler.
The change is move-only
Apart from the removed
contains, all 922 lines are byte-identical after dedent:No logic, no expressions, no declarations changed.
Verification
Frontier (MI250X), CCE 21.0.2 / ROCm 7.2.0, MPI, 6/6:
--gpu mp--gpu acc0501B3DA1D Viscosity → Bubbles → QBMM → bubble_model=3 → cfl_adap_dt=T6784C02E1D Viscosity → Bubbles → QBMM832918432D Viscosity → Bubbles → QBMM → bubble_model=3Confirmed independently in a second session on two further QBMM tests (
284E0EF5,48B9D0C4). A full-suite run with this change shows zerounsupported access to Fortran host-associated variableaborts across 627 tests, on both backends../mfc.sh precheckpasses (7/7).This is a correctness fix worth taking regardless of compiler: calling a sibling internal
procedure from device code is not portable, and no other file in
src/simulationorsrc/commonstill does it.Context: #1684 (moving Frontier off
cce/19.0.0).