a
    þd›  ã                   @   s(   d Z ddlZddlZdd„ Zdd„ ZdS )zP JIT scripting/tracing utils

Hacked together by / Copyright 2020 Ross Wightman
é    Nc                   C   s<   t tjdƒsJ dƒ‚tj d¡ tj d¡ tj d¡ dS )zÞ Set JIT executor to legacy w/ support for op fusion
    This is hopefully a temporary need in 1.5/1.5.1/1.6 to restore performance due to changes
    in the JIT exectutor. These API are not supported so could change.
    Ú_jit_set_profiling_executorzOld JIT behavior doesn't exist!FTN)ÚhasattrÚtorchÚ_Cr   Ú_jit_set_profiling_modeÚ_jit_override_can_fuse_on_gpu© r   r   úW/var/www/html/stable-diffusion-webui/venv/lib/python3.9/site-packages/timm/utils/jit.pyÚset_jit_legacy
   s    r
   c                 C   sr  | dkrlt j d¡ t j d¡ t j d¡ t j d¡ t j d¡ zt j d¡ W n tyf   Y n0 n| dks|| dkrÒt j d¡ t j d¡ t j d¡ t j d¡ zt j d¡ W n tyÎ   Y n0 nœ| dksä| dkrXdt	j
d	< t j d¡ t j d¡ t j d¡ t j ¡  t j ¡  t j d¡ t j d¡ t j d¡ t j d¡ ndsnJ d
| › dƒ‚d S )NÚteTFÚoldÚlegacyZnvfuserZnvfÚ1Z PYTORCH_NVFUSER_DISABLE_FALLBACKzInvalid jit fuser (ú))r   r   r   r   Z_jit_override_can_fuse_on_cpur   Z_jit_set_texpr_fuser_enabledZ_jit_set_nvfuser_enabledÚ	ExceptionÚosÚenvironZ_jit_can_fuse_on_cpuZ_jit_can_fuse_on_gpuZ_jit_set_nvfuser_guard_mode)Zfuserr   r   r	   Úset_jit_fuser   s>    



r   )Ú__doc__r   r   r
   r   r   r   r   r	   Ú<module>   s   