- 
                Notifications
    You must be signed in to change notification settings 
- Fork 530
[ModelRunner][Refactor] Refactor kv cache tensor initialization logic #3106
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
base: main
Are you sure you want to change the base?
Conversation
| 👋 Hi! Thank you for contributing to the vLLM Ascend project. The following points will speed up your PR merge: 
 If CI fails, you can run linting and testing checks locally according Contributing and Testing. | 
| This pull request has conflicts, please resolve those before we can evaluate the pull request. | 
    
      
        1 similar comment
      
    
  
    | This pull request has conflicts, please resolve those before we can evaluate the pull request. | 
| This pull request has conflicts, please resolve those before we can evaluate the pull request. | 
…ype (#3760) ### What this PR does / why we need it? Part of #3106 Fix Hybrid kvcache sharing bug in same attention type Change the `shared_by` logic so that the same attention spec could share the same buffer instead of allocating more hbm. After this pr, kvcache memory saved 50% in qwen3-next compared with before (`self_attn:linear_attn=1:3` in an `attn_group`), and `gpu_memory_utilization` could increase to `0.8` on Qwen3-Next when running on A2 64G/card with tp4 <img width="2833" height="1540" alt="image" src="https://github.com/user-attachments/assets/2a91fa99-fb0f-447c-9e8b-acd587890fbe" /> ### Does this PR introduce _any_ user-facing change? ### How was this patch tested? Test pass with the latest e2e test case on qwen3-next - vLLM version: v0.11.0rc3 - vLLM main: vllm-project/vllm@c9461e0 --------- Signed-off-by: MengqingCao <[email protected]>
| This pull request has conflicts, please resolve those before we can evaluate the pull request. | 
* Unify the kvcache tensor initialization logic of deepseek and normal models * spilt initialize_kv_cache_tensors into _allocate_kv_cache_tensors and _reshape_kv_cache_tensors, following gpu modelrunner in vllm * Fix the shared_by logic so that the same attention spec could share the same buffer instead of allocating more hbm. Signed-off-by: MengqingCao <[email protected]>
Signed-off-by: MengqingCao <[email protected]>
Signed-off-by: MengqingCao <[email protected]>
Signed-off-by: MengqingCao <[email protected]>
What this PR does / why we need it?
Refactor kv cache tensor initialization logic.
initialize_kv_cache_tensorsinto_allocate_kv_cache_tensorsand_reshape_kv_cache_tensors, following gpu modelrunner in vllmDoes this PR introduce any user-facing change?
N/A
How was this patch tested?
CI passed with existing test.