Repository navigation
Target charges v2 loop-body intrinsics per iteration - #338
Conversation
Native Target's separate pure-intrinsic cost check refused any intrinsic
reached from a `for` body ("charged elsewhere; refused rather than
undercharged"). Under the shared-read schedule the source checker
admits such modules with the shared-read meter, which charges a
literal-bound loop body once per iteration, so Target refused modules
the source accepted (#337). Under v2, Target's intrinsic check now
charges a literal-bound loop body times its bound. The copying
schedule keeps the refusal.
The reference evaluator gains bounded loops; a module with intrinsics
in a loop, a helper and a fold step stays within its minimum.
RED: native_target_lowers_loop_intrinsics_at_the_shared_read_source_minimum
failed with "target pure-intrinsic cost is unestablished or exceeds the
step budget". GREEN: 5/5; cargo xtask verify exit 0.
Flat ReplaceRange (jedit#410 @ 06846ca): passes Target lowering at its
source minimum 261,523,656 steps / 175,260,814 bytes; one step less is
refused at source.
Agent-Session: AFC0A5E0-B032-49DC-8B18-CB932831DCC2
Agent-Tool: Claude Code
|
No actionable comments were generated in the recent review. Summary by CodeRabbit
WalkthroughNative Target now charges intrinsic calls in literal-bound loop bodies per iteration under the shared-read schedule. The changes add loop-cost tests, extend the reference evaluator to run ChangesNative Target shared-read loop costs
Estimated code review effort: 3 (Moderate) | ~20 minutes Change: Bug fix · Severity of issue fixed: Medium Possibly related issues
Merge Risk:
|
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Plain-English Walkthrough
TL;DR
Under the shared-read schedule, native Target refused modules that call a target pure intrinsic from a bounded
forbody, even though the source checker accepted them [claim:root-cause, confidence:1.00]. Target's intrinsic-cost check now charges a literal-bound loop body once per iteration under v2, so such modules lower at their source minimum. Jedit's flat ReplaceRange now passes Target lowering at its source minimum [claim:flat, confidence:0.95].Walkthrough
Root cause. Target runs two cost judges. The shared-read meter (
fold_work) charges aforbody times its bound. The separate pure-intrinsic check (target_ir/pure_intrinsics.rs) refused any intrinsic reached from a loop body, because under the copying schedule loop work was charged elsewhere. Under v2 that refusal disagreed with the source checker. ReplaceRange's effect loop callsproposal.childWrite, which reachescontentEdgeId.Fix. Under v2, a literal-bound loop body is charged
iter + body × boundin the intrinsic check. That check still counts only intrinsic templates, a subset of the shared-read meter's total, so the source minimum stays at or above the native one. The copying schedule is unchanged.Verification.
native_target_lowers_loop_intrinsics_at_the_shared_read_source_minimumfailed with "target pure-intrinsic cost is unestablished or exceeds the step budget".cargo xtask verifyexits 0.Flat ReplaceRange (jedit#410 at
06846ca): the source minimum is 261,523,656 steps and 175,260,814 bytes. At exactly that budget the build passes compilation and Target lowering, then stops at the provider (ProviderLowererRefused,InvalidSemanticArtifact), which is Echo's concern. One step less is refused at the source.The docs are agent-written and not yet human-reviewed.
Appendix: Citations
claim:root-causecrates/amblicit-syntax/src/target_ir/pure_intrinsics.rsFor arm @8f880a14; RED test aboveclaim:flatCloses #337