feat(params): support real(stp) declarations in Fortran codegen#1458
Open
sbryngelson wants to merge 7 commits into
Open
feat(params): support real(stp) declarations in Fortran codegen#1458sbryngelson wants to merge 7 commits into
sbryngelson wants to merge 7 commits into
Conversation
Contributor
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
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
Two small follow-ups on top of #1456 (auto-generated Fortran namelists/decls).
1.
real(stp)support in the parameter codegenAfter #1456, every
REALparameter the generator emits is hardcoded toreal(wp)(fortran_gen.py's_FORTRAN_TYPES). That's correct for the current parameter set — every generated scalar/array is computation-sidewp, and true storage-precision (stp) field data is a derived type / allocatable that the generator deliberately excludes. But there was no way to make the generator emitreal(stp)if a future scalar orFORTRAN_ARRAY_DIMSarray genuinely needed it — it would silently getwp.This adds an explicit, declarable escape hatch:
ParamDef.storage_precision: bool = Falsefortran_type_declhonors it forREAL/ANALYTIC_REAL→real(stp)(covers both scalar and array paths)_r(..., storage_precision=True)threads it throughBehavior-preserving for the current parameter set: generated output is byte-identical (all reals remain
real(wp), nostpleaks). Verified via the fullparams_testssuite (126 passed) plus a newtest_fortran_type_real_storage_precision.Known limitation (inherent): a
REALparam still defaults towp; this can't detect unstated intent. The only alternative — a hardcoded must-be-stpname list — is circular. So defaulting towpwith an explicit opt-in is the right floor.2. Agent-guidance docs: correctness + slimming
CLAUDE.mdand.claude/rules/*are all auto-loaded into agent context every turn, so accuracy and non-duplication matter. This pass:buff_sizewas documented as2*weno_polyn + 2(only the viscous-WENO case); corrected to the real per-scheme set (WENO/MUSCL/IGR + Lagrange/IB floors) with a pointer tos_configure_coordinate_bounds.m_checker.fppfiles whoses_check_inputsare empty for pre/post; rewrote it to say where a check actually runs (shared →m_checker_common.fpp, sim-only →simulation/m_checker.fpp, pre/post-only → their files).#ifdeftail) to essentials + source-of-truth pointers; collapses the duplicatedwp/stpdefinition to one home; adds a Working Style section pointing at thekarpathy-guidelinesskill; fixes the stale "6 checks" → "7 checks" count. No enforceable rule or domain fact removed.Test plan
./mfc.sh format -j 8(no changes)params_tests: 126 passed (incl. new stp test)buff_size, empty pre/post checkers)precheckhook passed on every commit./mfc.sh precheck -j 8/ CI