
    rh                       U d Z ddlmZ ddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlmZ ddlmZmZmZmZ ddlmZmZmZmZm Z  ddl!m"Z" ddlm#Z# ddl$Z$ddl%Z$dd	l&m'Z' dd
l(m)Z) ddl*m+Z+ ddl,m-Z- ddl.m/Z/m0Z0m1Z1m2Z2 ddl%m3Z3 ddl4m5Z5m6Z6m7Z7m8Z8 ddl9m:Z: ddl;m<Z<m=Z= ddl>m?Z@ ddlAmBZB ddlCmDZD ddlEmFZFmGZG ddlHmIZImJZJ ddlKmLZLmMZMmNZNmOZOmPZP ddlQmRZRmSZS ddlTmUZUmVZVmWZWmXZXmYZY ddlZm[Z[m\Z\m]Z]m^Z^ ddl_m`Z`maZambZbmcZc ddlNmdZdmeZemfZfmgZgmhZhmiZimjZjmkZkmlZlmmZmmnZnmoZompZp ddlqmrZrmsZsmtZt ddlumvZv dd lwmxZxmyZy dd!lzm{Z{ dd"l|m}Z} dd#l~mZmZmZmZmZ dd$lPmZ dd%lmZmZmZmZ dd&lmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZ dd'lmZ d(ed)<   	 ddlZejH                  r"dd*lmZ dd+lmZ dd,lmZ dd-lmZmZmZ dd.lmZ  e
j`                  e      Ze$jf                  ji                  ed/      Ze$jf                  ji                  ed0      Z ejn                         Z ed1      Z e"d2      Z G d3 d4      Z G d5 d6      Z e       Z e       Zdad7ed8<    ej                  e@      	 dV	 	 	 	 	 	 	 dWd9       ZdXd:Zecj                  dYd;       Z	 	 dZ	 	 	 	 	 	 	 	 	 d[d<Zda ej                         Zd=ed><   d\d?Zd\d@Z G dA dB      Z	 	 	 	 d]	 	 	 	 	 	 	 	 	 	 	 d^dCZddDlmZ ddElmZ ejH                  rddFlmZ  eͫ       ZdGedH<   d_dIZ	 	 d`dddJ	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dadKZ G dL dM      Z	 dV	 	 	 	 	 	 	 dbdNZdcdOZdddPZ G dQ dRej                        Z G dS dT      Z	 	 	 	 	 	 dedUZy# e$ r dZY w xY w)fa  
This module implements TorchDynamo's core frame conversion functionality, transforming Python
frames into FX graphs. It handles:

- Frame analysis and bytecode transformation
- Guard creation and management for dynamic behaviors
- Cache management for recompilation
- Error handling and fallback mechanisms

Key classes:
- ConvertFrame: Main entry point for frame conversion with error handling
- ConvertFrameAssert: Implements core frame to graph conversion logic
- Tracker: Tracks input/output code objects during conversion
- CatchErrorsWrapper: Provides error handling and suppression logic

The conversion process preserves program semantics while enabling optimizations
through torch.compile() and related systems.
    )annotationsN)Path)CellTypeCodeTypeFunctionType
ModuleType)AnyCallableOptionalTypeVarUnion)	ParamSpec)ReferenceType)GlobalStateGuard)CallbackTrigger)get_compile_pg)TensorifyState)compile_contextCompileContext	CompileIdtracing)
structured)compile_time_strobelight_metajustknobs_check#maybe_upload_prof_stats_to_manifoldsignpost_event)_use_lazy_graph_module)ConstraintViolationErrorGuardOnDataDependentSymNode)_forward_from_src)_WaitCounter)DistributedDataParallel)_disable_current_modesis_in_torch_dispatch_mode)CapturedTracebackformat_traceback_short   )config
decoratorsexcgraph_break_hintstrace_rules)remove_dead_coderemove_pointless_jumps) check_inst_exn_tab_entries_validInstructionis_generator propagate_inst_exn_table_entriestransform_code_object)CacheSizeRelevantForFramecompute_cache_sizeexceeds_recompile_limitis_recompilation)always_optimize_code_objects
dynamo_tls	skip_codeTorchPatcher)augment_exc_messageBackendCompilerFailedFailOnRecompileLimitHitformat_error_msgInternalTorchDynamoErrorPackageErrorRecompileLimitExceededShortenTracebackSkipCodeRecursiveExceptionTorchRuntimeErrorUncapturedHigherOrderOpErrorunimplemented_v2Unsupported)CheckFunctionManager'get_and_maybe_log_recompilation_reasonsGuardedCode)Hooks)log_frame_dynamic_whitelistput_code_state)ExecutionRecord)TORCH_DYNAMO_RESUME_IN_PREFIX)DistributedStateExceptionStackInstructionTranslator
LocalStateSpeculationLog)is_numpy)ConvertFrameReturnFrameActionFrameExecStrategywrap_guarded_code)chromium_event_timedCleanupManagerCompileTimeInstructionCountercountersdynamo_timedformat_bytecodegen_record_file_nameget_metrics_contextincrement_frameis_namedtupleistype
LazyStringmaybe_disable_inference_mode*maybe_disable_inference_mode_for_fake_proporig_code_mapreset_graph_break_dup_checkersetup_compile_debug	to_int_ustroubleshooting_urlwrite_record_to_file)#torch_function_mode_stack_state_mgrzOptional[ModuleType]np)
CompilerFn)CompilePackage)WrapBackendDebug)BytecodeHook
CacheEntryDynamoFrameType)FrameStateSizeEntrybytecodegraph_breaks_T_Pc                      e Zd Zy)TODO_UNKNOWNN)__name__
__module____qualname__     n/var/www/html/ai-insurance-compliance-backend/venv/lib/python3.12/site-packages/torch/_dynamo/convert_frame.pyr}   r}      s    r   r}   c                  ,    e Zd ZddZddZddZddZy)	Trackerc                0    g | _         t               | _        y N)seensetseen_idsselfs    r   __init__zTracker.__init__   s    35	"%%r   c                     t        |       j                  vrQt        j                  | fd      } j                  j                  |        j                  j                         y y )Nc                :    j                   j                        S r   )r   remove)_idxr   s    r   <lambda>zTracker.add.<locals>.<lambda>   s    DMM4H4H4M r   )idr   weakrefrefr   appendadd)r   
strong_objobjr   s   `  @r   r   zTracker.add   sR    ndmm#++j*MNCIIS!MMc" $r   c                0    t        |      | j                  v S r   )r   r   )r   items     r   __contains__zTracker.__contains__   s    $x4==((r   c                l    | j                   j                          | j                  j                          y r   )r   clearr   r   s    r   r   zTracker.clear   s     		r   N)returnNone)r   r   r   r   )r   r   r   bool)r~   r   r   r   r   r   r   r   r   r   r   r      s    (#)r   r   zOptional[GlobalStateGuard]initial_global_statec                J    t        | ||      }t        |j                         |S r   )original_forward_from_srcr:   __code__)srcglobals	co_fieldsresults       r   fx_forward_from_src_skip_resultr      s#     'sGY?FfooMr   c                R     t        j                         d fd       } |_        |S )z
    Context manager to:
        1) Save/restore torch.is_grad_enabled() state
        2) Save/restore python random state
        3) Save/restore torch random state
        4) Monkey patch torch.fx.graph_module._forward_from_src
    c            	        t               }t        j                         }t        j                  j	                         5  t               5  t               5  t        j                         }t        j                         }t        j                         }t        j                  j                         }t        j                         }t        j                         }	t        j                  j                         }
d }t        j                  j!                         rt        j                  j                         }t        j                  j#                         }t        j$                  j&                  j(                  }t*        t        j$                  j&                  _        t-               }t/        j0                         }|j3                  t        j$                  j4                  j7                                |j3                  t8               	  | i ||j;                          t        j                  j=                         dk(  sJ d       |j;                          t        j                  j?                  |       t        j@                  jB                  jE                  |       t        jF                  ||       t        jH                  |       t        j                  jK                  |
       t        jL                  |	       t        j                  j                         }||k7  rt        j                  jO                          |t        j                  jK                  |       t        j                  jQ                  |       |t        j$                  j&                  _        |jS                         sJ d|jU                          d       cd d d        cd d d        cd d d        S # |j;                          t        j                  j=                         dk(  sJ d       |j;                          t        j                  j?                  |       t        j@                  jB                  jE                  |       t        jF                  ||       t        jH                  |       t        j                  jK                  |
       t        jL                  |	       t        j                  j                         }||k7  rt        j                  jO                          |t        j                  jK                  |       t        j                  jQ                  |       |t        j$                  j&                  _        |jS                         sJ d|jU                          d       w xY w# 1 sw Y   nxY wd d d        n# 1 sw Y   nxY wd d d        y # 1 sw Y   y xY w)Nr   zQTorch function mode stack state changed while dynamo tracing, please report a bug)	warn_onlyzGlobal z7state changed while dynamo tracing, please report a bug)+r   torchis_grad_enabled_C_PreserveDispatchKeyGuardrg   rh   is_inference_mode_enabled$are_deterministic_algorithms_enabled-is_deterministic_algorithms_warn_only_enabled$_is_default_mobile_cpu_allocator_setrandomgetstateget_default_dtypeget_rng_statecudais_available_get_cublas_allow_tf32fxgraph_moduler    r   rk   
contextlib	ExitStackenter_context_symbolic_trace_maybe_revert_all_patchesro   close_len_torch_function_stack_set_grad_enabledautograd	grad_mode_enter_inference_modeuse_deterministic_algorithmssetstateset_rng_stateset_default_dtype#_unset_default_mobile_cpu_allocator_set_cublas_allow_tf32checkreason)argskwargsguardsprior_grad_modeprior_inference_modeprior_deterministicprior_warn_onlyprior_mobile_allocator_statepy_rng_stateprior_dtypetorch_rng_statecuda_rng_state
allow_tf32prior_fwd_from_srccleanup
exit_stackcurr_mobile_allocator_statefns                    r   _fnz"preserve_global_state.<locals>._fn   s6   !#//1 HH..05	(*5	 785	
 $)#B#B#D "'"L"L"N#QQSO==? ) "??,L113K#ll88:O!Nzz&&(!&!9!9!;88:J!&!6!6!H!H6UEHH!!3)+G#--/J$$((BBD $$%HI4*6*xx99;q@ g@   "**?;((>>?ST22'? -**?;''4HHAAC , 03NNHH@@B!-JJ,,^<//
;:L%%7||~ fmmo..ef~g5	 5	 5	 5	: xx99;q@ g@   "**?;((>>?ST22'? -**?;''4HHAAC , 03NNHH@@B!-JJ,,^<//
;:L%%7||~ fmmo..ef~g5	 5	 5	 5	 5	 5	 5	 5	s\   W	V2F.VO
F9V	V2	WF;V	VV&"V2)	W2V;	7WWr   z_P.argsr   z	_P.kwargsr   rz   )	functoolswraps_torchdynamo_orig_callable)r   r   s   ` r   preserve_global_stater      s0     __R= =~ &(C"Jr   c                p   | j                   t        v ry| j                   j                  D ]  }|| j                  v s| j                  |   }t	        |t
              r%|j                  j                  d      s|t        u r yt        s]t        j                  sn|t        u st        |      s y i dfd| j                  j                         D ]  } |      s y t        j!                  d| j                   j"                  | j                   j$                  | j                   j&                         y)z+Check if the frame has torch.* related bitsTztorch.c           	         t               }|v r|   S d|<   t         t        j                  t        j                  j
                  f      s4t         t              r.t         t        j                  j
                        r
d|<   |   S t        j                  rDt        r>t         t        j                        st         t        j                        r
d|<   |   S t         t        t        f      rt!        fd D              |<   |   S t         t"              r5t         j%                               }t!        fd|D              |<   |   S t         t&        t(        t*        t        d      t,        f      r
d|<   |   S t/               r3t1         d      r't!         fd j2                  D              |<   |   S y)z)Recursively check if the obj has a tensorFTc              3  .   K   | ]  } |        y wr   r   .0v
has_tensors     r   	<genexpr>z:has_tensor_in_frame.<locals>.has_tensor.<locals>.<genexpr>T  s     ">Q:a=">   c              3  .   K   | ]  } |        y wr   r   r   s     r   r   z:has_tensor_in_frame.<locals>.has_tensor.<locals>.<genexpr>[  s     "AQ:a="Ar   N_fieldsc              3  B   K   | ]  } t        |              y wr   )getattr)r   r   r   r   s     r   r   z:has_tensor_in_frame.<locals>.has_tensor.<locals>.<genexpr>a  s     "T1:gc1o#>"Ts   )r   
isinstancer   TensornnModulere   type
issubclassr(   trace_numpyrp   ndarraygenericlisttupleanydictvaluesstrintfloatr   rd   hasattrr   )r   obj_idr  r   r   s   `  r   r   z'has_tensor_in_frame.<locals>.has_tensor@  s   CXF## cELL%((//:;3*S%((//"B#HVF##RZZ(JsBJJ,G#HVF##C$'"">#">>HVF##C #**,'F""A&"AAHVF##C#sE4:t<=$HVF##3GC$;""T"TTHVF## r   z0skipping because no torch.* %s             %s %sF)r   objectr   r   )f_coder8   co_names	f_globalsr   r   r~   
startswithr   rp   r(   r   rV   f_localsr  logdebugco_nameco_filenameco_firstlineno)framer  r   valuer   r   s       @@r   has_tensor_in_framer  +  s     ||33 <<(( 	eoo%//'*C#z*''1SE\f((cRi8C=	 !#H(V &&( e II	  ## r   c                    d }t        | d      r)t        | |      }t        || j                         || _        t        | |       y )Nexec_recordexport)r	  ra   rn   r  record_filenamer<   )ecoder  r  r  s        r   exception_handlerr   z  s?     Oq- .q$7_amm<+&)r   z/typing.Counter[Union[int, FrameStateSizeEntry]]FRAME_COMPILE_COUNTERc                <    t         j                  rt        |       S | S r   )r(   cprofilecprofile_wrapper)funcs    r   maybe_cprofiler&    s    %%Kr   c                D     t        j                         d fd       }|S )Nc                    t        j                         }|sJ d       t        dj                   dt	        |      j                  dd       d      }t        j                         }	 |j                          t        j                         } |j                  g| i |}t        j                         |z
  }|j                          t        j                  dj                  ||       t!        j"                  |      }	 |j%                  |       t        j                  d
|       |j)                  d      }		 t+        j,                  ddddddt	        |      gt*        j.                        }
t+        j0                  dddt	        |	      g|
j2                         t        j                  d|	       tA        t	        |            xr#tB        jD                  jG                  dfd       |S # t        $ r# t        j                  d       d} | i |}Y Pw xY w# t&        $ r t        j                  d	|       Y -w xY w# t4        $ r t        j                  d       |j7                  t         j8                  j:                        j=                  d       |j7                  t         j8                  j>                        j=                  d       Y !w xY w)NzTrace id is Nonez/tmp/r   /z.profilezfailed to enable cProfiler   z7### Cprofile for %s trace id [%s] took %.3f seconds ###zCannot write to %szRaw profile at %sz.svg	gprof2dotz-fpstatsz"--node-label=total-time-percentagez!--node-label=self-time-percentagez--node-label=total-time)stdoutdotz-Tsvgz-o)stdinz Generated SVG from profile at %szxFailed to generate SVG from profile -- dumping stats instead.Try installing gprof2dot and dot for a better visualization   linkc                     d dS )Ncprofile_manifold_url)nameurlr   )manifold_links   r   r   z;cprofile_wrapper.<locals>.profile_wrapper.<locals>.<lambda>  s    !8O r   )$r   current_trace_idr   r~   r  replacecProfileProfileenabletimeruncalldisable
ValueErrorr  	exceptionwarningr+  Stats
dump_statsOSErrorwith_suffix
subprocessPopenPIPE
check_callr,  FileNotFoundError
sort_statsSortKeyTIMEprint_stats
CUMULATIVEr   r   _loggingtrace_structured)r   r   trace_idprofile_pathprofstart_tsretvalprofile_latencypssvg_pathgprof2dot_processr5  r%  s              @r   profile_wrapperz)cprofile_wrapper.<locals>.profile_wrapper  s   !224+++xDMM?!CM$9$9#s$C#DHM
 !		+KKMyy{H!T\\$888F"iikH4OLLN
 	EMM		
 \\$	>OOL) 	'6++F3	E * 0 087-% "! !!s8}5'.. KK:HE @
 
= 
 NN++O e  	+MM56O4*6*F	+  	>MM.=	>, ! 	EKKN MM&..--.::2>MM&..334@@D	Es9   *A!G0 H <A9I 0(HHIIBKKr   )r   r   )r%  rZ  s   ` r   r$  r$    s'    __T? ?B r   c                  j    e Zd Z	 	 	 	 d	 	 	 	 	 	 	 	 	 	 	 ddZed	d       Zdd	 	 	 	 	 	 	 	 	 	 	 d
dZy)ConvertFrameAssertNc                ^    t                || _        || _        || _        || _        || _        y r   )rj   r   
_one_graph_export_export_constraints_package)r   compiler_fn	one_graphr  export_constraintspackages         r   r   zConvertFrameAssert.__init__  s/     	&'*5'##5 r   c                      fdS )Nc                \    t        | j                  j                  j                        S r   )convert_frame_assertr^  r_  r`  backendr   s    r   r   z8ConvertFrameAssert._clone_with_backend.<locals>.<lambda>  s'    3OOLL$$	 
 r   r   r   s   `r   _clone_with_backendz&ConvertFrameAssert._clone_with_backend  s    
 	
r   r   skipc                  t                |j                  }t        ||      }t        j	                  |       |t
        v r
t               S t        j                  j                  d      r6t        j                  j                  d      |j                  k7  r
t               S |j                  dk(  r%|j                  j                  d      r
t               S |j                  dk(  r
t               S |j                  dk(  rZ|j                  j                  t        j                  j                  t         j"                  j$                              r
t               S |j                  dk(  r|j                  dk(  r
t               S |j                  dk(  r.|j                  dk(  rt'        |j(                        s
t               S t+        |      r t-        d	d
ddgt.        j0                         t3        |      s
t               S t5        j6                         }|r?d|j                  j                  v r'|j8                  }|rd|j                  j                  v r'|r(|j                  t:        j<                  u rt        d      S t?               a d|vrtB        |d<   tB        dz  a!|d   }	tE        |	tF              sJ tH        |	   }
tH        |	xx   dz  cc<   d }tK        jL                         x}r|jN                  }tQ        ||	|
      }tS        dd|j                  |	tU        |      |j                  |jV                  |jX                  |jZ                  d       |j                  j                  t\              sG|j                   d|j                   d|jV                   }t^        j`                  jc                  |       te        tK        |            5  tg        |j                  |jh                  |jj                  |j(                  |jl                  | jn                  | jp                  | jr                  | jt                  |||||||dz   | jv                        cd d d        S # 1 sw Y   y xY w)NTORCHDYNAMO_DEBUG_FUNCTIONz	<genexpr>)ztransformers/file_utils.pyztransformers/utils/generic.pyzdiffusers/utils/outputs.py__setattr__r   z<module><string>z<lambda>zAttempt to trace generator z<Generators cannot be compiled directly with `torch.compile`.zbCall a generator from inside of a non-generator Python function and compile that function instead.gb_typecontextexplanationhintsztorch/_dynamo/convert_frame.pyF)apply_to_code_idr'   )compiled_autograd_idframe_idframe_compile_iddynamoz_convert_frame_assert._compile)r  r{  
compile_idr  r  
cache_sizeaccumulated_cache_size :)frame_stater~  rm  re  )<rc   r  r5   input_codesr   output_codesrW   osenvirongetr  r  endswithr  pathdirnamer   optim__file__r   
f_builtinsr1   rG   r+   FUNDAMENTALr  sys	_getframef_backr)   "_nonrecursive_disable_wrapper_coder   r   FRAME_COUNTERr   r  r!  r   current_compile_idrz  r   r   r  r  +num_cache_entries_with_same_id_matched_objsnum_cache_entriesrP   r9   traced_frame_infosr   r   _compiler  r  closurer   r^  r_  r`  ra  )r   r  cache_entryhooksr  rm  r  r  
prev_framer{  r|  rz  priorr~  infos                  r   __call__zConvertFrameAssert.__call__  s    	||'{;
<%''JJNN78

;<L%''<<;&4+;+;+D+D,
 &''<<=( &''<<:%$*:*:*E*EGGOOEKK001+

 &''
 <<:%$*:*:j*H%'' LLJ&  J.))* &''4Z5 '22		 #5)%'' ]]_
