Repository navigation
Conversation
Signed-off-by: Jin, Youzhi <youzhi.jin@intel.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Jin, Youzhi <youzhi.jin@intel.com>
Captured kernels read each parameter through the address and strides fixed at capture. A same-address layout change such as transpose_() kept the old signature and replayed with a stale layout. Key the graph state on each parameter's address, device, dtype, shape and strides instead. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Jin, Youzhi <youzhi.jin@intel.com>
…lifecycle Signed-off-by: Jin, Youzhi <youzhi.jin@intel.com> # Conflicts: # tests/unit/v1/test_hybrid_engine_rollout_v1.py
3 of 4 tasks
This was referenced Nov 13, 2026
Signed-off-by: Jin, Youzhi <youzhi.jin@intel.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The default graph path (
use_graph_capture=Truewithoutcontinuous_batch_size) currently rebuilds itsDeepSpeedStaticCache, runs three warmup forwards and captures a new graph on everygenerate()call. In an RL loop that is a fixed setup cost per rollout round, paid even though the decode graph depends only on the decode shape, not on the prompt contents or the weight values.This PR keeps the static path's graph and cache across calls, the same way #8732 / #9009 already do for the continuous path.
generate()callDeepSpeedStaticCache, 3 warmups, capturemax_new_tokens, device, dtype, or a parameter's address / shape / strides / dtype / deviceshutdown()Implementation
_continuous_graph_signature→_graph_signature, shared by both paths (no behaviour change)._StaticGraphState/_get_static_graph_state/_capture_static_graph. The warmup + capture code is moved unchanged out of_generate_graph. Capture now runs on a zeroed cache before the prefill KV is loaded; the replayed values never depend on capture-time contents.shutdown()is called. Documented ininference-engine.rst.Tests
New accelerator test
test_static_graph_is_reused_across_rollouts_with_the_same_decode_shape(Llama, sdpa). Every call is compared againstmodel.generate():Then it asserts exactly 2 captures, and that
shutdown()frees at least the cache bytes.Mutation check (each must fail the new test): not zeroing the mask on reuse → fails; recapturing every call → fails (capture count); skipping the prefill KV copy → fails (all three static tests).
Validation
1× NVIDIA H20 (driver 580.178.04), torch 2.13.0+cu130, Transformers 5.15.1:
CUDA_VISIBLE_DEVICES=7 DS_ACCELERATOR=cuda OMP_NUM_THREADS=1 HF_HUB_OFFLINE=1 \ python -m pytest -q -p no:cacheprovider -o addopts= \ tests/unit/v1/test_hybrid_engine_rollout_v1.py \ tests/unit/runtime/rollout/test_hybrid_engine_rollout.py tests/unit/utils/test_static_cache.py # 105 passed, 2 skipped (optional pretrained model, native inference extension)CPU (
DS_ACCELERATOR=cpu, same files): 78 passed, 29 skipped (accelerator-only cases).Pre-commit passes on the three changed files.
Not covered
continuous_cache_capacity); can follow if wanted.