
    )`i~	                     \    d Z ddlZddlZddlZ ej        e          Z G d d          ZdS )ak  
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.


Global compilation context management for FlashInfer.
    Nc                   H    e Zd ZddgZd Z	 ddee         dee         fdZdS )	CompilationContextz-DFLASHINFER_ENABLE_FP8_E8M0z-DFLASHINFER_ENABLE_FP4_E2M1c                     t                      | _        dt          j        v rt          j        d                             d          D ]_}|                    d          \  }}t          |          }| j                            t          |          t          |          f           `d S 	 t          t          j
                                                  D ]r}t          j
                            |          \  }}|dk    rt          |          dz   }| j                            t          |          t          |          f           sd S # t          $ r)}t                              d| d           Y d }~d S d }~ww xY w)NFLASHINFER_CUDA_ARCH_LIST .	   az!Failed to get device capability: )setTARGET_CUDA_ARCHSosenvironsplitintaddstrrangetorchcudadevice_countget_device_capability	Exceptionloggerwarning)selfarchmajorminordevicees         r/home/jaya/work/projects/VOICE-AGENT/VIET/agent-env/lib/python3.11/site-packages/flashinfer/compilation_context.py__init__zCompilationContext.__init__!   s   !$&"*44
#>?EEcJJ E E#zz#uE

&**CJJE

+CDDDDE E
I#EJ$;$;$=$=>> I IF#(:#C#CF#K#KLE5zz #E

S 0*..E

CJJ/GHHHH	I I
  I I IG1GGGHHHHHHHHHIs   *BE
 

E=E88E=Nsupported_major_versionsreturnc                     rfd| j         D             }n| j         }t          |          dk    rt          d d          d |D             | j        z   S )Nc                 (    g | ]}|d          v |S )r    ).0major_minor_tupler#   s     r!   
<listcomp>z:CompilationContext.get_nvcc_flags_list.<locals>.<listcomp>6   s4     $ $ $%$Q'+CCC "CCC    r   z9No supported CUDA architectures found for major versions r   c                 ,    g | ]\  }}d | | d| | S )z-gencode=arch=compute_z	,code=sm_r'   )r(   r   r   s      r!   r*   z:CompilationContext.get_nvcc_flags_list.<locals>.<listcomp>A   sG     
 
 
u KUJEJJEJ5JJ
 
 
r+   )r   lenRuntimeErrorCOMMON_NVCC_FLAGS)r   r#   supported_cuda_archss    ` r!   get_nvcc_flags_listz&CompilationContext.get_nvcc_flags_list2   s     $ 	:$ $ $ $)-)?$ $ $   $(#9 #$$))gLdggg  
 
 4
 
 
 "# 	#r+   )N)	__name__
__module____qualname__r/   r"   listr   r   r1   r'   r+   r!   r   r      sj        &&
I I I$ 59# #(,S	#	c# # # # # #r+   r   )__doc__r   r   logging	getLoggerr2   r   r   r'   r+   r!   <module>r9      sp    & 
			  		8	$	$)# )# )# )# )# )# )# )# )# )#r+   