0J4E4E4Q4QQ#**J 0J4E4E4Q4QQ !!Z%R%RR%E::  01 #!.KQMu%(C(((0:h'1,'#"557757#(#=#= !5-

 	,<<$!*o#//"&"5"5(TT*4*F*F	
 ||&&'DEll^1T%5%5$6a8K8K7LMD))006^J78 	  //(('%AX#	 	 	s   BQQTFNN)rb  rq   rc  r   r  r   rd  Optional[typing.Never]re  Optional[CompilePackage]r   r   )r   z*Callable[[CompilerFn], ConvertFrameAssert]r  rv   r  Optional[CacheEntry]r  rL   r  *dict[str, Union[int, FrameStateSizeEntry]]rm  r  r   rW   r~   r   r   r   propertyrk  r  r   r   r   r\  r\    s     59,0     	 
 3  *  
   
 
 RR *R 	R
 @R R 
Rr   r\  c                     t        | ||||      S )z&Fully convert a frame into an FX graph)r\  )rb  rc  r  rd  re  s        r   rh  rh    s     Y(:G r   )OrderedDict)RemovableHandle)OutputGraphzdict[int, BytecodeHook]_bytecode_hooksc                J    t        t              }| t        |j                  <   |S )zRegister hooks for bytecode generated by Dynamo. The hook can do some
    logging, as well as return a new code object to be used. Please refer
    to `BytecodeHook` for the hook signature.
    )r  r  r   )hookhandles     r   register_bytecode_hookr    s!    
 _-F!%OFIIMr   )rm  re  c                  
/0123456789 ddl m0m}m9m} d3d 4d 8t
        j                  j                         7t        	 	 	 	 	 	 dC0 246789fd       }t        d      	 	 	 	 	 	 	 	 	 	 dD/fd       }t        	 	 	 	 	 	 	 	 	 	 dD
2345fd       /t               }j                         nt        j                         }t        t         j"                        5  t%        t'                    5  t)        d	d
d
      5  t+        d      j-                         5  |5  t/        ddd      5  |5  t1               5t3               6t5               x}rt7        |t9                     2nd 2d }t;        |      r|rt=        
