vxpu/engine: load the plan's prebuilt packages when serving on CPU #799
All Vouch review confidence checks passed
Residual risk 0.19 = Change Risk (0.43) × (1 − Review Confidence (0.57)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.43 · 373 lines diff across 4 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
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.354
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #799"
general
weight: 0.35
codebot-robot
A serving engine on CPU now loads the prebuilt AOTInductor packages named
in its plan, as an engine on GPU does, and compiles nothing at startup
when all named packages are present.
Previously, Plan.__init__ forced segment_runtime from "aoti" back to "jit"
on non-CUDA devices ("aoti requires CUDA and a compiled split decode").
Additionally, compile_segments unconditionally allocated a CUDA graph memory
pool via torch.cuda.graph_pool_handle(), and GraphedSegment assumed CUDA
graphs by capturing and replaying a CUDAGraph on non-warmup calls. As a
result, packages compiled for CPU machines were ignored at serve time,
forcing every CPU engine start to compile segments with torch.compile.
This change:
1. Removes the CUDA restriction in Plan.__init__ for segment_runtime="aoti",
requiring only split_decode and split_compile.
2. Introduces a direct segment type (aoti.Segment) alongside aoti.GraphedSegment.
compile_segments chooses between them once where the segment is loaded
from what the plan says (plan["segment_graph"]), avoiding device checks
and mode switches inside segment execution. VXPU_SEGMENT_GRAPH is a plan
switch carried by the plan in COORDINATOR_SWITCHES; on CUDA it defaults
to 1 and on CPU it is 0. In production today, nobody sets VXPU_SEGMENT_GRAPH;
the Go planner should carry this switch as a knob in the emitted plan.
StepGraph accepts any loaded aoti.Segment.
3. Allocates the CUDA graph memory pool in compile_segments only when
graphed is True, and rejects unknown or host-op package names.
4. Excludes segments already recorded as failed in the package report from
dense_tasks, running them via torch.compile without retrying doomed builds
at startup. Unscheduled build failures fail the load on all devices.
Engine.__init__ refuses step_graph if any packages failed, naming them.
5. In Packages._build_all, records build failures for all segment names that
share a cache key rather than only the first one.
6. Preserves a single source and single type for packages (PackageReport)
passed to Engine.__init__, avoiding private state inspection by having tests
assert on what the engine already reports via Packages.report().
7. Updates compile_package_test.py to pass plan settings cleanly and assert
on what the engine reports: on CPU, prebuilt packages are loaded from
cache with none built, and generated tokens match the eager reference.
Measurements on Intel Xeon @ 2.20GHz (32 vCPUs, Linux x86_64, tiny DeepSeek
fixture in CompilePackageTest):
saving 2.82 s (~12% faster start).
unarchiving the exported graph from decode.pt2 (9.3 s), probing the checkpoint
state dict (3.5 s), and binding model parameters (0.8 s) (#454).
Fixes #793