Make chunked plans own dependency graphs (Task G4) - #72
Open
asinghvi17 wants to merge 5 commits into
Open
Conversation
`ChunkedPlan` gains one `dependencies` field and the module one non-building accessor, `dependencies(plan)`. The relation is chosen once, at construction: `dependencies = nothing` (the default) holds none and does no relation work at all; `true` builds one at the plan's own `support_radius`; a `ChunkDependencyGraph` is adopted by reference after `validate_dependencies` certifies it; `false` holds none and rejects a stray narrow phase. `refine`/`narrow` are now keywords of lazy `plan_regrid` and of the `ChunkedPlan` constructor it forwards to, and of nothing else. `chunk_dependency_graph(plan; refine, narrow)` is deleted and the space form lost both keywords; the narrow phase moved to a private `_builddependencies` that only plan construction calls. An eager plan names each of the three keywords it refuses. `chunkgraph.jl` now precedes `plans.jl` so the plan's field type can name the graph's. Production's `dagplan` no longer builds a graph beside a plan: it constructs the global `ChunkedPlan` with the narrow phase and reads `GR.dependencies(globalplan)`, and the driver asserts that the object the schedule, refcount cache, prefetcher and validator share is that one. The relation is unchanged, measured: 326,064 edges, equal `DependencyIdentity`, 0.118 s warm. `regrid_chunk`'s per-column plans deliberately own none — a row view of the global graph is not their relation, because their destination is a different space, and `validate_dependencies` refuses it; a one-destination graph per column would cost 511x the time and 691x the allocation of the default (`benchmark/plan_dependency_ownership.jl`). `connectedchunkpairs` is deleted. Since #69 it ran line for line the loop `_chunkgraph` runs to fill its rows; its one assertion now reads the graph's own rows. Gates: `benchmark/chunk_graph_gates.jl` before and after is identical on every relation field across all 26 rows, both runs PASS on 9 oracle-checked cases. GlobalRegridding 3828 -> 3891 pass (+62 for the four new Phase 2 gate testsets, +1 for one added tag assertion), 1 broken, 0 fail; crosssystem regrid 202/0, copdem_policy 87/0, copdem_source_mode 7/0 all unchanged. Record: regrid-notes/2026-08-23-g4-plan-owns-graph.md Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019DuGKTmvs5B4EynwZddKMg
Phase 2 is complete. G4's card gets its landed note, including the one action it could not complete as written: production's per-column plans cannot take a validated row view, because their destination is a rooted one-chunk subtree grid rather than the global space the graph and its views are stamped against. "Never rebuild a one-destination graph per column" is met by construction and measured; "share the global graph or validated row views" would need destination-subspace re-stamping, which no card owns and which nothing would consume until E1. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019DuGKTmvs5B4EynwZddKMg
The `restrict` docstring now says the thing G4's measurement made concrete: a row view is the relation of those rows OF THAT SPACE, so a plan whose destination is its own smaller grid over the same cells has a different `spacestamp` and is refused — which is why production's per-column plans own no relation at all. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019DuGKTmvs5B4EynwZddKMg
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019DuGKTmvs5B4EynwZddKMg
This was referenced Aug 23, 2026
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.
Task G4 of
regrid-notes/2026-08-21-regridding-simplification-plan.md, Phase 2 — the last card of the phase. Stacked on #71 (which is stacked on #70); base isclaude/g3-graph-identity, notmainand notclaude/perf-ladder.Record:
regrid-notes/2026-08-23-g4-plan-owns-graph.md.What landed
ChunkedPlangains one field and the module one accessor:The relation is chosen once, at construction:
dependenciesnothing(default)support_radiustruechunk_dependency_graphChunkDependencyGraphspacestampcalls, aftervalidate_dependenciesfalserefine/narrowrefine/narroware keywords of lazyplan_regrid(and theChunkedPlanconstructor it forwards to) and of nothing else.chunk_dependency_graph(plan; refine, narrow)is deleted; the space form lost both keywords; the narrow phase moved to a private_builddependenciesthat only plan construction calls.regrid/regrid!take none.chunkgraph.jlnow precedesplans.jlin the include order.connectedchunkpairsis deleted — since #69 it ran line for line the loop_chunkgraphruns to fill its rows. Its one assertion intest_lazy.jlnow reads the graph's own rows.Phase 2 gate, as tests
Four new testsets, 62 assertions. The "not after the fact" half is a method error, not a runtime throw:
Base.kwarg_declover every method ofchunk_dependency_graph,restrict,regridandregrid!showsrefine/narrowabsent and overplan_regridshows them present;methods(chunk_dependency_graph, Tuple{ChunkedPlan})is empty; the field is on an immutable struct. "Exactly one" is proved with a probe space that counts everychunktreecall:0after a default plan, and unchanged by fivedependenciescalls on a plan that owns one.Production
scripts/copdem_production.jl:764— the call site this card exists to remove — is gone.dagplanconstructs the globalChunkedPlanwithdependencies = trueand the narrow phase, and readsGR.dependencies(globalplan); the driver gainedcheck("the graph is the global plan's own relation", ...). [measured] on the real GLO-90 × IGeo7-L12 pair: 326 064 edges, equalDependencyIdentity, 0.118 s warm — identical to before.Per-column plans own none, and the card's "share a row view" is not possible at this shape —
regrid_chunk's destination is a rooted one-chunk subtree grid, a different space from the 66 175-chunkPartialGrida row view stamps, sovalidate_dependenciesrefuses it (correctly). [measured],benchmark/plan_dependency_ownership.jl, 25 columns × 5 samples:dependencies = nothing— todaydependencies = truerestrict(graph, [d])C's cost is the
O(nsourcechunks)transpose G3 warned about, on the exact shape it warned about.Gates
benchmark/chunk_graph_gates.jlbefore and after: the relation is identical on every relation field across all 26 rows, including the production pair's 326 064 / 326 386 edges and the 72 / 394 crossing. Both runs printverdict: PASS on 9 oracle-checked case(s); 4 case(s) unchecked. Production case timing +0.6 %.f9f268a)lib/GlobalRegridding/testtest/systems/crosssystem/regrid.jltest/scripts/copdem_policy.jltest/scripts/copdem_source_mode.jlregrid_acceptance.jlCopernicusDEM/runtests.jl🤖 Generated with Claude Code
https://claude.ai/code/session_019DuGKTmvs5B4EynwZddKMg