|      }|sdn|d   }|j?                  d|i       tA        |      \  }}|rdEd}tB        jE                  d|tG        t         |       |       |tH               t         jJ                  rtM        | d      rtM        | d      tO        d      rtQ        | d      tS        dd| d| dg        tB        jU                  d jV                   jX                   jZ                  dz   d j]                  t_        j`                  dz   !      jc                                      te        jf                  th              1t
        jj                  jm                  d" 1fd#       to        jp                         }d }d }d } d }!t
        jr                  jt                  jv                  jy                          d }"	  | |	|      }"t{                t}                |"t
        jr                  j                   j~                  r@t/        d$d%&      5  tB        j                  d'       t        j                  d(       d d d        8ri 8j                  _D        i 8_E        d(d)l:mF}# t        |#      }$|4t        4j                        }%t        4j                  j                        }&4j                         }'t        4j                  j                        }(t        4j                        })4j                  D *ch c]  }*|*j                   }+}*4j                  D *ch c]  }*|*j                   },}*t
        jr                  jt                  jv                  jC                          nDd }%d }&d }'d }(d })t1        i       }+t1        i       },t1               5to        jp                         |z
  d*z  3i d+|$d, jV                  d- jX                  d. jZ                  d/|j                  d0|j                  d1|%d2|&d3|'d4|(d5|)d6|d7|d8| d9|!d:|+d;|,53|"d ut         j                  t         j                  t         j                  d
t        3      d<}-|j?                  |-       cd d d        cd d d        cd d d        cd d d        cd d d        cd d d        cd d d        S # 1 sw Y   fxY wc c}*w c c}*w # t        $ r}.t        |.      j                  }t        |.      }t        |. |=       t
        jj                  jm                  d>d? d@ A       t        j                  |.      \  } }!t        |.t        t        t        t        t        t        |t        |t        t        f      r t        t        |.      j                   dBt        |.             j                  |.j                        d d }.~.ww xY w# t
        jr                  j                   j~                  rMt/        d$d%&      5  tB        j                  d'       t        j                  d(       d d d        n# 1 sw Y   nxY w8ri 8j                  _D        i 8_E        d(d)l:mF}# t        |#      }$|4t        4j                        }%t        4j                  j                        }&4j                         }'t        4j                  j                        }(t        4j                        })4j                  D *ch c]  }*|*j                   nc c}*w }+}*4j                  D *ch c]  }*|*j                   nc c}*w },}*t
        jr                  jt                  jv                  jC                          nDd }%d }&d }'d }(d })t1        i       }+t1        i       },t1               5to        jp                         |z
  d*z  3i d+|$d, jV                  d- jX                  d. jZ                  d/|j                  d0|j                  d1|%d2|&d3|'d4|(d5|)d6|d7|d8| d9|!d:|+d;|,53|"d ut         j                  t         j                  t         j                  d
t        3      d<}-|j?                  |-       w xY w# 1 sw Y   nxY wd d d        n# 1 sw Y   nxY wd d d        n# 1 sw Y   nxY wd d d        n# 1 sw Y   nxY wd d d        n# 1 sw Y   nxY wd d d        n# 1 sw Y   nxY wd d d        y # 1 sw Y   y xY w)FNr   )bisectBisectValidationExceptiontranslation_validation_enabledValidationExceptiong        c                   j                          t               }t        | |	
|      	 j                  j	                          t        j                  j                        5  j                         5  j                          d d d        d d d        j                  j#                          j                  J j$                  sJ j$                  | d d  |j'                  j(                         t+        |        t-        |        t/        t1        |             | d d  y # 1 sw Y   xY w# 1 sw Y   xY w# t        j                  $ r j                           t        j                  t        j                  t        j                  f$ r  t        $ r%         r j                  j                           w xY w# j                  j#                          w xY w)N)r  speculation_logexn_vt_stackdistributed_statere  )restartrR   rS   outputmark_bytecode_tracing_startr   tracing_contextset_current_txrunr*   UnspecializeRestartAnalysisr   SpeculationRestartAnalysisTensorifyScalarRestartAnalysis	SkipFrame	Exception	shape_envcall_cleanup_hooksoutput_instructionsupdatecode_optionsr2   r/   r.   r-   )instructionsr  r  r  builtinsr  r  rb  r  r  rd  r  r   localsrc  r  re  r  tf_mode_stacktracerr  s      r   	transformz_compile.<locals>.transform  s    	!%'&#+%/#
(	/MM557667 9N9N9P 

   MM,,.!!!)))) 44QF//0(6(601A,1OPQ3   .. 	!!#**..MM
 	
  	-/v}}../	
 MM,,.sH   9E 2E D4E E 4D=	9E  E	E BGG G.compile_inner)
phase_namec           
        t        j                         5 }|j                  t        j                  j
                  j                  t        j                  t        t        j                                            |j                  t        j                                 | |||      cd d d        S # 1 sw Y   t               S xY wr   )r   r   r   r   _dynamocallback_handlerinstall_callbacksr   DYNAMOr  r   r  r]   recordrW   )r  rc  r  r  stack_compile_inners        r   r  z_compile.<locals>.compile_inner  s     !!# 	Eu..@@#**C0Q0Q0S,T
  = D D FG!$	5)D	E 	E 	E  	
s   BB00Cc           	     	   t        j                          x}}	 	 	 	 	 	 	 	 	 	 	 	 d d} |d| j                  | j                  | j                  |        d }t	        j
                         D ]B  }|t        j                         _        	 t        d| d      5  t        | |      }d d d         n j<                  J d       |J  |d| j                  | j                  | j                  |       t>        jA                         D ]  }
 |
| |      }||} | tB        |<   tD        j-                  |       ||z
  J d!d}|J  ||       } ||      }d}|d| jF                  d |  dz  }|d|jF                  d |  z  }| jF                  d | |jF                  d | k(  sJ |       d}|d| jH                   dz  }|d|jH                   z  }| jH                  |jH                  k(  sJ |       d}|d| jJ                   dz  }|d|jJ                   z  }| jJ                  |jJ                  k(  sJ |       jL                  rjO                         r
t;               S jP                  J jR                  tT        jV                  |<   t        dd      5  tY        | |r|jZ                  nd |r|j\                  nd rdnd       }d d d        *j^                  J ja                  |j^                  |       t1              nd}d|z   }tc        |jd                  |      }jO                         s'|jf                  |jg                  jP                         ti        |      S # 1 sw Y   xY w# t        j                  $ r}	t        |	t        j                        st        j                           t"        j%                  dt'        t(        |	j*                               j-                  |	j.                  xs t1        t3        |	                   t        j                          }|dkD  rt5        dd	d
g        Y d }	~	d }	~	wt        j6                  $ r}	t        |	t        j                        st        j                           t"        j9                  d|	| j                  | j                  | j                         |rt"        j9                  d       t;               cY d }	~	c S d }	~	ww xY w# 1 sw Y   *xY w)"Nc           	         t         j                  t        j                        r#t         j	                  t        | ||||             y y r   )bytecode_logisEnabledForloggingDEBUGr  r`   )prefixr3  filenameline_nor  s        r   log_bytecodez6_compile.<locals>._compile_inner.<locals>.log_bytecode)  s9     ((7""#FD(GTJ 8r   zORIGINAL BYTECODEcompile_attempt_T)log_pt2_compile_eventzRestarting analysis due to %sd   z!Excessive RestartAnalysis() callsrr  zDynamo attempted to trace the same frame 100+ times. Giving up on compiling as the compile time tradeoff is likely not worth the performance gain.rs  z.Skipping frame %s %s                     %s %sz%No graph captured with one_graph=Truez;compiler collective wasn't run before compilation completedzMODIFIED BYTECODEc                    dd l }| j                  | j                  z   t        | j                  |j
                  z        z   t        | j                  |j                  z        z   S )Nr   )inspectco_argcountco_kwonlyargcountr   co_flags
CO_VARARGSCO_VARKEYWORDS)r  r  s     r   
count_argsz4_compile.<locals>._compile_inner.<locals>.count_args  s]       (()t}}w'9'99:; t}}w'='==>?r   zarg mismatch: zold code object has args z, znew code object has args zfree var mismatch: zold code object has free var znew code object has free var zcell var mismatch: zold code object has cell var znew code object has cell var build_guardssave)guards_serialization_modeUnknownzTorch-Compiled Region: )r  r  r3  r  r  r  r  r  r  r   r   r   r  r   r   r  )5r;  r  r  r  	itertoolscountr   r  attemptr_   r3   r*   RestartAnalysisr   r  r   r   r  r  rf   r&   __traceback__r   restart_reasonr  r   rG   r  r  rW   
all_statesr  r  ri   r  co_varnamesco_freevarsco_cellvarsr  is_empty_graphr   cleanupsr\   instancerI   guard_fail_fnguard_filter_fnguards_stateadd_guarded_coderK   guard_managerguard_export_fnrZ   )r  rc  r  r  last_attempt_start_time
start_timer  out_coder  r  r  hook_outputr  total_argcount_oldtotal_argcount_newmsgcheck_fncompile_id_strannotation_strguarded_coder  r~  r  dynamo_time_before_restartr  re  restart_reasonss                       r   r  z _compile.<locals>._compile_inner  sN    04yy{:*		"	.1	<?	GO		 	LL	
  ( )	,G+2N (',!&wi0 F  5T9EHF )	,V !(,=,H,H,T 	
I	
T ###LL	
 $**, 	'DtX.K&&	'
 #'h"%<z%I"!!!	 ###'-'1*4+;+;<O=O+P*QQSTT*8+?+?@SAS+T*UVV001##$7%789	 	9 $.t/?/?.@CC.x/C/C.DEE8#7#77<<7#.t/?/?.@CC.x/C/C.DEE8#7#77<<7 ==V224%''}}(((,2OO).E 	+',##$).%%D4;&H	 ((444$$X%:%:HE,6,BZ	2^C"""	
 $$&5+@+@+L !!&--0 .._F F
 && !!S%G%GH"((*35qG
  ##A$4$4$DDGE*.))+'S=$ C "%6 ! == ,!!S%G%GH"((*		LL$$'' IIEF)++,n	 	sP   M6M)"M62S/)M3	.M66S,	B5QS,BS'S,'S,/S9r}  T)reset_event_log_on_exitr  z+pytorch.wait_counter.entire_forward_compilez_compile.compile_innerentire_frame_compile!dynamo_cumulative_compile_time_us)r  dynamo_compile_column_usz$Unable to find recompilation reasonsrecompile_reasonc                V    d| j                    d| j                   d| j                   dS )N'z' (r  ))r  r  r  )r  s    r   format_func_infoz"_compile.<locals>.format_func_info  s0    4<<.D,<,<+=Qt?R?R>SSTUUr   ztorch._dynamo hit config.%s (%s)
   function: %s
   last reason: %s
To log all recompilation reasons, use TORCH_LOGS="recompiles".
To diagnose recompilation issues, see %s.zK reached, because fail_on_recompile_limit_hit = True this is a HARD failurea1   reached with one_graph=True. Excessive recompilations can degrade performance due to the compilation overhead of each recompilation. To monitor recompilations, enable TORCH_LOGS=recompiles. If recompilations are expected, consider increasing torch._dynamo.config.cache_size_limit to an appropriate value.z;pytorch/compiler:skip_code_recursive_on_recompile_limit_hitz reachedzDynamo cache limit exceededzLimit type: zLDynamo attempted to recompile the code object too many times, exceeding the zo cache size limit.Giving up on compiling as the compile time tradeoff is likely not worth the performance gain.rs  zBtorchdynamo start compiling %s %s:%s, stack (elided %s frames):
%s   rr  rl  dynamo_startc                 .   dt        t        j                  fdt        j                  t        j                  dz         j                                            j                   j                  t        j                   j                        dgz   iS )Nr  c                    | d   k7  S )Nr  r   )fconvert_frame_interns    r   r   z,_compile.<locals>.<lambda>.<locals>.<lambda>@  s    !J-3G"G r      rl  )liner3  r  )r  r  	takewhiler   from_tracebackr%   extractsummaryr  r  intern_stringr  )r  r#  rm  s   r   r   z_compile.<locals>.<lambda>=  s    ''G"11-551t8DLLN !% 3 3 $$.$<$<T=M=M$N r   gc
gc_time_us)r  z run_gc_after_compile: running gcr'   )
curr_frameg    eA	frame_keyr  r  r  r  r  guard_countshape_env_guard_countgraph_op_countgraph_node_countgraph_input_count	fail_typefail_reasonfail_user_frame_filenamefail_user_frame_linenonon_compliant_opscompliant_custom_ops)r  dynamo_time_before_restart_shas_guarded_codeconfig_suppress_errors config_inline_inbuilt_nn_modulesspecialize_float
is_forward%dynamo_compile_time_before_restart_usr  artifactc                     dddS )Ndynamo_errorstringr3  encodingr   r   r   r   r   z_compile.<locals>.<lambda>p  s    * (% r   c                 *    t        j                         S r   	traceback
format_excr   r   r   r   z_compile.<locals>.<lambda>t  s    9#7#7#9 r   metadata_fn
payload_fnz: )r  zlist[Instruction]r  dict[str, object]r   r   )
r  r   rc  r   r  rL   r  z2Callable[[list[Instruction], dict[str, Any]], Any]r   rW   )r  r   r   r  )jtorch.fx.experimental.validatorr  r  r  r  r   	overrides _get_current_function_mode_stackr   r   r&  rb   code_contextr   nullcontextr   r(   use_lazy_graph_moduler   r   r[   r!   guardr_   r   rU   r   rQ   rT   r7   rJ   update_outerr6   r  r@  r   rm   fail_on_recompile_limit_hitr>   r   rB   rG   r  r  r  r  joinr%   r(  formatr   r*  r  rO  rP  r;  time_nsr  utilsReinplaceCountersr   rN   rM   run_gc_after_compiler  r+  collectr  local_scoper  r-  r  lenr   r  count_callsgraphnodesplaceholdersr8  r   r9  r  r  suppress_errorsinline_inbuilt_nn_modulesr>  rl   r  r   r   r*   get_exc_messager   rH   rE   r=   AssertionErrorr   r   rF   rC   rA   r@   with_tracebackr  ):r  r   r  r  r  rb  rc  r  rd  r  r  r  r  r  r~  rm  re  r  r  r  r  metrics_contextrR  
compile_pgr  reasonsexceeded
limit_typer  start_time_nsr4  r5  r6  r7  r  r-  r.  r/  r0  r1  r2  r3  opr8  r9  metricsr  r  r  r#  r  r  r  r  r  r  r  r  s:   ````````` `  ````                              @@@@@@@@@@@r   r  r    sV   (  ),$(F.2F 	88:  6Q'6Q7H6Q	6Q 6Q 6Q 6Qp #o>


 
 F	

 

 ?
& l/l/l/ l/ F	l/
 
l/ l/ l/\ *+O&-&9T"z?U?U?W  	v;;<F2z23F2 	d$	
F2 	BCIIKF2 	F2 	$-%H	
F2 	F2 %(E(*')):) 0Z\ J $ +/J'E=k5QG>E67ST:  	$$&8:J%KL6z:N*V KK<
 
+ & # 11-!l"mn  -!l #` `  !M -
|8-DEE !9*:,7!%%/L 12!2  			QLL1HGG%--1t8<CCEF	
4  *77A''	
( #'	%)26 04--335B	2(y%KL '-` }}##88!$N "HH?@JJqM" ,.)"$)JI"v'9!&--0(+F,<,<,C,C(D%!'!3!3!5#&v||'9'9#: $'(;(;$<!?E?W?W$XR__$X!$X.4.I.I((*BOO($ ( ##5599;"(,%!%#' $(!$'G!'*2w$"%%.2lln}.LPS-S*Y4<< t// !$"5"5	
 jTT )**F*F { ()> !. #$4 $%6 Y { +,D )*@  $%6!" '(<#$ $30J$0$<*0*@*@4:4T4T$*$;$;"9B.:3G@ ((1MF2 F2 F2 F2 F2 F2 F2 F2H" "" %Y(E  (	< Q,,Ia&KauV<NN++ : ,  @C?R?R:@<$&< %)",/'0-$    /Aw++,Bs1vh7 .1t<M(	<^ }}##88!$N "HH?@JJqM" " " ,.)"$)JI"v'9!&--0(+F,<,<,C,C(D%!'!3!3!5#&v||'9'9#: $'(;(;$<!?E?W?W$XR__$X$X!$X.4.I.I((*BOO( ($ ( ##5599;"(,%!%#' $(!$'G!'*2w$"%%.2lln}.LPS-S*Y4<< t// !$"5"5	
 jTT )**F*F { ()> !. #$4 $%6 Y { +,D )*@  $%6!" '(<#$ $30J$0$<*0*@*@4:4T4T$*$;$;"9B.:3G@ ((1MF2 F2 F2 F2 F2 F2 F2 F2 F2 F2 F2 F2 F2 F2 F2 F2 F2 F2 F2 F2sP  8i/ii6h0	9hhHg1!Y=1g1.+X=B=g1Y
)g19YD1g1=	h	h	h0		i!	i*	i/=Yg1	]C.]]]2g.+^90	g.9_>B<g.:bg.#b76D8g..g11g:6h=	hhh	h0	h$ h0	'	i0h95i<	ii
i	i/i#	i//i8c                  Z    e Zd Z	 d	 	 	 	 	 	 	 ddZedd       Z	 d	 	 	 	 	 	 	 	 	 	 	 d	dZy)
ConvertFrameNc                F    || _         t        |d|      | _        || _        y )NF)rc  re  )r   rh  _inner_convert_hooks)r   rb  r  re  s       r   r   zConvertFrame.__init__  s)     +6'25'
 r   c                      fdS )Nc                0    t        | j                        S r   )convert_framerv  ri  s    r   r   z2ConvertFrame._clone_with_backend.<locals>.<lambda>  s    }WdkkB r   r   r   s   `r   rk  z ConvertFrame._clone_with_backend  s	    BBr   c                   t         j                  |j                         t        d   dxx   dz  cc<   	 | j	                  |||||dz         }t        d   dxx   dz  cc<   |S # t
        $ r}t        |t              r t        |t              }|rt        j                  t        j                        rt        |d      rt        |d      rt        t        |j                               5  |j"                  }	dj%                  t'        j(                  |	            }
d	|
 t*        j,                  j/                  d
d fd       t        j1                  d       d d d        n# 1 sw Y   nxY wt2        j4                  s|s t7        |dd       }|j                  }t9        ||||      }|rt:        j=                  |d       nt:        j?                  |d       t        |t@              r7tC        tE        tF        jH                  tF        jH                              cY d }~S t        |tJ              r7tC        tE        tF        jL                  tF        jL                              cY d }~S Y d }~tC               S d }~ww xY w)Nframestotalr'   rl  okr~  
real_stackrr  z&Graph break: skip: from user code at:
rA  c                     dddS )Ndynamo_graph_break_reasonrD  rE  r   r   r   r   r   z'ConvertFrame.__call__.<locals>.<lambda>"  s    (C,41 r   c                 6      dt        j                          S )N
rH  )user_stack_traces   r   r   z'ConvertFrame.__call__.<locals>.<lambda>&  s    2B1C2iFZFZF\E]/^ r   rK  T)exc_infor  )frame_exec_strategy)'r  r   r  r^   ru  r  r   rF   rH   graph_break_logr  r  r  r	  r   r   r~  r~  rX  rI  format_listr   rO  rP  r  r(   re  r   r?   r  r  r@  rD   rW   rY   rX   SKIPrB   RUN_ONLY)r   r  r  r  r  rm  r   r  	soft_fail
user_stackuser_stack_formattedr  r  	error_msgr  s                 @r   r  zConvertFrame.__call__  s9    	%7#q(#Q	(({E;TAX ) F Xt$)$M K	 !9:"1k2I _99'--H 1l+<0H()EF %&\\
/1ww%11*=0, .UUiTj+k(77&) (_ 8  (--,%) .   & ))) &a):DAO<<D(D/5IIT2I5!78)(9#((+*:*:) 
 A56)(9#,,k.B.B)  7 "##[K	sE   .A% %
I?/A<I:+A3E'	I:'E0	,B3I:I?%AI:&I?:I?r   )rb  rq   r  rL   re  r  r   r   )r   z*Callable[[WrapBackendDebug], ConvertFrame])r   r  r  r   r   r   rs  rs    s    
 -1	

 
 *	

 

 C C ]$]$ *]$ 	]$
 @]$ ]$ 
]$r   rs  c                    t        | ||      S )zHTry to convert a frame into an FX graph, if error leave frame unmodified)re  )rs  )rb  r  re  s      r   ry  ry  M  s     UG<<r   c                `   ddl m} t        j                  }dt        _        t	        | d      5 }t        j                  |      }d d d        t        t        j                  j                  j                         t               j                                     |_
        	 t        |j                  |j                  |j                  |j                  |j                   |ddd t#               t%        dd      d d i t'        dd      	       |t        _        y # 1 sw Y   xY w# |t        _        w xY w)
Nr'   )eagerFrbr   *   i  )r{  r|  )
rb  rc  r  rd  r  r  r  r  r  r~  )backends.debuggingr  r(   replay_record_enabledopenrO   loadr  r  chainr   itemsr  r  r  r  r  rL   r4   r   )r  r  original_replay_valin_filer  s        r   replayr  U  s    ) 66#(F 	h	 / %%g./)//&..*>*>*@')//BSTUFN;KKNNMMOONN#'0A6 "sC	
$ (;$// /. (;$s   DA)D  D D-c                    t         j                  dk  ryt        j                  |       D ]"  }|j                  dk(  s|j
                  dz  c S  t        d      )N)      r   RESUMEr  z$RESUME instruction not found in code)r  version_infodisget_instructionsopnameoffsetRuntimeError)r  insts     r   first_real_inst_idxr  t  sV    
'!$$T* $;;(";;!##$ =
>>r   c                  0    e Zd Zdd	 	 	 	 	 	 	 	 	 	 	 ddZy)ConvertFrameProtocolr   rl  c                    y r   r   )r   r  r  r  r  rm  s         r   r  zConvertFrameProtocol.__call__~  s     !r   Nr  )r~   r   r   r  r   r   r   r  r  }  sG     !! *! 	!
 @! ! 
