Repository navigation
refactor(csp-batch): the SSP source as a type, its selection and the age-sum dispatch (step 2, first slice) - #131
Merged
elijahmathews merged 1 commit intoNov 19, 2026
Conversation
…on and the age-sum dispatch (unification plan, step 2, first slice) ssp_source_t names where a batch's SSPs come from (resident basis, with two metallicity slabs, with two [alpha/Fe] planes too, weights over metallicities, the operators); ssp_source_select replaces the inline chain that chose its path label, and ssp_source_age_sums the chain of age-sum calls of the resident-basis kinds. Bit-identical (45 forward dumps). Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01MXDRCs7ATQiqhT6RLPLXR5
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## feat/hotpath-01-adjoint-slabs #131 +/- ##
=================================================================
+ Coverage 74.96% 75.02% +0.06%
=================================================================
Files 51 51
Lines 14414 14429 +15
Branches 6066 6066
=================================================================
+ Hits 10805 10826 +21
+ Misses 1479 1475 -4
+ Partials 2130 2128 -2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
elijahmathews
marked this pull request as ready for review
November 19, 2026 16:55
elijahmathews
added a commit
that referenced
this pull request
Nov 19, 2026
…hts block behind the SSP source (step 2, second slice) (#132) Stack: the unification plan (`doc/HOT_PATHS_PLAN.md`), step 2 of 5, second slice, after #131. Merge order: ..., #130, #131, this. ## What changes Two more pieces of the driver that were steered by the SSP-source flags move behind the source of #131: - `ssp_source_describe`: the per-model slab descriptor of the resident basis or the operators (`zlo`, `zhi`, `dz` from the model's `logzsol` with a basis per metallicity, and with the [alpha/Fe] planes of the context's stack the plane stride `nzs`, `da` and the slabs of the lower plane), and the refusal (status 2) of a model whose horizontal-branch modification is not in the operators of its metallicity. - `ssp_source_scalars`: the mass, L_bol and weights loops of the three kinds of source (weights over metallicities, the operators' own surviving mass and L_bol, the resident basis blended or its first plane), host and device, with the weights cast to kernel precision (the body of the loops is `model_sums` / `model_sums_zw` of #125). The driver calls them in place of the blocks (about 90 lines out of `compute_csp_batch`); the routines hold what they replace, so the file is about 95 lines longer with the type and the routines of both slices (7060 lines against 6965), not shorter: this slice is about the structure (the driver no longer forms the descriptor or runs the loops of a source), and the line count falls only when the remaining flag-steered code goes behind the source as well (the nebular calls, the backward pass: step 4). `doc/HOT_PATHS_PLAN.md` gets the status. ## Verification - 45 forward dumps of the free-parameter matrix, host FP64 (N = 1000) before and after: `tools/compare_forward_dump.py`, 0 differ bit for bit. - 45 forward dumps on the R9700 (FP32 kernels, ROCm container, both trees rebuilt from scratch, the compile logs have `csp_batch.f90`): 0 differ bit for bit. This slice moved device launch code (the mass and L_bol kernels) into a routine, so the device dumps are the check of it. - Host FP64 and FP32: unit suite (45), `test_csp_batch`, `test_batch_equivalence`, `test_csp_batch_grad` green. R9700 device tests (`ssp_operator`, `csp_batch`, `csp_batch_grad`, `batch_equivalence`, `c_batch_grad`, `physics_oracles`) pass. nvfortran 26.1 (NVHPC container): compiles for the A100; not run (no NVIDIA GPU): this PR moves device launches, so it joins the list for the ICDS session. 🤖 Generated with [Claude Code](https://claude.ai/code) https://claude.ai/code/session_01MXDRCs7ATQiqhT6RLPLXR5 Co-authored-by: Claude Sonnet 5.5 <[email protected]>
elijahmathews
added a commit
that referenced
this pull request
Nov 19, 2026
…e step 5 analysis (#133) Stack: the unification plan (`doc/HOT_PATHS_PLAN.md`), step 3 of 5, after #132. Merge order: ..., #131, #132, this. ## What changes - `slab_blend_wp` / `slab_blend_kp`: one definition of the blend that was written out at every site: `(1 - da) ((1 - dz) a + dz b) + da ((1 - dz) a' + dz b')` with the [alpha/Fe] planes, `(1 - dz) a + dz b` with a basis per metallicity, `a` with a single basis. Used for the nebular ionizing-photon sums (the table `q0`, the continuum rows of the basis, forward and in the backward pass) and in `model_sums` for the interpolated mass and L_bol. They are `declare target` (in the module's list) and `pure`. - Only the sites where the cascade was an exact match (five, and the two blends of `model_sums`): the derivative forms and the sites with another structure stay as they are, so the saving is a few lines; what changes is that there is one definition of the blend. - `doc/HOT_PATHS_PLAN.md`: the status of step 3, and the analysis of step 5 (the remaining conditionals are mostly the OpenMP device/host directive switch, which no template removes). Also trims three comment lines of #132 to 132 columns. ## Verification - 45 forward dumps of the free-parameter matrix, host FP64 (N = 1000): 0 differ bit for bit against the tip of #132. 45 on the R9700 (FP32 kernels, ROCm container, both trees rebuilt from scratch, `csp_batch.f90` in both compile logs): 0 differ bit for bit (the helpers run in device kernels). - Host FP64 and FP32: unit suite (45), `test_csp_batch`, `test_batch_equivalence`, `test_csp_batch_grad` green. R9700 device tests pass. nvfortran 26.1: compiles for the A100; not run (no NVIDIA GPU); this PR puts the helpers in device kernels, so it joins the list for the ICDS session. ## Where the plan stands Steps 0 - 3 are done; step 5 is analysed and stops at the age sums; step 4 (splitting the driver into stages) is the open one and is not started. 🤖 Generated with [Claude Code](https://claude.ai/code) https://claude.ai/code/session_01MXDRCs7ATQiqhT6RLPLXR5 --------- Co-authored-by: Claude Sonnet 5.5 <[email protected]>
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.
Stack: the unification plan (
doc/HOT_PATHS_PLAN.md), step 2 of 5, first slice, after #130. Merge order: ..., #129, #130, this.What changes
The driver chose where the SSPs of a batch come from with a chain of flags, twice: for the path label of
batch_infoand, further down, for which age-sum kernel to call. This gives the choice a name and one place:ssp_source_t(module-private): the kind (resident basis with one SSP, with two metallicity slabs, with two [alpha/Fe] planes too, the weights over ages and metallicities, or the operators of the batched SSP), the number of slabs or groups it blends (the K ofbatch_info) and the path label.ssp_source_select(zw, zmode, naf, nzb, ssp_ops): the selection that was an inline chain in the driver (and the label block ofbatch_info).ssp_source_age_sums(src, ctx, ...): the dispatch overage_sums,age_sums_w,age_sums_z,age_sums_z4, replacing the chain of calls; the operators' sums are done by their own pass, as before.This is the first slice of step 2, not the whole of it: the flags
zmode,zw,imf,zimfare still locals of the driver for the rest of their uses (the mass and L_bol block, the nebular calls, the backward pass, about 70 uses), and the descriptor arrays are still formed in the driver. Moving those behind the source is what makes the driver read as one path; it is the next slice, and I'd rather see this one through CI first.doc/HOT_PATHS_PLAN.mdgets the status.Verification
tools/compare_forward_dump.py, 0 differ bit for bit.test_csp_batch(including thebatch_infolabels),test_batch_equivalence,test_csp_batch_gradgreen.csp_batch.f90):ssp_operator,csp_batch,csp_batch_grad,batch_equivalence,c_batch_grad,physics_oraclespass.🤖 Generated with Claude Code
https://claude.ai/code/session_01MXDRCs7ATQiqhT6RLPLXR5