
    .`iU	                     f    d dl mZmZmZ d dlmZmZ d dlmZm	Z	 erd dl
mZ neZdeddfdZd	 ZdS )
    )TYPE_CHECKINGAnycast)
VllmConfigget_layers_from_vllm_config)get_dcp_groupget_pcp_group)AttentionLayerBasevllm_configreturnNc                    | j         j        }| j         j        }| j         j        }||z  dk    rt	          t
          t                   t                    }t          | |          }|	                                D ]}t          |dd           }|| j        %|dk    r|j        sJ d|j        j         d            |dk    r|j        sJ d|j        j         d            |dk    r|j        sJ d|j        j         d            d S d S )	N   implz=MTP with cp_kv_cache_interleave_size > 1 is not supported in .zPDCP requires attention impls to return the softmax lse for decode, but the impl z, does not return the softmax lse for decode.z4PCP requires attention impls' support, but the impl z does not support PCP.)parallel_configprefill_context_parallel_sizedecode_context_parallel_sizecp_kv_cache_interleave_sizer   typer   r
   r   valuesgetattrspeculative_config0supports_mtp_with_cp_non_trivial_interleave_size	__class____name__need_to_return_lse_for_decodesupports_pcp)r   pcp_sizedcp_sizeinterleave_size
layer_typelayerslayer
layer_impls           k/home/jaya/work/projects/VOICE-AGENT/VIET/agent-env/lib/python3.11/site-packages/vllm/v1/worker/cp_utils.py check_attention_cp_compatibilityr&      sz   *HH*GH!1MO(Q$s)%788
,[*EE]]__ 	 	E 55J!-9oPQ>Q>Q!R  E$.$8$AE E E R !||!?  B!+4B B B ? !||!.  ,$.$8$A, , , .+ 	 	    c                      	 t                      j        } n# t          $ r d} Y nw xY w	 t                      j        }n# t          $ r d}Y nw xY w|| z  S )Nr   )r	   
world_sizeAssertionErrorr   )pcp_world_sizedcp_world_sizes     r%   get_total_cp_world_sizer-   .   s}    &3   &3    N**s    %%= AA)typingr   r   r   vllm.configr   r   vllm.distributedr   r	   /vllm.model_executor.layers.attention_layer_baser
   objectr&   r-    r'   r%   <module>r4      s    , + + + + + + + + + ? ? ? ? ? ? ? ? 9 9 9 9 9 9 9 9  RRRRRRR*     @+ + + + +r'   