o
    á)ix  ã                
   @   s\  d dl Z d dlZd dlmZ d dlmZ eeƒZedƒdup#edƒduZer“zCd dl	m
Z
 dd„ e
 ¡ D ƒZe j d	¡ZeduoGee ¡ ƒd kZerVeeƒd krVe d
¡ nesheeƒdkrhe deeƒ¡ dZW n) eyy   e d¡ dZY n ey’ Z ze de¡ dZW Y dZ[ndZ[ww esše d¡ G dd„ dejƒZG dd„ dejƒZdS )é    N)Ú	find_spec)Úinit_loggerÚtritonzpytorch-triton-xpu)Úbackendsc                 C   s"   g | ]}|j r|j  ¡ r|j ‘qS © )ZdriverÚ	is_active)Ú.0Úxr   r   úg/home/app/PaddleOCR-VL-test/.venv_paddleocr/lib/python3.10/site-packages/vllm/triton_utils/importing.pyÚ
<listcomp>   s    þþÿr   ZCUDA_VISIBLE_DEVICESzaTriton found 0 active drivers in distributed environment. This is expected during initialization.é   zkTriton is installed but %d active driver(s) found (expected 1). Disabling Triton to prevent runtime errors.FzSTriton is installed, but `triton.backends` could not be imported. Disabling Triton.zXAn unexpected error occurred while checking Triton active drivers: %s. Disabling Triton.z\Triton not installed or not compatible; certain GPU-related functions will not be available.c                       s$   e Zd Z‡ fdd„Zdd„ Z‡  ZS )ÚTritonPlaceholderc                    sN   t ƒ  d¡ d| _|  d¡| _|  d¡| _|  d¡| _|  d¡| _tƒ | _	d S )Nr   z3.3.0ÚjitÚautotuneÚ
heuristicsÚConfig)
ÚsuperÚ__init__Ú__version__Ú_dummy_decoratorr   r   r   r   ÚTritonLanguagePlaceholderÚlanguage©Úself©Ú	__class__r   r
   r   E   s   zTritonPlaceholder.__init__c                 C   s   dd„ }|S )Nc                  _   s    | rt | d ƒr| d S dd„ S )Nr   c                 S   s   | S )Nr   )Úfr   r   r
   Ú<lambda>S   s    zGTritonPlaceholder._dummy_decorator.<locals>.decorator.<locals>.<lambda>)Úcallable)ÚargsÚkwargsr   r   r
   Ú	decoratorP   s   z5TritonPlaceholder._dummy_decorator.<locals>.decoratorr   )r   Únamer!   r   r   r
   r   N   s   z"TritonPlaceholder._dummy_decorator)Ú__name__Ú
__module__Ú__qualname__r   r   Ú__classcell__r   r   r   r
   r   C   s    	r   c                       s   e Zd Z‡ fdd„Z‡  ZS )r   c                    s(   t ƒ  d¡ d | _d | _d | _d | _d S )Nztriton.language)r   r   Z	constexprZdtypeZint64Zint32r   r   r   r
   r   Z   s
   
z"TritonLanguagePlaceholder.__init__)r#   r$   r%   r   r&   r   r   r   r
   r   X   s    r   )ÚosÚtypesÚimportlib.utilr   Zvllm.loggerr   r#   ÚloggerZ
HAS_TRITONZtriton.backendsr   ÚvaluesZactive_driversÚenvironÚgetZcuda_visible_devicesÚlenÚstripZis_distributed_envÚdebugÚinfoÚImportErrorÚwarningÚ	ExceptionÚeÚ
ModuleTyper   r   r   r   r   r
   Ú<module>   s\   
þÿÿÿý€ÿþ€û
