Skip to content

Conversation

@ZYang6263
Copy link
Contributor

@ZYang6263 ZYang6263 commented Oct 23, 2025

What this PR does / why we need it?

This PR boosts performance by introducing a fused kernel for the matrix matmul and reduce scatter operations. It supports both unquantized (e.g., BFloat16) and W8A8 quantized models.

Does this PR introduce any user-facing change?

How was this patch tested?

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 introduces a fused matmul/reduce-scatter kernel to optimize performance, which is a great initiative. The implementation correctly identifies the specific CANN version and quantization methods to apply the optimization. However, I've found a critical correctness issue where the bias term is ignored in the unquantized path, which could lead to incorrect model outputs. Additionally, there are several opportunities to improve code quality by removing dead code, placing imports correctly, and refactoring duplicated logic. Addressing these points will make the new optimized code paths more robust and maintainable.

Comment on lines 404 to 410
output_parallel = torch.empty(x.shape[0] // self.layer.tp_size,
self.layer.weight.shape[0],
dtype=self.layer.params_dtype,
device=x.device)
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 output_parallel tensor initialized here is never used, as the result from npu_mm_reduce_scatter_base is assigned directly to the output variable. This is dead code and should be removed. A similar redundant initialization exists for the W8A8 path on lines 432-436.

@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.

Co-authored-by: ZhaoJiangJiang <[email protected]>
Co-authored-by: rjg-lyh <[email protected]>
Co-authored-by: raintBN-91 <[email protected]>

Signed-off-by: ZYang6263 <[email protected]>

 Changes to be committed:
	modified:   vllm_ascend/ops/linear_op.py
	modified:   vllm_ascend/ops/register_custom_ops.py

Signed-off-by: ZYang6263 <[email protected]>
@rjg-lyh rjg-lyh added ready read for review ready-for-test start test by label for PR labels Oct 23, 2025
@ZYang6263 ZYang6263 closed this Oct 24, 2025
@ZYang6263 ZYang6263 reopened this Oct 24, 2025
@ZYang6263 ZYang6263 closed this Oct 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

module:ops ready read for review ready-for-test start test by label for PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants