Skip to content

[Misc]: Why not AscendMLAImpl just inherit MLACommonImpl for common functions? #868

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
learning-chip opened this issue May 15, 2025 · 2 comments
Assignees
Labels
question Further information is requested

Comments

@learning-chip
Copy link

learning-chip commented May 15, 2025

class AscendMLAImpl inherits the abstract MLAAttentionImpl:
https://github.com/vllm-project/vllm-ascend/blob/v0.8.5rc1/vllm_ascend/attention/mla_v1.py#L263

However most functions like _v_up_proj_and_o_proj and _q_proj_and_k_up_proj are already defined in MLACommonImpl, and they look identical to the re-definition in AscendMLAImpl:
https://github.com/vllm-project/vllm/blob/v0.8.5/vllm/attention/backends/mla/common.py#L1009

For example, TritonMLAImpl just reuses those common functions, but overwrites _forward_decode:
https://github.com/vllm-project/vllm/blob/v0.8.5/vllm/attention/backends/triton_mla.py#L26

AscendMLAImpl can also just inherits MLACommonImpl and overwrite _forward_prefill and _forward_decode to use NPU operators?

@Yikun
Copy link
Collaborator

Yikun commented May 16, 2025

@ganyi1996ppo Please take a look

@Yikun Yikun added the question Further information is requested label May 16, 2025
@ganyi1996ppo
Copy link
Collaborator

Inherit MLACommonImpl will import triton which we are not support yet when we were developing mla_v1, so we just wrote a simple impl to make sure its functionality. However I see that the common.py have already guard the triton import with HAS_TRITON variable now, so maybe its safe to inherit it in vllm-ascend. You are welcome to file to PR to vllm-ascend on this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants