Repository navigation
Rebase #5135 (fix/infer-perf-body-producer) onto main + resolve the §3/§7 REQUEST_CHANGES: model substitute_generics_apply identity short-circuit in 04_infer.dag + regen seed - #5146
Conversation
…esses Root cause for 244s body_producer resolve was decode_value_expression_projection_bundle (15-deep bind_outcome in target_model, ~287s analyze_item), not body_producer itself. Shard into one-bind chain steps (244s→~23s). Execution instrumentation confirms H2a: substitute_generics 13446 calls / 169 distinct sites (ratio 79.6) — memo deferred to merry-owl cache-kernel consolidation per §3. Adds §5 witness (bounded resolve + wrong-type RED). Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Accidental removal of Commands::Ci and extdeps_shape_transport_policy_project broke CI (`gunbc ci` unrecognized). Restore both alongside generic-inst instrumentation. Co-authored-by: Cursor <cursoragent@cursor.com>
Keep generic_instantiation_instrument and interface_elaboration_instrument modules from the perf-fix branch. Co-authored-by: Cursor <cursoragent@cursor.com>
…ducers Empty `diagnostics: []` failed resolve (Diagnostics is None | Some, not List). Co-authored-by: Cursor <cursoragent@cursor.com>
Remove generic_instantiation_instrument and interface_elaboration_instrument (hand-Rust scaffolding with no dissolution receipt). H2a localization and the structural perf fixes are proven; hooks added per-call overhead on substitute_generics/build_type_env/typecheck_module. Guard enrollment tracks in follow-on #5139. Co-authored-by: Cursor <cursoragent@cursor.com>
substitute_generics uses map_is_empty(subst) in 04_infer.dag; without builtin_function_registry entry it fell through to unit_type() and diverged from hand-synced Rust. Wire .dag authority + seed + interpreter. Co-authored-by: Cursor <cursoragent@cursor.com>
… 04_infer.dag Resolves the §3/§7 REQUEST_CHANGES: the seed's substitute_generics_apply preserved Node identity via a short-circuit (Rc::ptr_eq on the resolved inferred node + rc_vec_ptr_eq on children/params) that the .dag never modeled and could not emit — a second authority for infer behavior in a "do not edit" generated seed. Model it in 04_infer.dag as a SOUND IDENTITY HINT (true => structurally equal): recurse children/params/inferred, return the original n when all are unchanged, else rebuild. Surface the primitives as ordinary builtins with OWNED Rc signatures (cheap refcount bump preserves inner pointers), so they emit through the normal clone path — no all-args-by-ref emit rule and no emit-logic change: - runtime_rust.dag: add rc_ptr_eq, flip rc_vec_ptr_eq to owned + contract - extdeps/languages/rust/emit.dag: register map_is_empty, rc_ptr_eq, rc_vec_ptr_eq in rt_function_registry (map_is_empty also never round-tripped before — fixed here) - 04_method.dag: register rc_ptr_eq/rc_vec_ptr_eq result types - v1_interpreter.rs: value-equality realization of the same contract Seed regenerated via regen_stage0 from the .dag (round-trip proven: the emitter now produces v1_rt::rc_ptr_eq(new_rt.clone(), rt.clone()) etc.). Narrow seed update only — a blanket regen also rewrites unrelated files (emit_rust.rs wire_variant_tag_for_policy, extdeps_cargo.rs) byte- identically on main too, a pre-existing emit non-fixpoint tracked separately; adopting it would regress the seed (broken /* Type */ placeholder), so it is out of scope here. Also fixes pre-existing PR-branch CI dirtiness: cargo fmt on build_type_env + the perf witness/profile tests, and #[cfg(test)] on the profile test module (the lone module missing it, which failed clippy --all-targets). Proof: crate builds, clippy --all-targets -D warnings green, fmt clean, body_producer_infer_perf_witness green (clean resolve + wrong-type RED). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
d9ef67e to
3d0aa5f
Compare
§3/§7 resolution + stash-regen control (why narrow, not blanket-regen)The §3/§7 finding is resolved: This is a narrow seed update, not a blanket Control (proves the collateral is pre-existing, not induced by this change):
Proof bar: crate builds; |
…nblock) resolve_expr_types double-resolved every child in its variable-arity arms (ExprCall/RecordLit/MethodCall/Match/StringInterp): one traversal built the resolved children, a sibling traversal re-resolved the SAME children to re-collect diagnostics. A nested constructor's tail child is itself such a node, so each level doubled the recursion -> O(2^depth) (#5146-class). This was the N_v2 self-host blocker: resolve_entry_graph hung >800s on the generated host_source_root_ingest_manifest, whose host_compiler_closure_admission .imports is a ~20-deep Cons chain (195s, constant in record count) and whose host_source_root_ingest is a 59-deep chain. Fixed in BOTH the .dag authority (src/v1/04_resolve.dag) and the v1 seed (v1_compiler_infer_resolve.rs): bind the per-child result ONCE, then split map(.expr)/flat_map(.diagnostics) — the shape the in-file ExprListLit/ExprBlock siblings already used. Proof by execution: N_v2 substrate resolve 279s (was >800s exit-124); scaling probe linear (n=20 hang -> 87s); purity oracle green (resolve_typed_cache_ equivalence, identical self_gen8 pass/fail split pre/post) — result-identical, only faster, since resolve_expr_types is pure (resolving once == twice). Guard: resolve_expr_types_retraversal_guard_test source-bridges the real 04_resolve.dag Node and flags any arm with >=2 sibling self-calling traversals (RED on the real pre-fix source: 5 arms; GREEN post-fix). Enrolled in the CI rust gate via ci_spec. The 9 nv2_gate_resolve_bisect scaffolds dissolve per their root-caused trigger; a cleaned scaling probe remains as the perf harness. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…nblock) (#5258) * WIP: Resolve-perf bisect+fix: pin which direct-import's full-interface elabor * WIP: Resolve-perf bisect+fix: pin which direct-import's full-interface elabor * WIP: Resolve-perf bisect+fix: pin which direct-import's full-interface elabor * WIP: Resolve-perf bisect+fix: pin which direct-import's full-interface elabor * WIP: Resolve-perf bisect+fix: pin which direct-import's full-interface elabor * WIP: Resolve-perf bisect+fix: pin which direct-import's full-interface elabor * WIP: Resolve-perf bisect+fix: pin which direct-import's full-interface elabor * WIP: Resolve-perf bisect+fix: pin which direct-import's full-interface elabor * WIP: Resolve-perf bisect+fix: pin which direct-import's full-interface elabor * WIP: Resolve-perf bisect+fix: pin which direct-import's full-interface elabor * Fix O(2^depth) resolve_expr_types: bind-once child resolution (N_v2 unblock) resolve_expr_types double-resolved every child in its variable-arity arms (ExprCall/RecordLit/MethodCall/Match/StringInterp): one traversal built the resolved children, a sibling traversal re-resolved the SAME children to re-collect diagnostics. A nested constructor's tail child is itself such a node, so each level doubled the recursion -> O(2^depth) (#5146-class). This was the N_v2 self-host blocker: resolve_entry_graph hung >800s on the generated host_source_root_ingest_manifest, whose host_compiler_closure_admission .imports is a ~20-deep Cons chain (195s, constant in record count) and whose host_source_root_ingest is a 59-deep chain. Fixed in BOTH the .dag authority (src/v1/04_resolve.dag) and the v1 seed (v1_compiler_infer_resolve.rs): bind the per-child result ONCE, then split map(.expr)/flat_map(.diagnostics) — the shape the in-file ExprListLit/ExprBlock siblings already used. Proof by execution: N_v2 substrate resolve 279s (was >800s exit-124); scaling probe linear (n=20 hang -> 87s); purity oracle green (resolve_typed_cache_ equivalence, identical self_gen8 pass/fail split pre/post) — result-identical, only faster, since resolve_expr_types is pure (resolving once == twice). Guard: resolve_expr_types_retraversal_guard_test source-bridges the real 04_resolve.dag Node and flags any arm with >=2 sibling self-calling traversals (RED on the real pre-fix source: 5 arms; GREEN post-fix). Enrolled in the CI rust gate via ci_spec. The 9 nv2_gate_resolve_bisect scaffolds dissolve per their root-caused trigger; a cleaned scaling probe remains as the perf harness. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * WIP: Resolve-perf bisect+fix: pin which direct-import's full-interface elabor --------- Co-authored-by: Brian Searls <briansrls@gunb.ai> Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…boration hangs resolve_entry_graph on the v2 compiler closure (the N_v2 interpreter blocker; #5146-class), then fix the root (#5266) * WIP: Resolve-perf bisect+fix: pin which direct-import's full-interface elabor * N_v2 gap-2: relax dag comma-list to optional inter-item comma (mirror v1) The v2 dag LanguageModel's shared list combinator dag_grammar_comma_list_expr required a MANDATORY comma between items, forking from the v1 single authority parse_field_list_acc (src/v1/stage0/src/v1_compiler_parse.rs) which separates items on a comma OR bare juxtaposition (comma optional; newlines are whitespace). The fork left every newline-separated multi-field record/type body unparseable (parse_g0_tokens_remain) — the next located N_v2 self-host parse blocker after the caret lex gap, pinned by prefix-bisection of 00_compile.dag to `type Validated`. Fix: make the inter-item comma optional in the one shared combinator — item (comma? item)* comma? — a strict superset (comma lists still parse) that fixes all 13 callers (field decls, param lists, generic/type-arg lists, field init/pattern, arg lists) at once, mirroring v1's uniform optional-comma. Floor witnesses (green by execution): newline-separated multi-field record + variant record payload Accept; one-field + comma-separated still Accept (superset); and a DISCRIMINATING no-fail-open control — a field missing its colon still Rejects, proving the relaxation made the COMMA optional, not the field SHAPE permissive. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * WIP: Resolve-perf bisect+fix: pin which direct-import's full-interface elabor --------- Co-authored-by: Brian Searls <briansrls@gunb.ai> Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Auto-opened by session-dashboard for session
crisp-wolf-348.Pushing to
work/5135-s3-fixadvances this PR.Worker attestation
Before flipping this PR to ready for review, confirm each item:
npm test,cargo test) and the result.Closes #Ndirective.Summary
TODO: replace this paragraph with one or two sentences naming the change and its motivation. Reviewers read this first.
Test plan