[Hybrid Engine] Require an explicit accelerator opt-in for graph capture #8980
All Vouch review confidence checks passed
Residual risk 0.21 = Change Risk (0.47) × (1 − Review Confidence (0.57)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.47 · 494 lines diff across 6 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.371
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #8980"
general
weight: 0.35
delock
Follow-up to #8933 (review feedback from @0z5a).
Background
#8933 made the HybridEngine graph capture gate device-agnostic: instead of matching the device name, it admits every accelerator whose
create_graph()returns a graph. That is CUDA and NPU, but also HPU (HPUGraph), MLU (MLUGraph) and SUPA (SUPAGraph).Only CUDA and NPU implement
is_current_stream_capturing().DeepSpeedStaticCache.updaterelies on it to skip the per-row write-position bounds check ((cache_position < 0).any()) while capturing. On the other backends the check would run during capture and synchronize the host, which is illegal while a stream is being captured, and none of those backends is in the test matrix. Before #8933, the device-name check kept them on the eager fallback.Change
is_graph_capture_supported()to the accelerator interface. The default isFalse, so backends opt in explicitly, and only after they implementis_current_stream_capturing().Truefor CUDA and NPU.validate_graph_capture_support()inhybrid_engine_graph.pyand the continuous rollout path inhybrid_engine_rollout.py.create_graph()without the opt-in stays on eager decode.HPU, MLU and SUPA keep the eager fallback with the existing warning. They can be enabled later by implementing the stream-capture query and validating the path.
Testing
Branch
fix-hybrid-engine-graph-capture-opt-in, HEAD9427e0d55(parent2d80cedd2), working tree clean. Both on-device runs use this commit.CUDA (8×A100-SXM4-80GB, single card used; torch 2.14.1+cu126, CUDA 12.6, Python 3.10.22; transformers 4.57.6)
CUDA_Accelerator.is_graph_capture_supported()returns True and CPU returns False.validate_graph_capture_support(): allows ZeRO-2 and rejects ZeRO-3.DecodeGraphCache: all 4 decode positions captured, the host forward runs exactly once per position; the same length reuses graphs, a length change recaptures, and exceedingmax_positionsraises.enable_cuda_graph: true: warning emitted, capture active, output identical.Suite results (transformers 4.57.6, default marker selection):
| Suite | Result |
| --- | --- |
|
test_he_graph.py| 21 passed ||
test_hybrid_engine_rollout.py| 50 passed ||
test_accelerator_graph.py| 1 passed, 1 skipped (CUDA has graph support; the eager-fallback case is skipped by design) ||
test_accelerator.py| 35 passed || Total | 107 passed, 1 skipped |
NPU (Ascend 910B4; torch 2.10 + torch_npu 2.10.0.post7)
pytest tests/unit/hybrid_engine/test_he_graph.py tests/unit/runtime/rollout/test_hybrid_engine_rollout.py -q -m "not seq_inference"— 70 passed, 1 skipped (native CUDA kernel test).Other backends
Falseunit test, not an on-device run. CPU was verified to returnFalse.Conclusion
The implementation behaves correctly with no CUDA regression: the opt-in gate applies per backend, CUDA keeps graph capture, non-opt-in backends fall back to eager decode, and the old config alias remains compatible.