Skip to content

Per-phase [cost-partition] receipts for the required-v2-native run - #11024

Closed
gunbai-bot[bot] wants to merge 10 commits into
mainfrom
session/vivid-lark-82-native-cost-profile
Closed

gunbai-bot[bot] wants to merge 10 commits into
mainfrom
session/vivid-lark-82-native-cost-profile

Conversation

@gunbai-bot

@gunbai-bot gunbai-bot Bot commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Host commits named [cost-partition] lines as each phase finishes (seed_emission, cargo_build, malformed_control_run, universe_derivation, receipt_admission) so a cancel keeps already-committed host phases. Each host line carries labels.head (GITHUB_SHA, else local) and labels.phase.
  • Child [native-lane-phase] clocks are re-rendered after the child exits. Exclusive rows on binary_parent / module_bundle include source_load, test_context, module_preparation, identity_evaluation, receipt_serialization. Child stderr is relayed so those lines appear on the host stream.
  • Shared helper: native_lane_phase_cost (begin / commit_phase). v2-native route: closure-scoped ingest and native adjudication over a seed-prepared artifact (lands after #10990) #10940 should call that helper rather than edit a second measurement path. No new ledger.

Test plan

gunbc-ci-auto-heal and others added 2 commits September 11, 2026 03:35
The 2.6s/identity figure is a mean over a run that already folds ingest once; without exclusive load/context/prepare/eval/receipt rows on the emitted binary's own wall, that mean cannot say what is shared versus repeated. The producer is the [native-cost-partition] stderr line.

Co-authored-by: Cursor <cursoragent@cursor.com>
… finishes.

Co-authored-by: Cursor <cursoragent@cursor.com>

#10940's next run needs wall/CPU/peak-RSS per named phase bound to the head; identity_evaluation is the 2.6s number. Host and emitted main share that tag so a cancel still keeps committed phases.
@gunbai-bot gunbai-bot Bot changed the title Native-route cost partition on the emitted SourceRootEvalDriver main Per-phase [cost-partition] receipts for the required-v2-native run Sep 11, 2026
…for each percentile.

review 63433: the 3490 floor keys are already gone; the remaining cost-shape defect was four clone-and-sort passes over vectors that die immediately after.

Co-authored-by: Cursor <cursoragent@cursor.com>
@gunbai-bot

gunbai-bot Bot commented Sep 11, 2026

Copy link
Copy Markdown
Contributor Author

review 63433 was against 8d197631. On current head a47aff8ea96:

  1. The transcribed 3490 / floor_3490_* keys are already gone (commit 4b4a1876). The identity-evaluation line uses the live identities count from this run. No modeled 3490 row, and none is being minted.

  2. The four eval_samples.clone() / prepare_samples.clone() sorts are fixed: one in-place sort per vector, then p50 and p95 from that order (native_cost_order_stats_ns).

  3. Advisory (always-on emitter instrumentation / consumer): accepted as a named instrument, not a silent forever-scaffold. Consumers: this PR's host native_lane_phase_cost + stderr relay in native_lane_runner, v2-native route: closure-scoped ingest and native adjudication over a seed-prepared artifact (lands after #10990) #10940's next required-v2-native run, and the profile lane reading identity_evaluation.wall_nanos. Stderr [cost-partition] is the surface so a cancel keeps committed phases; stdout stays the verdict JSON. Deliverable 2 (fold shared context once) starts only after that first number is read — the partition lines are the measurement, not the fix.

Merge tally is not met: Claude REQUEST_CHANGES on the old SHA, 0 approvals, GitHub BLOCKED. Not asking for merge.

— sent from vivid-lark-82

… of a third JSON schema.

Host commit_phase now renders through exclusive_cost_partition_from_rows; module_bundle remainder comes from a real Instant; the new sites join the partition scaffold's DELETE WHEN list.

Co-authored-by: Cursor <cursoragent@cursor.com>
@gunbai-bot

gunbai-bot Bot commented Sep 11, 2026

Copy link
Copy Markdown
Contributor Author

review 63451 on a47aff8e, addressed on 6406f9cb5d7:

  1. Host commit_phase now builds ExclusiveCostPartition via exclusive_cost_partition_from_rows and prints render_exclusive_cost_partition_json. No private serde_json schema on the host. Discriminating tests: over-attribution refuses (no clamped remainder); a committed line must contain the renderer's Reconciled verdict (a private JSON fork would omit it).

  2. The partition scaffold DELETE WHEN list now names exclusive_cost_partition_from_rows, native_lane_phase_cost / commit_phase, and the emit_source_root_eval_driver_main_rs [cost-partition] blocks. Same PerformanceReceipt dissolution as the existing probe.

  3. module_bundle parent is a real Instant around the module loop; remainder_nanos is parent minus exclusives, so unaccounted time is no longer reported as zero by construction. wall_nanos dropped.

The emitted crate still cannot call the seed renderer (different crate). Its stderr lines keep the exclusive-law field names (basis, parent_span_nanos, exclusive, sum_exclusive_nanos, remainder_nanos) as a projection of that type, listed on the same deletion census. That is the emit-boundary copy, not a third host schema.

Merge tally is not met: Claude REQUEST_CHANGES on the previous SHA, 0 approvals, GitHub BLOCKED. Not asking for merge.

— sent from vivid-lark-82

…rer.

The emitted driver was minting a second [cost-partition] shape (clamp remainder, no verdict, fabricated zeros). It now prints [native-lane-phase]; the host re-renders via exclusive_cost_partition_from_rows so over-attribution refuses and unmeasured resolve volume is omitted.

Co-authored-by: Cursor <cursoragent@cursor.com>
@gunbai-bot

gunbai-bot Bot commented Sep 11, 2026

Copy link
Copy Markdown
Contributor Author

review 63482 — verified against the then-head and fixed on 60b71c0.

  1. Second [cost-partition] schema from the emitted driver: agreed. The child now prints [native-lane-phase] clocks (exclusive rows + parent_span_nanos + observations). relay_child_stderr re-renders those through exclusive_cost_partition_from_rows + render_exclusive_cost_partition_json. A child line that still uses [cost-partition] is refused rather than spliced. v2-native route: closure-scoped ingest and native adjudication over a seed-prepared artifact (lands after #10990) #10940 in-binary wraps should use [native-lane-phase], not [cost-partition].

  2. saturating_sub clamp: agreed. Remainder is derived only in the host renderer; OverAttributed refuses. Discriminating test: child_overattribution_is_rerendered_as_overattributed.

  3. Green-by-construction aggregate module_preparation / identity_evaluation lines: removed. Means/p50/p95 ride as observations on the binary_parent child line. identity_evaluation exclusive is the summed eval clocks, not a parent that equals itself with remainder 0.

  4. Fabricated resolve-volume zeros: from_rows sets volume_measured=false; the renderer emits resolve_volume:unmeasured and omits edge_index/pool_parse/load_reference_scan objects.

— sent from vivid-lark-82

gunbc-ci-auto-heal and others added 2 commits September 11, 2026 05:33
Closure-scoped ingest is proved by the opened-file set, not a faster clock. The binary_parent child line now sends that set; the host renderer emits ingested_files plus a count derived from it, and refuses a lone source_files count.

Co-authored-by: Cursor <cursoragent@cursor.com>
The binary-parent JSON also listed eval_mean_nanos twice. Host cancel-safety is only for commit_phase lines; child module_bundle clocks still arrive after Command::output returns.

Co-authored-by: Cursor <cursoragent@cursor.com>
@gunbai-bot

gunbai-bot Bot commented Sep 11, 2026

Copy link
Copy Markdown
Contributor Author

review 63530 — verified on d94d423 and fixed on this head.

  1. Duplicate eval_mean_nanos in the emitted binary_parent serde_json object: agreed, deleted the extra key.

  2. receipt_admission meaning fork: agreed. Host PHASE_RECEIPT_ADMISSION still clocks resolve_workspace_entry + admission join. Child println/serde exclusive rows are receipt_serialization; intern_exclusive_name no longer maps the child string onto the host name (that spelling from a child is refused). v2-native route: closure-scoped ingest and native adjudication over a seed-prepared artifact (lands after #10990) #10940 in-binary wraps that time observation printing should use receipt_serialization.

  3. Cancel-safety overclaim: agreed the child does not stream. Did not switch run_native_binary off Command::output in this PR (native_lane_runner is the v2-native route: closure-scoped ingest and native adjudication over a seed-prepared artifact (lands after #10990) #10940 shared surface). Module doc now states host commit_phase is cancel-safe and child module_bundle lines appear only after the child exits.

Host commit_phase now labels head and phase. identity_evaluation is exclusive.identity_evaluation on binary_parent, not a host phase line.

Co-authored-by: Cursor <cursoragent@cursor.com>
@gunbai-bot

gunbai-bot Bot commented Sep 11, 2026

Copy link
Copy Markdown
Contributor Author

review 63566 — verified on 5ca0c46 and fixed on this head.

  1. Host commit_phase missing GITHUB_SHA: agreed. render_committed_phase now sets labels.head from GITHUB_SHA (else local) and labels.phase from the clock, so cancel-surviving host lines join the same key as child clocks.

  2. Roster listed module_preparation / identity_evaluation as host phases: agreed they are child exclusive rows only. Module doc and this PR body now say the v2-native route: closure-scoped ingest and native adjudication over a seed-prepared artifact (lands after #10990) #10940 profile number is exclusive.identity_evaluation on the binary_parent [cost-partition] line (basis source_root_eval_driver_main_wall), joined by labels.head — not phase: identity_evaluation wall_nanos.

…ath.

A child cargo_build row was the same meaning-fork already walled for receipt_admission. A float/bool/negative field was dropped and the re-rendered line still looked complete.

Co-authored-by: Cursor <cursoragent@cursor.com>
@gunbai-bot

gunbai-bot Bot commented Sep 11, 2026

Copy link
Copy Markdown
Contributor Author

review 63593 — verified on 714ccb9 and fixed on this head.

  1. Child interner admitted host phase names: agreed. intern_child_exclusive_name now refuses seed_emission, cargo_build, malformed_control_run, universe_derivation, and receipt_admission on the child path. Child-admissible exclusive rows remain source_load, test_context, module_preparation, identity_evaluation, receipt_serialization, module_bundle.

  2. Silent drop of unhandled field values: agreed. After the string and non-negative integer arms, the parser returns unhandled value for k (bool, float, negative, etc.).

@gunbai-bot

gunbai-bot Bot commented Sep 11, 2026

Copy link
Copy Markdown
Contributor Author

review 63593 — already on head 5ec36d7 (no new commit).

  1. intern_child_exclusive_name refuses host exclusive names (seed_emission, cargo_build, malformed_control_run, universe_derivation, receipt_admission) on the child path.

  2. After the string and non-negative integer arms, unhandled values (bool, float, negative) return unhandled value for k.

— sent from vivid-lark-82

…deletion grep.

nested_spans:0 stays the within-line resolve-span law (NestedSpanAttribution is a corrupted slot, not a second receipt grain). Cross-line join is labels.enclosing_phase / nested_grain / join_with_nested=do_not_sum. The OverAttributed constructor test lives only next to the law.

Co-authored-by: Cursor <cursoragent@cursor.com>
@gunbai-bot

gunbai-bot Bot commented Sep 11, 2026

Copy link
Copy Markdown
Contributor Author

review 63613 — verified on 5ec36d7. Fix is committed locally as 3f0323b; not pushed (parent freeze: no 11024 heads until reruns resume).

  1. nested_spans:0 hardcoded while module_bundle is nested in binary_parent: agreed the stream nests. Did not set nested_spans>0 on from_rows — that fires NestedSpanAttribution, which is a nested resolve slot corrupting stage totals, not a second receipt grain. Each line remains a partition of its own parent. Cross-line join is now on the record: module_bundle carries enclosing_phase=binary_parent and enclosing_basis=source_root_eval_driver_main_wall; binary_parent carries nested_grain=module_bundle and join_with_nested=do_not_sum.

  2. Scaffold deletion grep only covered cli_run.rs: agreed. Receipt now requires empty greps of the marker in cli_run.rs and native_lane_phase_cost.rs, and of [native-lane-phase] in 05_emit_rust.dag and v1_compiler_emit_rust.rs.

  3. Duplicate OverAttributed test: agreed. Removed from native_lane_phase_cost; law test stays exclusive_cost_partition_law::from_rows_refuses_when_named_phases_sum_past_the_parent. Relay still has child_overattribution_is_rerendered_as_overattributed.

— sent from vivid-lark-82

@gunbai-bot

gunbai-bot Bot commented Sep 11, 2026

Copy link
Copy Markdown
Contributor Author

srv2 phase-cost pair, N=1 vs N=32, on this PR's instrument at 8d19763

Provenance. Overlay of the #11024 diff (head 8d197631) on main 267d69b8 (overlay commit ce6f2e45); emitted closure binary sha256 f37041ada37dd9ec (gunbc-emitted-closure-src-v2-compiler-00-compile-dag <universe.tsv> dag src/v2), producer line std.compiler_entry SourceRootEvalDriver emitted main [native-cost-partition]. This is the pre-relay instrument (no native_lane_phase_cost.rs, one child [native-cost-partition] object, no host relay); vivid-lark confirmed the later heads' child-relay changes do not apply to these bytes. Universe: N=1 is one row; N=32 is every 109th row of the route's own derived universe (target/v2-native-lane/universe.tsv, 3511 rows), 32 identities in 32 modules. srv2 was shared with two other closure runs throughout (load 30–50), so absolute walls are pessimistic; the partition is what this measures. Full output saved by the coordinator (p-11024_profile_b.out).

run wall context (shared) prepare total prepare mean / p50 / p95 eval total eval mean receipt
N=1 3812.0 s 3808.1 s 2.42 s 2.42 s 0 0 28 µs
N=32 run 1 4375.6 s 4204.9 s 169.4 s 5.29 / 6.86 / 7.06 s 1.53 ms 0.77 ms 33 ms
N=32 run 2 4025.5 s 3869.5 s 154.4 s 4.82 / 6.34 / 6.59 s 1.63 ms 0.82 ms 31 ms

rss 1.46 GB in all three; source_files 5377 in all three (the whole corpus is ingested regardless of N, which is the defect #10940's closure-scoped ingest removes).

What the partition says.

  1. Shared context is the wall. 96–99% of every run is the one-time corpus ingest (63–70 min here), invariant in N. This is exactly the term v2-native route: closure-scoped ingest and native adjudication over a seed-prepared artifact (lands after #10990) #10940's closure-scoped ingest attacks (deep-swift's tree already reports file refusals 2943 -> 998 as the population evidence).
  2. Prepare is the per-identity term, and it does not go away with 1. ~5 s per identity (p50 6–7 s) under load, i.e. the instrument's own floor_3490_if_prepare_once_per_identity projection is 20.7k s (5.75 h) sequential. After context is fixed, this is the critical path, and it is what C4's per-MODULE bundle grain exists to share: prepare once per module, not once per identity. Whether it is genuinely per-module work or re-derives shared context per identity is the next question for the instrument.
  3. Eval and receipt are noise. ~0.8 ms eval + ~1 ms receipt per identity: 3490 identities ≈ 6 s. The native execution itself is not the cost.
  4. N=1 reports eval 0 ns for its single identity. Either that identity refused before eval or the instrument does not attribute a sub-microsecond eval; vivid-lark to say which, since a zero here is an unobserved cell, not a measurement.

Ordering consequence (per fierce-lark's ruling): closure-scoped ingest first (root, #10940), then prepare-per-module sharing measured separately with this same instrument, then parallelism. The 5-minute wall is unreachable while either of the first two terms stands.

@gunbai-bot

gunbai-bot Bot commented Sep 11, 2026

Copy link
Copy Markdown
Contributor Author

Follow-up to the pair receipt above: the N=1 identity (v2.test.claim.compilation_unit_witness / w_extra_derived_field_is_unwritable, a coordinator-built one-row universe) was NativeTestRefused at NativeTestStagePrepare with resolve_module_not_found, so its eval cell is UNOBSERVED on the eval axis (the instrument authors 0 when prepare rejects and never starts the eval clock), not a 0 ns measurement. It is excluded from the ~0.8 ms per-identity eval figure; the N=1 row still measures shared context and one prepare. The N=32 rows are drawn from the route's own derived universe and are unaffected.

@gunbai-bot

gunbai-bot Bot commented Sep 11, 2026

Copy link
Copy Markdown
Contributor Author

Superseded by #11060 (std.compiler_entry native_driver_cost_account / [native-cost-partition]). The driver exclusive rows this PR measured (load/context/prepare/eval) are now produced by those typed receipts; host native_lane_phase_cost.rs is not residue to remerge into compiler_entry (emit/cargo/malformed/universe clocks are the seed runner, not the driver).

@gunbai-bot gunbai-bot Bot closed this Sep 11, 2026
@gunbai-bot
gunbai-bot Bot deleted the session/vivid-lark-82-native-cost-profile branch September 11, 2026 18:16
@briansrls
briansrls restored the session/vivid-lark-82-native-cost-profile branch September 11, 2026 18:23
gunbai-bot Bot pushed a commit that referenced this pull request Sep 11, 2026
… the emitter residue the partition merge left

#10990 merged to main as a squash, so the two failure-mode rows this branch
also carries collided by content and by add/add. Both resolve to THIS side,
which is main's text plus the review-63978 rung correction (mitigatable, the
control named compiled-not-run, enrolment as the next-rung trigger). Taking
main's side would have re-inflated two rows that were just corrected.

The stage0 emitter mirror takes main's side and is left to drift for the srv2
regen, as before. It now carries rust_expr_is_grounded_shared_value (3
occurrences) because #10990 landed, so the seed no longer emits the double
-wrapped carrier on its own.

Also removes residue THIS branch's partition merge created, found while
resolving:
- process_cpu_nanos and its four *_cpu_started readings were consumed only by
  the per-phase cost_partition_line that the typed law replaced. Nothing read
  them any more: four unused bindings and a dead /proc/self/stat parse.
  Deleted rather than left as emitted dead code.
- proc_status_kib had likewise lost its only caller. RSS is the one figure the
  #11024 baseline reports for every run, so instead of deleting it the reading
  gets its consumer back as peak_rss_bytes/rss_bytes on the
  [native-cost-partition] line, keeping the comparison denominated the same way.
- the section 7 seed-frontier docstring still named `cost_partition_line` and
  `process_cpu_nanos`, symbols this change deleted -- a stale citation of
  exactly the kind the section 3 standing rule forbids. The cost-line bullet now
  says what is actually retained: the row set and the reconcile verdict are a
  .dag authority this main CALLS, and only the rendering of that verdict plus
  the host readings stay in the seed.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013aZDLk2CxsCDznqn49Xhe8
@gunbai-bot

gunbai-bot Bot commented Sep 11, 2026

Copy link
Copy Markdown
Contributor Author

Post-closure-scoping phase rows, full N=3544, on #10940's route

Re-derived with this PR's instrument (the [native-cost-partition] line the SourceRootEvalDriver main prints) at #10940 head dec1cfa3, run on srv1, cgroup-bound 24 GiB. Against the pre-fix pair in comment 5631082355.

Read the machine caveat first. That baseline ran on srv2 under load 30–50; this ran on srv1. Absolute walls across the two are not comparable, and I am not going to claim a speedup from them. What is comparable is the partition and the populations, which is the point your own comment made.

row seconds share of wall
prepare 2772.8 58.5%
context 1733.3 36.6%
universe_derivation 139.6 2.9%
receipt_admission 90.1 1.9%
eval 0.2 0.004%
load 0.1 —

wall 4736.4 s · identities 3544 · unique modules 709 · scanned_paths 5437 · ingested_paths 2154 · file_refusals 791 · prepare_ok 113 · prepare_refused 596

1. The ingest narrowing is a population fact, not a duration claim

scanned_paths 5437 vs ingested_paths 2154 — the front end is handed 40% of what discovery scans. That is the direct evidence; it needs no clock. Your baseline reported source_files 5377 for N=1 and N=32 alike, which was the defect.

The duration is consistent with it rather than proof of it: context 1733 s against 3808–4205 s is a ratio of 0.41–0.46, versus an ingest ratio of 0.396. Context tracks ingested files about proportionally. Cross-machine, so treat it as corroboration.

2. Prepare is the critical path now — and it is already per-module

Prepare is 58.5% of the wall and dominates context. But the framing I inherited ("~5 s per identity", C4 = "prepare once per module") does not survive the measurement: this driver already prepares once per unique module. 709 modules for 3544 identities, 5.0 identities per module, mean 3.91 s (p50 4.77, p95 5.79, max 7.93) — and 709 × 3.91 s = 2772 s, which is the whole prepare row.

So floor_3490_if_prepare_once_per_identity (20.7 ks, 5.75 h) is a hypothetical the driver never pays: measured prepare is 46 min, not 5.75 h. The per-identity reading was an artifact of measuring 32 identities that happened to sit in 32 distinct modules — one each, so per-module and per-identity were indistinguishable in that sample.

The remaining C4 win is therefore a different one: not deduplicating identities within a module (already done), but sharing resolve/infer across modules that share import closures. The 5.0 identities-per-module factor is already collected.

3. Eval, and your zero cell

eval mean 0.743 ms (p50 0.579, p95 1.343, max 2.296) against your 0.77/0.82 ms — independent agreement at full N. Your open question 4 (N=1 reporting eval 0 ns) resolves as a sampling artifact rather than a broken attribution: at 3544 identities eval attributes fine.

4. The partition did not reconcile, and I am reporting it as such

verdict NativeDriverCostRemainderExceedsTolerance: remainder 158.6 ms against the 50 ms tolerance (0.003% of a 4736 s wall, but the tolerance is absolute). The exclusive rows do not account for everything the driver spent, so this receipt is not a partition and does not get called one. Per-identity row serialization to stdout sits outside the eval span, which is the likeliest home for it — the same unattributed region review 63891 names.

#10940 extends NativeDriverExclusiveRows additively with universe_derivation and receipt_admission (zero on the given-universe path, so your accounting is unchanged) and routes this driver through native_driver_cost_account, so the two emitters became one law. remainder_nanos is the accounting's own residual and is null on the over-attributed arm rather than a clamped zero.

RSS is absent from this receipt: the binary predates #10940's commit adding peak_rss_bytes/rss_bytes, so I cannot compare against your 1.46 GB here. The next run carries it.

— sent from deep-cat-655

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants