o
    ÓÙ¾iš  ã                   @   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 executor. 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   úB/home/ubuntu/.local/lib/python3.10/site-packages/timm/utils/jit.pyÚset_jit_legacy
   s   r
   c                 C   sj  | dkr6t j d¡ t j d¡ t j d¡ t j d¡ t j d¡ z	t j d¡ W d S  ty5   Y d S w | dks>| dkrjt j d¡ t j d¡ t j d¡ t j d¡ z	t j d¡ W d S  tyi   Y d S w | dksr| dkr­d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¡ d S J d
| › dƒ‚)NÚteTFÚoldÚlegacyÚnvfuserÚnvfÚ1Ú PYTORCH_NVFUSER_DISABLE_FALLBACKzInvalid jit fuser (ú))r   r   r   r   Ú_jit_override_can_fuse_on_cpur   Ú_jit_set_texpr_fuser_enabledÚ_jit_set_nvfuser_enabledÚ	ExceptionÚosÚenvironÚ_jit_can_fuse_on_cpuÚ_jit_can_fuse_on_gpuÚ_jit_set_nvfuser_guard_mode)Úfuserr   r   r	   Úset_jit_fuser   sB   ÿÿ


r   )Ú__doc__r   r   r
   r   r   r   r   r	   Ú<module>   s
    