Skip to content

Conversation

@MengqingCao
Copy link
Collaborator

@MengqingCao MengqingCao commented Aug 18, 2025

What this PR does / why we need it?

This pr adapt aclgraph into new graph dispatcher arch in vllm
breaks form:

Does this PR introduce any user-facing change?

N/A

How was this patch tested?

CI passed with existing test.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adapts aclgraph to the new graph dispatcher architecture in vLLM. It introduces ACLGraphWrapper for Ascend NPUs and integrates it into the model runner. The changes also include refactoring InputBatch to align with the new logits processor framework. My review found a critical logic error in capture_model that prevents graph capture, and an incomplete implementation in _capture_model that misses capturing graphs for decode mode.

Comment on lines 2485 to 2493
aclgraph_mode = self.compilation_config.cudagraph_mode
if aclgraph_mode.mixed_mode() != CUDAGraphMode.NONE:
aclgraph_runtime_mode = aclgraph_mode.mixed_mode()

compilation_cases = list(reversed(self.aclgraph_batch_sizes))
self._capture_aclgraphs(
compilation_cases,
cudagraph_runtime_mode=aclgraph_runtime_mode,
uniform_decode=False)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The _capture_model function only seems to capture ACL graphs for the mixed_mode. It's missing the logic to capture graphs for decode_mode (i.e., uniform decode batches). If a decode_mode is configured, the corresponding graphs will not be captured, which could lead to performance issues or errors at runtime. The implementation should also handle cudagraph_mode.decode_mode().

            aclgraph_mode = self.compilation_config.cudagraph_mode
            if aclgraph_mode.mixed_mode() != CUDAGraphMode.NONE:
                aclgraph_runtime_mode = aclgraph_mode.mixed_mode()

                compilation_cases = list(reversed(self.aclgraph_batch_sizes))
                self._capture_aclgraphs(
                    compilation_cases,
                    cudagraph_runtime_mode=aclgraph_runtime_mode,
                    uniform_decode=False)

            if aclgraph_mode.decode_mode() != CUDAGraphMode.NONE:
                aclgraph_runtime_mode = aclgraph_mode.decode_mode()

                compilation_cases = list(
                    reversed(self.aclgraph_dispatcher.get_decode_graph_keys()))
                self._capture_aclgraphs(
                    compilation_cases,
                    cudagraph_runtime_mode=aclgraph_runtime_mode,
                    uniform_decode=True)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we don't capture decode_mode here because the full graph is not supported currently.

@github-actions
Copy link

👋 Hi! Thank you for contributing to the vLLM Ascend project. The following points will speed up your PR merge:‌‌

  • A PR should do only one thing, smaller PRs enable faster reviews.
  • Every PR should include unit tests and end-to-end tests ‌to ensure it works and is not broken by other future PRs.
  • Write the commit message by fulfilling the PR description to help reviewer and future developers understand.

If CI fails, you can run linting and testing checks locally according Contributing and Testing.

@github-actions
Copy link

This pull request has conflicts, please resolve those before we can evaluate the pull request.

Potabk and others added 8 commits August 19, 2025 17:00
Signed-off-by: wangli <[email protected]>
Signed-off-by: MengqingCao <[email protected]>
Signed-off-by: wangli <[email protected]>
Signed-off-by: wangli <[email protected]>
Signed-off-by: wangli <[email protected]>
Signed-off-by: wangli <[email protected]>
MengqingCao and others added 9 commits August 19, 2025 09:29
Signed-off-by: MengqingCao <[email protected]>
Signed-off-by: wangli <[email protected]>
Signed-off-by: MengqingCao <[email protected]>
Signed-off-by: MengqingCao <[email protected]>
Signed-off-by: MengqingCao <[email protected]>
Signed-off-by: MengqingCao <[email protected]>
Signed-off-by: MengqingCao <[email protected]>
Signed-off-by: MengqingCao <[email protected]>
@github-actions
Copy link

This pull request has conflicts, please resolve those before we can evaluate the pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants