fix(ascend): keep unsafe operators out of device graphs - #568
Open
baominghelly wants to merge 1 commit into
Open
fix(ascend): keep unsafe operators out of device graphs#568baominghelly wants to merge 1 commit into
baominghelly wants to merge 1 commit into
Conversation
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
AllReduceas unsafe for device-graph capture incsrc/infinicore/src/ops/distributed/allreduce.cc.MultiheadAttentionVarlenas unsafe for device-graph capture because its provider synchronizes cumulative sequence lengths on the host.Motivation
Ascend graph replay produced corrupted model output when host-dependent attention and HCCL collective operations were captured into device-graph segments. The graph runtime already supports splitting operator sequences by
GraphOperator::is_device_graph_capture_safe(); this change uses that existing mechanism to execute the two currently unsafe Ascend operator classes eagerly between captured segments.This is a correctness fallback rather than native graph support for those operators. Once the relevant backends expose validated graph-capture capability, InfiniCore should query that capability instead of checking the device type here.
No issue is currently linked to this change.
Type of Change
feat— new feature / new modelfix— bug fixperf— performance improvement (no behavioral change)refactor— code restructuring without behavior changetest— adding or fixing tests onlydocs— documentation onlybuild/ci— build system or CI configurationchore— tooling, formatting, or other non-code changesTest Results of Involved Models on Supported Platforms (Please attach screenshots)
Validated on Ascend 910C with CANN 9.0.0, the modern InfiniRT/InfiniOps stack, InfiniOps paged flash-attention PR #984, and InfiniLM
refactor/adopt-modern-infini-stack.Single-request graph tests used
examples/test_infer.pywith--device ascend --enable-paged-attn --attn=flash-attn --enable-graph.The final-head TP2 log is
/workspace/model-matrix-route-a-20260910/infinilm-graph-pr-final/chatglm3_tp2_graph.logon the validation host.Benchmark / Performance Impact
N/A. This is a correctness change. No performance claim is made.
Notes for Reviewers
AllReduceremains capture-safe on all existing platforms except Ascend; other platform behavior is unchanged.MultiheadAttentionVarlenwas already excluded on NVIDIA and is now also excluded on Ascend.graph.ccwere intentionally excluded.CI / ChatOps
CI does not run automatically on pull requests. It should be triggered manually from the Actions tab or by a maintainer with
/retestor/test.Checklist
Title, Branch, and Commits
<type>/xxx-yyyy-zzzz.fixup!/squash!/wipcommits remain.Scope and Design
General Code Hygiene
C++ Specific
new/deletewas introduced.scripts/format.py.csrc/models/llama_legacy/.Python Specific
scripts/format.py.python/infinilm/auto_config.py.Testing
Build, CI, and Tooling
_infinilmrebuilt and installed successfully on Ascend.Documentation
Security and Safety
Validation Evidence