← Back to Pull requests

vxpu/plan: say in the plan how each segment runs and derive packages and pass-through #832

Closed
unknown closed this pull request without merging on Nov 24, 2026 00:13 UTC
View on GitHub
unknown unknown commented on Nov 23, 2026 17:42 UTC
Author

vxpu/proto: say in the plan how each segment runs

Define the SegmentRun enum and run field on Segment in plan.proto.

SegmentRun defines how a segment of the execution graph executes:

  • SEGMENT_RUN_PLAIN_TORCH: executes directly in PyTorch without

  • compilation. Host segments always have this value because host
    operations execute eagerly. Pass-through models (such as tiny Llama)
    have this value on every segment.
  • SEGMENT_RUN_JIT: compiles the segment just-in-time at load using

  • torch.compile. This is what the engine on main does by default when
    compiling dense segments (plan.py:651-674).
  • SEGMENT_RUN_PACKAGE: executes from an ahead-of-time compiled package

  • called directly without CUDA graph capture, for dense segments on CPU
    (VXPU_SEGMENT_RUNTIME="aoti").
  • SEGMENT_RUN_CAPTURED: executes from an ahead-of-time compiled package

  • captured into a per-segment CUDA graph, for dense segments on GPU
    targets (such as NVIDIA L4, VXPU_SEGMENT_RUNTIME="aoti" and
    VXPU_SEGMENT_GRAPH=True).

    The planner decides each segment's run mode for the machine the plan
    targets; the executor builds each segment's callable from this value and
    nothing else. Today the executor reads switches in Python instead
    (VXPU_SEGMENT_RUNTIME, VXPU_SEGMENT_GRAPH, and VXPU_SPLIT_COMPILE in
    vxpu/python/vxpu/plan.py), which a later move replaces once the plan is
    carried on load.

    Regenerate Go and Python protobuf bindings.

    ***

    vxpu/plan: derive required packages and pass-through from segment run mode

    Specify in the plan how each segment runs, decide it during plan emit,
    and derive required compiled packages and pass-through status from it:

  • Update vxpu plan emit to accept --machine, remove --device so that the

  • machine the plan targets solely decides the device, and set each
    segment's run mode via kernelplan.DecideSegmentRun:
    - A model with no call sites of our operations (such as tiny Llama)
    is passed through, every segment running as plain torch
    (SEGMENT_RUN_PLAIN_TORCH), which is the planner's choice for a model
    it has nothing to offer.
    - For any other model (such as tiny DeepSeek), every non-host segment
    runs from an ahead-of-time compiled package, captured into a CUDA graph
    (SEGMENT_RUN_CAPTURED) when the plan targets a GPU machine (such as
    NVIDIA L4) and directly called (SEGMENT_RUN_PACKAGE) on a CPU machine.
    - Host segments always run as plain torch (SEGMENT_RUN_PLAIN_TORCH).
  • Define SaysPackage, HasCapture, DecideSegmentRun, and IsPassThrough

  • once in Go. A plan is pass-through when every segment runs as plain torch
    and no call site names a body. A plan without segments is not interpreted.
  • Update RequiredPackages to return exactly the segments whose plan value

  • says package (SEGMENT_RUN_PACKAGE or SEGMENT_RUN_CAPTURED). Unspecified
    run modes are refused. Host segments marked as package are refused.
    Plans written before this change must be emitted again to populate segment
    run modes.
    Go tests show tiny Llama requires 0 packages and tiny DeepSeek's required
    package set is unchanged from main on CPU and GPU.
  • Regenerate checked-in tiny DeepSeek golden plan fixtures with segment run

  • modes (package on CPU, captured on GPU).
  • Update the tree visualization page to display each segment's run mode

  • badge ("plain torch", "package", "captured"), use the single
    pass-through definition for its note ("Pass-through plan: Every call
    site runs the engine's own implementation"), and hide the unmatched
    plan sites section on pass-through plans.
  • Update design.md with segment run modes and pass-through semantics.
  • Fixes #830

    Diff: 452 lines (+339 / -113) across 5 files Reviewer: codebot-robot Review duration: 391m
    All Vouch review confidence checks passed
    Residual risk 0.18 = Change Risk (0.45) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.45 · 452 lines diff across 5 files
    0.45
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.366
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #832"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 45.4% (MEDIUM) · Higher = larger blast radius
    45.4%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 17.9% · Safe to merge
    17.9%