|
898 | 898 | # Future Plan: |
899 | 899 | # Remove this patch when: |
900 | 900 | # vLLM itself supports kv transfer for mamba |
901 | | -# ** 21. File: worker/patch_v2/patch_input_batch.py |
| 901 | +# ** 21. File: worker/patch_weight_utils.py** |
| 902 | +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 903 | +# 1. `vllm.model_executor.models.deepseek_v2.DeepseekV2ForCausalLM.load_weights` |
| 904 | +# Why: |
| 905 | +# The C8 weight quantized by modelslim will modify the model structure, |
| 906 | +# and the scale and offset required for kvcache quantization will increase. |
| 907 | +# In addition, the names of the quantization parameters are different from |
| 908 | +# those in the community. |
| 909 | +# How: |
| 910 | +# we have enhanced the maybe_remap_kv_scale_name function. |
| 911 | +# Future Plan: |
| 912 | +# The maybe_remap_kv_scale_name function of the community is reconstructed to support |
| 913 | +# multiple backends. |
| 914 | +# ** 21b. File: worker/patch_process_weights_after_loading.py** |
| 915 | +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 916 | +# 1. `vllm.model_executor.model_loader.utils.process_weights_after_loading` |
| 917 | +# `vllm.model_executor.model_loader.base_loader.process_weights_after_loading` |
| 918 | +# and imported references in vllm-ascend model loaders |
| 919 | +# Why: |
| 920 | +# DSA attention is implemented in vllm-ascend as the plugin layer |
| 921 | +# `DSAAttention`. Upstream vLLM only runs post-load attention weight |
| 922 | +# processing for built-in attention classes, so |
| 923 | +# `DSAAttention.process_weights_after_loading()` is skipped in the |
| 924 | +# original loader flow. DSV4 DSA-CP o-proj TP initialization must run in |
| 925 | +# this post-load phase rather than being initialized lazily in forward. |
| 926 | +# How: |
| 927 | +# Rebind the upstream `process_weights_after_loading` helper, including |
| 928 | +# already-imported loader references, so `DSAAttention` participates in |
| 929 | +# the same post-load traversal while preserving the original quant-method |
| 930 | +# and torchao reload behavior. |
| 931 | +# Related PR (if no, explain why): |
| 932 | +# https://github.com/vllm-project/vllm-ascend/pull/10694 |
| 933 | +# https://github.com/vllm-project/vllm/pull/46828 |
| 934 | +# Future Plan: |
| 935 | +# Remove this patch once the supported vLLM version includes PR #46828. |
| 936 | +# Then register `DSAAttention` through vLLM's post-load weight-processing |
| 937 | +# registry instead of monkey-patching model-loader helpers. |
| 938 | +# ** 22. File: worker/patch_v2/patch_input_batch.py** |
902 | 939 | # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
903 | 940 | # 1. `vllm.v1.worker.gpu.input_batch.InputBatch` |
904 | 941 | # Why: |
|
908 | 945 | # replace InputBatch with AscendInputBatch. |
909 | 946 | # Future Plan: |
910 | 947 | # remove this patch when vLLM-ascend's make_dummy behavior aligns with vLLM. |
911 | | -# ** 22. File: worker/patch_v2/patch_block_table.py** |
| 948 | +# ** 23. File: worker/patch_v2/patch_block_table.py** |
912 | 949 | # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
913 | 950 | # 1. `vllm.v1.worker.gpu.block_table.BlockTables` |
914 | 951 | # Why: |
|
920 | 957 | # Future Plan: |
921 | 958 | # remove this patch when vLLM-ascend's BlockTables can initialize |
922 | 959 | # slot mapping as torch.int64 dtype. |
923 | | -# ** 23. File: worker/patch_v2/patch_model_state.py** |
| 960 | +# ** 24. File: worker/patch_v2/patch_model_state.py** |
924 | 961 | # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
925 | 962 | # 1. `vllm.v1.worker.gpu.model_states.default.init_model_state` |
926 | 963 | # Why: |
|
930 | 967 | # Define AscendModelState and initialize it in init_model_state. |
931 | 968 | # Future Plan: |
932 | 969 | # remove this when vllm-ascend's attention metadata is align with vllm. |
933 | | -# ** 24. File: worker/patch_v2/patch_triton.py** |
| 970 | +# ** 25. File: worker/patch_v2/patch_triton.py** |
934 | 971 | # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
935 | 972 | # 1. `vllm.v1.worker.gpu.sample.logprob`, `vllm.v1.worker.gpu.sample.penalties.apply_penalties`, |
936 | 973 | # `vllm.v1.worker.gpu.sample.gumbel.gumbel_sample` |
|
943 | 980 | # Future Plan: |
944 | 981 | # Remove this patch when vLLM support the dispatch function. |
945 | 982 | # |
946 | | -# ** 25. File: worker/patch_qwen3vl.py** |
| 983 | +# ** 26. File: worker/patch_gqa_c8.py** |
| 984 | +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 985 | +# 1. `vllm.model_executor.models.qwen3.Qwen3ForCausalLM.load_weights` |
| 986 | +# Why: |
| 987 | +# The GQA W8A8C8 model stores per-channel KV cache scales and offsets |
| 988 | +# (k_cache_scale, k_cache_offset, v_cache_scale, v_cache_offset) under |
| 989 | +# weight names that AutoWeightsLoader does not recognise and would |
| 990 | +# silently discard. Without these scales the INT8 KV cache cannot be |
| 991 | +# dequantised correctly at inference time. |
| 992 | +# How: |
| 993 | +# Wrap load_weights to intercept the C8 scale/offset tensors before they |
| 994 | +# reach the base loader. Each intercepted tensor is routed to the |
| 995 | +# corresponding nn.Parameter via its weight_loader, then excluded from |
| 996 | +# the remaining weight stream so the base loader never sees it. |
| 997 | +# Related PR (if no, explain why): |
| 998 | +# This PR (Qwen3-32B and GLM4.7 W8A8C8 support). Upstream vLLM's weight-loading |
| 999 | +# pipeline does not yet have a generic hook for hardware-plugin-defined |
| 1000 | +# KV cache parameters. |
| 1001 | +# Future Plan: |
| 1002 | +# Remove this patch when vLLM provides a first-class extension point |
| 1003 | +# for loading extra KV cache quantisation parameters in model load_weights, |
| 1004 | +# or when the GQA model's weight names are aligned with the parameter |
| 1005 | +# names expected by the quantisation backend. |
| 1006 | +# ** 27. File: worker/patch_qwen3vl.py** |
947 | 1007 | # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
948 | 1008 | # 1. `vllm.model_executor.models.qwen3.Qwen3Attention.forward` and |
949 | 1009 | # `vllm.model_executor.models.qwen3_moe.Qwen3MoeAttention.forward` |
|
954 | 1014 | # when using mrope. |
955 | 1015 | # Future Plan: |
956 | 1016 | # Remove this patch when vllm-ascend supports pattern matching for this fused kernel. |
957 | | -# ** 26. File: worker/patch_qwen3_dflash.py** |
| 1017 | +# ** 28. File: worker/patch_qwen3_dflash.py** |
958 | 1018 | # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
959 | 1019 | # 1. `vllm.model_executor.models.qwen3_dflash.DFlashQwen3Model.precompute_and_store_context_kv` |
960 | 1020 | # Why: |
|
982 | 1042 | # Remove this patch when upstream vLLM supports MoE communication type abstraction that |
983 | 1043 | # can be extended by hardware plugins like vllm-ascend. |
984 | 1044 | # |
985 | | -# ** 27. File: platform/patch_mamba_manager.py** |
| 1045 | +# ** 29. File: platform/patch_mamba_manager.py** |
986 | 1046 | # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
987 | 1047 | # 1. `vllm.v1.core.single_type_kv_cache_manager.MambaManager` |
988 | 1048 | # Why: |
|
0 commit comments