
    )`i                     v   d Z ddlZddlmZ ddlmZ ddlmZ ddlm	Z	 ddlm
Z
 dd	lmZ dd
lmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddl m!Z!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+m,Z,m-Z- ddl.m/Z/m0Z0 ddl1m2Z2m3Z3m4Z4m5Z5m6Z6m7Z7m8Z8m9Z9 ddl:m;Z; ddl<m=Z= ddl<m>Z> dd l<m?Z? dd!l<m@Z@ dd"l<mAZA dd#l<mBZB dd$l<mCZC dd%l<mDZD dd&lEmFZF dd'lGmHZH dd(lGmIZI dd)lGmJZJ dd*lGmKZK dd+lGmLZL dd,lGmMZM dd-lGmNZN dd.lOmPZP dd/lOmQZQ dd0lOmRZR dd1lOmSZS dd2lTmUZU dd3lTmVZV dd4lWmXZX dd5lWmYZY dd6lWmZZZ dd7lWm[Z[ dd8l\m]Z] dd9l\m^Z^ dd:l_m`Z` dd;l_maZa dd<l_mbZb dd=l_mcZc dd>l_mdZd dd?l_meZe dd@l_mfZf ddAl_mgZg ddBl_mhZh ddCl_miZi ddDljmkZk ddEljmlZl ddFljmmZm ddGljmnZn ddHljmoZo ddIljmpZp ddJljmqZq ddKljmrZr ddLljmsZs ddMljmtZt ddNljmuZu ddOljmvZv ddPlmwZw ddQlwmxZx ddRlwmyZy ddSlwmzZz ddTl{m|Z| ddUl{m}Z} ddVl~mZ ddWlmZ ddXlmZ ddYlmZ ddZlmZ dS )[a3  
Copyright (c) 2023 by FlashInfer team.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
    N   )__version__)__git_version__)jit)gelu_and_mul)gelu_tanh_and_mul)silu_and_mul)*silu_and_mul_scaled_nvfp4_experts_quantize)BatchAttention)&BatchAttentionWithAttentionSinkWrapper)autotune).BatchDecodeWithSharedPrefixPagedKVCacheWrapper)/BatchPrefillWithSharedPrefixPagedKVCacheWrapper)!MultiLevelCascadeAttentionWrapper)merge_state)merge_state_in_place)merge_states)%BatchDecodeMlaWithPagedKVCacheWrapper)"BatchDecodeWithPagedKVCacheWrapper)+CUDAGraphBatchDecodeWithPagedKVCacheWrapper)fast_decode_plan) cudnn_batch_decode_with_kv_cache)single_decode_with_kv_cache)SfLayoutblock_scale_interleavenvfp4_block_scale_interleavee2m1_and_ufp8sf_scale_to_floatfp4_quantizemxfp4_dequantize_hostmxfp4_dequantizemxfp4_quantizenvfp4_quantizenvfp4_batched_quantizeshuffle_matrix_ashuffle_matrix_sf_ascaled_fp4_grouped_quantize)mxfp8_dequantize_hostmxfp8_quantize)RoutingMethodTypeGatedActTypecutlass_fused_moereorder_rows_for_gated_act_gemmtrtllm_fp4_block_scale_moe!trtllm_fp4_block_scale_routed_moetrtllm_fp8_block_scale_moetrtllm_fp8_per_tensor_scale_moe)chunk_gated_delta_rule)SegmentGEMMWrapper)bmm_bf16)bmm_fp8)	bmm_mxfp8)mm_bf16)mm_fp4)mm_fp8)tgv_gemm_sm100)BatchMLAPagedAttentionWrapper)fused_add_rmsnorm)	layernorm)gemma_fused_add_rmsnorm)gemma_rmsnorm)rmsnorm)rmsnorm_fp4quant)add_rmsnorm_fp4quant)append_paged_kv_cache)append_paged_mla_kv_cache)get_batch_indices_positions)get_seq_lens)PODWithPagedKVCacheWrapper)BatchPODWithPagedKVCacheWrapper)#BatchPrefillWithPagedKVCacheWrapper)$BatchPrefillWithRaggedKVCacheWrapper)single_prefill_with_kv_cache)'single_prefill_with_kv_cache_return_lse)packbits)segment_packbits)apply_llama31_rope)apply_llama31_rope_inplace)apply_llama31_rope_pos_ids)"apply_llama31_rope_pos_ids_inplace)
apply_rope)apply_rope_inplace)apply_rope_pos_ids)apply_rope_pos_ids_inplace)apply_rope_with_cos_sin_cache)%apply_rope_with_cos_sin_cache_inplace)chain_speculative_sampling)min_p_sampling_from_probs)sampling_from_logits)sampling_from_probs)softmax)top_k_mask_logits)top_k_renorm_probs)top_k_sampling_from_probs) top_k_top_p_sampling_from_logits)top_k_top_p_sampling_from_probs)top_p_renorm_probs)top_p_sampling_from_probs)topk)top_k)top_k_page_table_transform)top_k_ragged_transform)BlockSparseAttentionWrapper)#VariableBlockSparseAttentionWrapper) prepare_low_latency_gemm_weights)next_positive_power_of_2)xqa)xqa_mla)mamba)__doc__importlib.util	importlibversionr   r    r   
activationr   r   r	   r
   	attentionr   r   	autotunerr   cascader   r   r   r   r   r   decoder   r   r   r   r   r   fp4_quantizationr   r   r   r   r   r   r    r!   r"   r#   r$   r%   r&   fp8_quantizationr'   r(   	fused_moer)   r*   r+   r,   r-   r.   r/   r0   gdn_prefillr1   gemmr2   r3   r4   r5   r6   r7   r8   r9   mlar:   normr;   r<   r=   r>   r?   r@   rA   pagerB   rC   rD   rE   podrF   rG   prefillrH   rI   rJ   rK   quantizationrL   rM   roperN   rO   rP   rQ   rR   rS   rT   rU   rV   rW   samplingrX   rY   rZ   r[   r\   r]   r^   r_   r`   ra   rb   rc   rd   re   rf   rg   sparserh   ri   trtllm_low_latency_gemmrj   utilsrk   rl   rm   rn        g/home/jaya/work/projects/VOICE-AGENT/VIET/agent-env/lib/python3.11/site-packages/flashinfer/__init__.py<module>r      s
         / / / / / / 7 7 7 7 7 7       4 4 4 4 4 4 > > > > > > 4 4 4 4 4 4      8 7 7 7 7 7      , + + + + +                0 / / / / / A A A A A A 1 1 1 1 1 1                     Y X X X X X N N N N N N                              D C C C C C C C	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 J I I I I I : : : : : : & & & & & & $ $ $ $ $ $ ( ( ( ( ( ( $ $ $ $ $ $ " " " " " " " " " " " " 2 2 2 2 2 2 O O O O O O 8 8 8 8 8 8 ( ( ( ( ( ( D D D D D D 0 0 0 0 0 0 $ $ $ $ $ $ 6 6 6 6 6 6 > > > > > > @ @ @ @ @ @ H H H H H H L L L L L L . . . . . . I I I I I I S S S S S S           R Q Q Q Q Q      / . . . . . > > > > > > : : : : : : J J J J J J J J J J J J      + * * * * * : : : : : : : : : : : : J J J J J J P P P P P P      O N N N N N L L L L L L B B B B B B @ @ @ @ @ @ ( ( ( ( ( ( < < < < < < > > > > > > L L L L L L      Y X X X X X > > > > > > L L L L L L                   J J J J J J B B B B B B N N N N N N           H G G G G G       # # # # # #        r   