
    )`ie                         d Z ddlmZmZmZ ddlmZ ddlZddl	Z	defdZ
defdZdefd	Zdefd
ZdefdZdefdZdS )a3  
Copyright (c) 2025 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.
   )JitSpecgen_jit_speccurrent_compilation_context)env    Nreturnc                  Z    t          dt          j        dz  t          j        dz  g          S )Ncommztrtllm_alltoall.cuztrtllm_alltoall_prepare.cur   jit_envFLASHINFER_CSRC_DIR     g/home/jaya/work/projects/VOICE-AGENT/VIET/agent-env/lib/python3.11/site-packages/flashinfer/jit/comm.pygen_comm_alltoall_moduler      s4    '*>>'*FF	
  r   c                  >    t          dt          j        dz  g          S )Ntrtllm_mnnvl_commztrtllm_mnnvl_allreduce.cur   r   r   r   gen_trtllm_mnnvl_comm_moduler   !   s(    '*EE	
  r   c                  (   t          j                    } d | D             dgz   t          j        t          j                            dd                    z   }t          dt           j        dz  gd t          j	                    D             |d	          S )
Nc                     g | ]}d | S )z-Lr   ).0lib_dirs     r   
<listcomp>z&gen_nvshmem_module.<locals>.<listcomp>-   s    000Gg000r   z-lnvshmem_deviceNVSHMEM_LDFLAGS nvshmemznvshmem_binding.cuc                 ,    g | ]}t          |          S r   )str)r   ps     r   r   z&gen_nvshmem_module.<locals>.<listcomp>5   s    PPPSVVPPPr   T)extra_include_pathsextra_ldflagsneeds_device_linking)
r   get_nvshmem_lib_dirsshlexsplitosenvirongetr   r   get_nvshmem_include_dirs)lib_dirsldflagss     r   gen_nvshmem_moduler,   *   s    +--H00x000
	
+bjnn%6;;
<
<	=  		$';	;<PPW-M-O-OPPP!   r   c                      t          j        ddg          } t          dt          j        dz  t          j        dz  t          j        dz  g|           S )	N	   
   )supported_major_versionstrtllm_commztrtllm_allreduce.cuztrtllm_allreduce_fusion.cuztrtllm_moe_allreduce_fusion.cu)extra_cuda_cflags)r   get_nvcc_flags_listr   r   r   )
nvcc_flagss    r   gen_trtllm_comm_moduler5   ;   sj    ,@"#R  J '*??'*FF'*JJ	

 %   r   c                  >    t          dt          j        dz  g          S )N	vllm_commzvllm_custom_all_reduce.cur   r   r   r   gen_vllm_comm_moduler8   J   s(    '*EE	
  r   c            	      D   t          dt          j        dz  t          j        dz  dz  dz  dz  dz  t          j        dz  dz  d	z  d
z  t          j        dz  dz  d	z  dz  gt          t          j        dz            t          t          j        dz  dz            g          S )Nmnnvl_moe_alltoallztrtllm_moe_alltoall.cunv_internaltensorrt_llmkernelscommunicationKernelszmoeAlltoAllKernels.cucppcommonzenvUtils.cppztllmException.cppinclude)r    )r   r   r   r   r   r   r   gen_moe_alltoall_modulerB   S   s    '*BB'  %	%
 && '  	
 '  "	"	
( +m;<<+m;iGHH
+   r   )__doc__corer   r   r   r   r   r   r$   r&   r   r   r,   r5   r8   rB   r   r   r   <module>rE      s      E D D D D D D D D D        				'    g    G    "    g          r   