!r   r  c                  ,    e Zd ZddZ	 	 	 	 	 	 	 	 ddZy)CatchErrorsWrapperc                V     t        j                  |      |        || _        || _        y r   )r   r   r   r  )r   callbackr  s      r   r   zCatchErrorsWrapper.__init__  s$    !	!$'*2'
r   c           	        |J t         j                  |j                         t        j                  |j                        }t
        j                  dk\  r#|j                  t        |j                        kD  }n"|j                  t        |j                        k\  }|s5|s3t        j                  s#t        d      rt        | j                  dd      st        j                  t         j"                        rx|rd}n3t        j                  |j                        rd}nt        d      rd}nd}t        j%                  d	|j                  j&                  ||j                  j(                         t+               S |j                  j(                  d
k(  r#|j                  j&                  dk(  r
t+               S t,        j.                  j0                  j3                         dk(  rt5        j6                         }|rt8        5  ddlm}  ||j>                  | j                  j                        }	tA        | j                  d      sJ d       | j                  jC                  |	jD                        }
 |
||| jF                  |      cd d d        S t8        5  tI               5  | j                  ||| jF                  |d      cd d d        cd d d        S # 1 sw Y   MxY w# 1 sw Y   nxY wd d d        y # 1 sw Y   y xY w)N)r     F)include_infra_modesr_  ztraced frame alreadyzin skipfileszSnon-infra torch dispatch mode present, this is not supported today in torch.compilezdynamo tracing is disabledz#skipping: %s (reason: %s, file: %s)rq  __new__ddp_optimizerr   )DDPOptimizer)bucket_bytes_capbackend_compile_fnrk  zJDDPOptimizer only supports callback fns that know how to clone themselves.r'   rl  )%r  r   r  r,   r   r  r  f_lastir  r(   r=  r$   r   r   r  r  r  r  r  r  r  rW   r   r  r[  get_optimize_ddp_moder"   _get_active_ddp_modulecompile_lock"torch._dynamo.backends.distributedr  r  r	  rk  
compile_fnr  r#   )r   r  r  r  is_skipfilehas_started_executionskip_reason
ddp_moduler  r  hijacked_callbacks              r   r  zCatchErrorsWrapper.__call__  sz    &&&%!''5w&$)MM4G4U$U!$)MM5H5V$V! "~~)eD ? ?ER .("8K &&u||4"0K.5I"wK">K		9LL((LL,,	 &''<<##z1ell6J6Ji6W%''==446/I0GGIJ! O$0)3)D)D+/+J+J+e+e%M #779N  e  77KK)44 &
 -{DJJ# *  	13 	22{DJJ! 3 	 	 	+ *	 	 	 	 	s1   :BKK. K:	K.KK"	K..K7N)r  r  r  rL   r   r   )r  rv   r  r  r  r  r   rW   )r~   r   r   r   r  r   r   r   r  r    s8    
JJ *J @	J
 
Jr   r  c                    t        | |      S r   )r  )r  r  s     r   catch_errors_wrapperr    s     h..r   r   )r   r  r   zdict[str, Any]r   zOptional[dict[str, str]]r   r   )r   Callable[_P, _T]r   r  )r  rv   r   r   )NF)
r  r  r  r   r  Optional[DynamoFrameType]r  r   r   r   )r%  r  r   r  r  )rb  rq   rc  r   r  r   rd  r  re  r  r   r\  )r  rt   r   r  )NN)$r  r   r   rN  r  rN  r  rN  r  ztuple[CellType]rb  rq   rc  r   r  r   rd  r  r  rL   r  r  r  r4   r  r  r  z4Optional[dict[str, Union[int, FrameStateSizeEntry]]]r~  r   rm  r  re  r  r   rW   )rb  rq   r  rL   re  r  r   rs  )r  r  r   r   r  )r  r  r  rL   r   r  )__doc__
__future__r   collectionsr   r8  r  r   r+  r  r  r  r+  r   rE  r  	threadingr;  rI  typingr   pathlibr   typesr   r   r   r   r	   r
   r   r   r   typing_extensionsr   r   r   torch._loggingtorch._C._dynamo.guardsr   torch._dynamo.callbackr   torch._dynamo.distributedr   torch._dynamo.symbolic_convertr   torch._guardsr   r   r   r   r   torch._utils_internalr   r   r   r   torch.fx._lazy_graph_moduler   %torch.fx.experimental.symbolic_shapesr   r   torch.fx.graph_moduler    r   torch.monitorr!   torch.nn.parallel.distributedr"   torch.utils._python_dispatchr#   r$   torch.utils._tracebackr%   r&   rr  r(   r)   r*   r+   r,   bytecode_analysisr-   r.   bytecode_transformationr/   r0   r1   r2   r3   r  r4   r5   r6   r7   
eval_framer8   r9   r:   r;   r<   r=   r>   r?   r@   rA   rB   rC   rD   rE   rF   rG   rH   r   rI   rJ   rK   r  rL   pgorM   rN   replay_recordrO   resume_executionrP   symbolic_convertrQ   rR   rS   rT   rU   rV   rW   rX   rY   rZ   r[  r[   r\   r]   r^   r_   r`   ra   rb   rc   rd   re   rf   rg   rh   ri   rj   rk   rl   rm   rn   variables.torch_functionro   __annotations__numpyrp   ModuleNotFoundErrorTYPE_CHECKINGbackends.registryrq   re  rr   repro.after_dynamors   rt   ru   rv   variables.builderrw   	getLoggerr~   r  rO  getArtifactLoggerr  r  RLockr  rz   r{   r}   r   r  r  r   r   r   r   #suppress_torch_distributed_warningsr  r   r  Counterr!  r&  r$  r\  rh  r  torch.utils.hooksr  output_graphr  r  r  r  rs  ry  r  r  Protocolr  r  r  r   r   r   <module>r     s  & #    
  	   	    
       > > : : ' !   4 2 4 9 M M %  ? Q & A M E E G       
  < * ;  " X X     , J  
 
-'4@@6 g!~~//*E..228^L y T]t_	 	 ( iy37 0 7 *+MQ	%2J ,JZ 11K 2Kb (,	**
* %* 	*
 
* K F 
CLl lb 15(,


 
 /	

 &
 
 $ - 
) ,7=( 8. (,HLk2" (,%k2
k2k2 k2  	k2
 k2 k2 k2 k2 /k2 k2 &k2 *k2 %k2 Fk2  !k2" #k2$ &%k2& 'k2^n$ n$d PT==$)=4L==;>?	!6?? 	!P Pf/"/+0//})  	Bs   O   O
O