
    [Th                       % S r SSKJr  SSKrSSKrSSKrSSKrSSKrSSKrSSK	r	SSK
r
SSKrSSKrSSKrSSKrSSKrSSKrSSKrSSKrSSKrSSKrSSKJr  SSKJrJrJrJr  SSKJrJrJrJrJ r   SSK!J"r"  SSKJ#r#  SSK$r$SSK%r$SS	K&J'r'  SS
K(J)r)  SSK*J+r+  SSK,J-r-J.r.J/r/J0r0  SSK%J1r1  SSK2J3r3J4r4J5r5J6r6  SSK7J8r8  SSK9J:r:J;r;  SSK<J=r>  SSK?J@r@  SSKAJBrB  SSKCJDrDJErE  SSKFJGrGJHrH  SSKIJJrJJKrKJLrLJMrM  SSKNJOrOJPrP  SSKQJRrRJSrSJTrTJUrUJVrV  SSKWJXrXJYrYJZrZJ[r[  SSK\J]r]J^r^J_r_J`r`  SSKKJaraJbrbJcrcJdrdJereJfrfJgrgJhrhJiriJjrjJkrkJlrl  SSKmJnrnJoroJprp  SSKqJrrr  SSKsJtrt  SS KuJvrv  SS!KwJxrx  SS"KyJzrzJ{r{J|r|J}r}J~r~  SS#KMJr  SS$KJrJrJrJr  SS%KJrJrJrJrJrJrJrJrJrJrJrJrJrJrJrJrJrJr  SS&KJr  S'\S('    SSKr\GR:                  (       a  SS)KJr  SS*KJr  SS+KJrJrJr  SS,KJr  \
GRN                  " \5      r\$GRT                  GRW                  \S-5      r\$GRT                  GRW                  \S.5      r\GR\                  " 5       r\" S/5      r\"" S05      r " S1 S25      r " S3 S45      r\" 5       r\" 5       rSqS5\S6'   \GRn                  " \>5       ST       SUS7 jj5       rSVS8 jr\`GRt                  SWS9 j5       r  SX         SYS: jjrSq\GR|                  " 5       rS;\S<'   SZS= jrSZS> jr " S? S@5      r   S[         S\SA jjrSSBKJr  SSCKJr  \GR:                  (       a  SSDKJr  \" 5       rSE\SF'   S]SG jr  S^SSH.                                 S_SI jjjr " SJ SK5      rS`SL jrSaSM jrSbSN jr " SO SP\GR                  5      r " SQ SR5      r      ScSS jrg! \ a    Sr GNf = f)da  
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)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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RecompileLimitExceededShortenTracebackSkipCodeRecursiveExceptionTorchRuntimeErrorUncapturedHigherOrderOpErrorunimplemented_v2Unsupported)CheckFunctionManager'get_and_maybe_log_recompilation_reasonsGuardedCode)Hooks)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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)WrapBackendDebug)BytecodeHook
CacheEntryDynamoFrameType)FrameStateSizeEntrybytecodegraph_breaks_T_Pc                      \ rS rSrSrg)TODO_UNKNOWN    N)__name__
__module____qualname____firstlineno____static_attributes__rx       S/var/www/auris/envauris/lib/python3.13/site-packages/torch/_dynamo/convert_frame.pyrv   rv      s    r~   rv   c                  <    \ rS rSrSS jrS	S jrS
S jrSS jrSrg)Tracker   c                0    / U l         [        5       U l        g N)seensetseen_idsselfs    r   __init__Tracker.__init__   s    35	"%%r~   c                   ^ ^ [        U5      mTT R                  ;  aS  [        R                  " UUU 4S j5      nT R                  R                  U5        T R                  R                  T5        g g )Nc                :   > TR                   R                  T5      $ r   )r   remove)_idxr   s    r   <lambda>Tracker.add.<locals>.<lambda>   s    DMM4H4H4Mr~   )idr   weakrefrefr   appendadd)r   
strong_objobjr   s   `  @r   r   Tracker.add   sR    ndmm#++j*MNCIIS!MMc" $r~   c                2    [        U5      U R                  ;   $ r   )r   r   )r   items     r   __contains__Tracker.__contains__   s    $x4==((r~   c                l    U R                   R                  5         U R                  R                  5         g r   )r   clearr   r   s    r   r   Tracker.clear   s     		r~   )r   r   N)returnNone)r   r   r   r   )r   r   r   bool)	ry   rz   r{   r|   r   r   r   r   r}   rx   r~   r   r   r      s    (#)r~   r   zOptional[GlobalStateGuard]initial_global_statec                H    [        XU5      n[        UR                  5        U$ r   )original_forward_from_srcr8   __code__)srcglobals	co_fieldsresults       r   fx_forward_from_src_skip_resultr      s!     'sY?FfooMr~   c                X   ^  [         R                  " T 5      SU 4S jj5       nT Ul        U$ )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                 @  > [        5       n[        R                  " 5       n[        R                  R	                  5          [        R
                  " 5       n[        R                  " 5       n[        R                  " 5       n[        R                  R                  5       n[        R                  " 5       n[        R                  " 5       n	[        R                  R                  5       n
S n[        R                  R                  5       (       a  [        R                  R                  5       n[        R                  R                  5       n[        R                   R"                  R$                  n[&        [        R                   R"                  l        [)        5       n[*        R,                  " 5       nUR/                  [        R                   R0                  R3                  5       5        UR/                  [4        5         T" U 0 UD6UR7                  5         [        R                  R9                  5       S:X  d   S5       eUR7                  5         [        R                  R;                  U5        [        R<                  R>                  RA                  U5        [        RB                  " XVS9  [        RD                  " U5        [        R                  RG                  U
5        [        RH                  " U	5        [        R                  R                  5       nUU:w  a  [        R                  RK                  5         Ub  [        R                  RG                  U5        [        R                  RM                  U5        U[        R                   R"                  l        URO                  5       (       d   SURQ                  5        S35       esS S S 5        $ ! UR7                  5         [        R                  R9                  5       S:X  d   S5       eUR7                  5         [        R                  R;                  U5        [        R<                  R>                  RA                  U5        [        RB                  " XVS9  [        RD                  " U5        [        R                  RG                  U
5        [        RH                  " U	5        [        R                  R                  5       nUU:w  a  [        R                  RK                  5         Ub  [        R                  RG                  U5        [        R                  RM                  U5        U[        R                   R"                  l        URO                  5       (       d   SURQ                  5        S35       ef = f! , (       d  f       g = f)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_PreserveDispatchKeyGuard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   re   
contextlib	ExitStackenter_context_symbolic_trace_maybe_revert_all_patchesri   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   _fn"preserve_global_state.<locals>._fn   s   !#//1
 XX//1#(#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~_ 212 xx99;q@ g@   "**?;((>>?ST22' -**?;''4HHAAC , 03NNHH@@B!-JJ,,^<//
;:L%%7||~~ fmmo..ef~_ 21s&   F9V9O
 G V
GVV
Vr   z_P.argsr   z	_P.kwargsr   rs   )	functoolswraps_torchdynamo_orig_callable)r   r   s   ` r   preserve_global_stater      s0     __R8 8t &(C"Jr~   c                  ^^ U R                   [        ;   a  gU R                   R                   H  nXR                  ;   d  M  U R                  U   n[	        U[
        5      (       a+  UR                  R                  S5      (       d	  U[        L a    g[        (       d  Mp  [        R                  (       d  M  U[        L d  [        U5      (       d  M    g   0 mSUU4S jjmU R                  R                  5        H  nT" U5      (       d  M    g   [        R!                  SU R                   R"                  U R                   R$                  U R                   R&                  5        g)z+Check if the frame has torch.* related bitsTztorch.c           	       >^  [        T 5      nUT;   a  TU   $ STU'   [        T [        R                  [        R                  R
                  45      (       d>  [        T [        5      (       a3  [        T [        R                  R
                  5      (       a
  STU'   TU   $ [        R                  (       aS  [        (       aH  [        T [        R                  5      (       d  [        T [        R                  5      (       a
  STU'   TU   $ [        T [        [        45      (       a  [!        U4S jT  5       5      TU'   TU   $ [        T ["        5      (       a6  [        T R%                  5       5      n[!        U4S jU 5       5      TU'   TU   $ [        T [&        [(        [*        [        S5      [,        45      (       a
  STU'   TU   $ [/        T 5      (       a9  [1        T S5      (       a(  [!        UU 4S jT R2                   5       5      TU'   TU   $ g)z)Recursively check if the obj has a tensorFTc              3  4   >#    U  H  nT" U5      v   M     g 7fr   rx   .0v
has_tensors     r   	<genexpr>:has_tensor_in_frame.<locals>.has_tensor.<locals>.<genexpr>J  s     ">#Q:a==#   c              3  4   >#    U  H  nT" U5      v   M     g 7fr   rx   r   s     r   r   r   Q  s     "A&Q:a==&r   N_fieldsc              3  H   >#    U  H  nT" [        TU5      5      v   M     g 7fr   )getattr)r   r   r   r   s     r   r   r   W  s     "T1:gc1o#>#>s   ")r   
isinstancer   TensornnModulera   type
issubclassr'   trace_numpyrj   ndarraygenericlisttupleanydictvaluesstrintfloatr   r`   hasattrr   )r   obj_idr	  r   r   s   `  r   r   'has_tensor_in_frame.<locals>.has_tensor6  s   CXF## cELL%((//:;;3*S%((//"B"B#HVF##RZZ((JsBJJ,G,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_coder6   co_names	f_globalsr   r   ry   
startswithr   rj   r'   r  rR   f_localsr	  logdebugco_nameco_filenameco_firstlineno)framer  r   valuer   r   s       @@r   has_tensor_in_framer  !  s    ||33 <<((oo%//'*C#z**''11SE\rf(((cRi8C== ) !#H( (V &&(e ) II	  ## r~   c                    S n[        U S5      (       a&  [        X5      n[        X@R                  5        X@l        [        XS9  g )Nexec_recordexport)r  r]   rh   r  record_filenamer:   )ecoder  r!  r"  s        r   exception_handlerr%  p  s:     Oq-  .q7_mm<+)r~   z/typing.Counter[Union[int, FrameStateSizeEntry]]FRAME_COMPILE_COUNTERc                F    [         R                  (       a  [        U 5      $ U $ r   )r'   cprofilecprofile_wrapper)funcs    r   maybe_cprofiler+    s    %%Kr~   c                J   ^  [         R                  " T 5      SU 4S jj5       nU$ )Nc                 n  >^ [         R                  " 5       nU(       d   S5       e[        STR                   S[	        U5      R                  SS5       S35      n[        R                  " 5       nUR                  5         [        R                  " 5       nUR                  " T/U Q70 UD6n[        R                  " 5       U-
  nUR                  5         [        R                  STR                  UU5        [        R                  " U5      n UR!                  U5        [        R                  SU5        UR'                  S	5      n	 [(        R*                  " S
SSSSS[	        U5      /[(        R,                  S9n
[(        R.                  " SSS[	        U	5      /U
R0                  S9  [        R                  SU	5        [?        [	        U5      5      =m(       a$  [@        RB                  RE                  SU4S j5        U$ ! ["         a    [        R%                  SU5         GNf = f! [2         a    [        R                  S5        UR5                  [        R6                  R8                  5      R;                  S5        UR5                  [        R6                  R<                  5      R;                  S5         Nf = f)NzTrace id is Nonez/tmp/r   /z.profilez7### 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                    > ST S.$ )Ncprofile_manifold_url)nameurlrx   )manifold_links   r   r   ;cprofile_wrapper.<locals>.profile_wrapper.<locals>.<lambda>  s    !8Or~   )#r   current_trace_idr   ry   r
  replacecProfileProfileenabletimeruncalldisabler  warningr0  Stats
dump_statsPermissionError	exceptionwith_suffix
subprocessPopenPIPE
check_callr1  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_processr:  r*  s              @r   profile_wrapper)cprofile_wrapper.<locals>.profile_wrapper  sF   !224+++xDMM?!CM$9$9#s$C#DHM
 !99;d4T4V4))+0EMM		
 \\$	>OOL) 	'6++F3	E * 0 087-% "! !!s8}5'.. KK:HE @
 
= 
 NN++O K  	>MM.=	>, ! 	EKKN MM&..--.::2>MM&..334@@D	Es&   G; A5H" ; HH"BJ43J4r   )r   r   )r*  r_  s   ` r   r)  r)    s'    __T: :x r~   c                  v    \ rS rSr   S	         S
S jjr\SS j5       rSS.           SS jjrSrg)ConvertFrameAsserti  Nc                H    [        5         Xl        X l        X0l        X@l        g r   )rd   r   
_one_graph_export_export_constraints)r   compiler_fn	one_graphr!  export_constraintss        r   r   ConvertFrameAssert.__init__  s      	&'*5'##5 r~   c                   ^  U 4S j$ )Nc                \   > [        U TR                  TR                  TR                  5      $ r   )convert_frame_assertrd  re  rf  backendr   s    r   r   8ConvertFrameAssert._clone_with_backend.<locals>.<lambda>  s%    3OOLL$$	 
r~   rx   r   s   `r   _clone_with_backend&ConvertFrameAssert._clone_with_backend  s    
 	
r~   r   skipc                  [        5         UR                  n[        X5      n[        R	                  U5        U[
        ;   a
  [        5       $ [        R                  R                  S5      (       a7  [        R                  R                  S5      UR                  :w  a
  [        5       $ UR                  S:X  a*  UR                  R                  S5      (       a
  [        5       $ UR                  S:X  a
  [        5       $ UR                  S:X  a_  UR                  R                  [        R                  R                  [         R"                  R$                  5      5      (       a
  [        5       $ UR                  S:X  a  UR                  S:X  a
  [        5       $ UR                  S:X  a4  UR                  S:X  a$  ['        UR(                  5      (       d
  [        5       $ [+        U5      (       a  [-        S	S
SS/[.        R0                  QS9  [3        U5      (       d
  [        5       $ [5        5       qSU;  a  [8        US'   [8        S-  qUS   n[;        U[<        5      (       d   e[>        U   n	[>        U==   S-  ss'   S n
[@        RB                  " 5       =n(       a  URD                  n
[G        U
UU	S9n[I        SSUR                  U[K        U5      UR                  URL                  URN                  URP                  S.5        UR                  R                  [R        5      (       dG  UR                   SUR                   SURL                   3n[T        RV                  RY                  U5        [[        [A        U5      5         []        UR                  UR^                  UR`                  UR(                  URb                  U Rd                  U Rf                  U Rh                  U Rj                  UUUUUUUS-   S9sS S S 5        $ ! , (       d  f       g = f)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hints_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  rt  )6r_   r  r3   input_codesr   output_codesrS   osenvirongetr  r  endswithr  pathdirnamer   optim__file__r   
f_builtinsr/   rD   r)   FUNDAMENTALr  r   r   FRAME_COUNTERr   r  r&  r   current_compile_idr  r   r   r
  r  +num_cache_entries_with_same_id_matched_objsnum_cache_entriesrL   r7   traced_frame_infosr   r   _compiler  r  closurer   rd  re  rf  )r   r  cache_entryhooksr  rt  r$  r  r  r  r  priorr  infos                 r   __call__ConvertFrameAssert.__call__  sd    	||';
<%''JJNN788

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

 &''
 <<:%$*:*:j*H%'' LLJ&  J.))** &''4Z5 '22		 #5))%''  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Ell^1T%5%5$6a8K8K7LMD))006^J78  //(('%AX! 988s   :A5O99
P)re  rf  rd  r   TFN)
rg  rk   rh  r   r!  r   ri  Optional[typing.Never]r   r   )r   z*Callable[[CompilerFn], ConvertFrameAssert]r  ro   r  Optional[CacheEntry]r  rI   r  *dict[str, Union[int, FrameStateSizeEntry]]rt  r  r   rS   	ry   rz   r{   r|   r   propertyrq  r  r}   rx   r~   r   rb  rb    s     5966 6 	6
 36 
6 
 
 CC *C 	C
 @C C 
C Cr~   rb  c                    [        XX#5      $ )z&Fully convert a frame into an FX graph)rb  )rg  rh  r!  ri  s       r   rm  rm  j  s     kfQQr~   )OrderedDict)RemovableHandle)OutputGraphzdict[int, BytecodeHook]_bytecode_hooksc                J    [        [        5      nU [        UR                  '   U$ )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~   rs  c               0  ^ ^^^^^^^^^
^^^^-^.^/^0^1^2^3^4^5^6^7 SSK Jm.JnJm7Jn  Sm1S m2S m6[
        R                  R                  5       m5[              S>U.UUU UU0UUUUUUU2U4U5U6U74S jj5       n[        SS9          S?U-4S jj5       n[                  S?U
UU0U1U2U34S jj5       m-[        5       n[        [        R                  5         [        [!        T5      5         [#        S	S
S
S9   U   [%        5       m3['        5       m4[)        5       =n(       a  [+        U[-        5       5      m0OS m0S n[/        U5      (       a!  U(       a  [1        T
U5      nU(       d  SOUS   nUR3                  SU05        [5        UT5      u  nnU(       a  S@S jn[6        R9                  SU[;        [        U5      U" T 5      U[<        5        [        R>                  (       a  [A        U S35      eT(       a  [A        U S35      e[C        S5      (       a  [E        U S35      e[G        SSU 3SU S3/ S9  [6        RI                  ST RJ                  T RL                  T RN                  TS-   SRQ                  [R        RT                  " ST-   S9RW                  5       5      5        [X        RZ                  " [\        5      m/[
        R^                  Ra                  SU U/U4S j5        [b        Rd                  " 5       nS nS nS nS n[
        Rf                  Rh                  Rj                  Rm                  5         S n  U" T TU	U5      n [o        5         U [
        Rf                  R                  Rp                  (       a>  [s        SS S!9   [6        Ru                  S"5        [v        Rx                  " S#5        S S S 5        T6(       a  0 T6Rz                  l>        S#S$K4J?n!  [        U!5      n"Uc  T2b  [        T2R                  5      n#[        T2R                  R                  5      n$T2R                  5       n%[        T2R                  R                  5      n&[        T2R                  5      n'T2R                   V(s1 s H  n(U(R                  iM     n)n(T2R                   V(s1 s H  n(U(R                  iM     n*n([
        Rf                  Rh                  Rj                  R7                  5         OES n#S n$S n%S n&S n'[%        0 5      n)[%        0 5      n*[%        5       m3[b        Rd                  " 5       U-
  S%-  m10 S&U"_S'T RJ                  _S(T RL                  _S)T RN                  _S*UR                  _S+UR                  _S,U#_S-U$_S.U%_S/U&_S0U'_S1U_S2U_S3U_S4U_S5U)_S6U*_T3T1U S L[        R                  [        R                  [        R                  S
[        T15      S7.En+UR3                  U+5        sS S S 5        sS S S 5        sS S S 5        sS S S 5        $ ! , (       d  f       GNW= fs  sn(f s  sn(f ! [         a  n,[        U,5      R                  n[        U,5      n[        U,T UTS89  [
        R^                  Ra                  S9S: S; S<9  [        R                  " U,T5      u  nn[        U,[        [        [        [        [        [        U[        U[        4
5      (       a  e [        [        U,5      R                   S=[        U,5       35      R                  U,R                  5      S eS n,A,ff = f! [
        Rf                  R                  Rp                  (       aP  [s        SS S!9   [6        Ru                  S"5        [v        Rx                  " S#5        S S S 5        O! , (       d  f       O= fT6(       a  0 T6Rz                  l>        S#S$K4J?n!  [        U!5      n"UGc  T2Gb  [        T2R                  5      n#[        T2R                  R                  5      n$T2R                  5       n%[        T2R                  R                  5      n&[        T2R                  5      n'T2R                   V(s1 s H  n(U(R                  iM     Os  sn(f n)n(T2R                   V(s1 s H  n(U(R                  iM     Os  sn(f n*n([
        Rf                  Rh                  Rj                  R7                  5         OES n#S n$S n%S n&S n'[%        0 5      n)[%        0 5      n*[%        5       m3[b        Rd                  " 5       U-
  S%-  m10 S&U"_S'T RJ                  _S(T RL                  _S)T RN                  _S*UR                  _S+UR                  _S,U#_S-U$_S.U%_S/U&_S0U'_S1U_S2U_S3U_S4U_S5U)_S6U*_T3T1U S L[        R                  [        R                  [        R                  S
[        T15      S7.En+UR3                  U+5        f = f! , (       d  f       O= f S S S 5        O! , (       d  f       O= fS S S 5        O! , (       d  f       O= fS S S 5        g ! , (       d  f       g = f)ANr   )bisectBisectValidationExceptiontranslation_validation_enabledValidationExceptiong        c                  > TR                  5         [        5       n[        U TTTTTTUTTT	T
TTUTS9m [        TR                  R
                  5         TR                  5          TR                  5         S S S 5        S S S 5        TR                  R!                  5         TR                  mTc   eTR"                  (       d   eTR"                  U S S & UR%                  TR&                  5        [)        U 5        [+        U 5        [-        [/        U 5      5      U S S & g ! , (       d  f       N= f! , (       d  f       N= f! [        R                   a    TR                  5         e [        R                  [        R                  [        R                  4 a    e [         a*    T" 5       (       a  T" TR                  R                  5        e f = f! TR                  R!                  5         f = f)N)r  speculation_logexn_vt_stackdistributed_state)restartrN   rO   r   outputtracing_contextset_current_txrunr(   UnspecializeRestartAnalysisr   SpeculationRestartAnalysisTensorifyScalarRestartAnalysis	SkipFrame	Exception	shape_envcall_cleanup_hooksoutput_instructionsupdatecode_optionsr0   r-   r,   r+   )instructionsr  r  r  builtinsr  r$  rg  r  r!  ri  r  r   localsrh  r  r  tf_mode_stacktracerr  s      r   	transform_compile.<locals>.transform  s    	!%'&#+%/!
&	/6679N9N9P

 :Q7  MM,,.!!!)))) 44QF//0(6(601A,1OPQ3 :Q9P77.. 	!!#**..MM
 	
  	-//v}}../	
 MM,,.sT   D> D-%D6D->D> 
D*	&D--
D;7D> :G ;D> >BG		G G(compile_inner)
phase_namec           	       > [         R                  " 5        nUR                  [        SSSS95        UR                  [	        S5      R                  5       5        UR                  [        R                  R                  R                  5       5        UR                  [        R                  " 5       5        T" XX#5      sS S S 5        $ ! , (       d  f       O= f[        5       $ )Nz_compile.compile_innerentire_frame_compile!dynamo_cumulative_compile_time_us)r  dynamo_compile_column_usz#pytorch.wait_counter.dynamo_compile)r   r   r   r[   r    guardr   _dynamocallback_handlerinstall_callbacksrY   recordrS   )r$  rh  r  r  stack_compile_inners        r   r  _compile.<locals>.compile_inner  s     !!#u,5-P BCIIK  > > P P RS = D D FG!$5D $##   	
s   B&C
Cc           	     l	  > [         R                   " 5       =pE            SS jnU" SU R                  U R                  U R                  U 5        S n[        R
                  " 5        H)  nU[        R                  " 5       l         [        X5      n  O   Tb  TR:                  c   S5       eUc   eU" SU R                  U R                  U R                  U5        [<        R?                  5        H  n
U
" X5      nUc  M  UnM     U [@        U'   [B        R+                  U5        XE-
  mTc   eSS jnUc   eU" U 5      nU" U5      nSnUSU RD                  S U  S3-  nUSURD                  S U  3-  nU RD                  S U URD                  S U :X  d   U5       eSnUSU RF                   S3-  nUSURF                   3-  nU RF                  URF                  :X  d   U5       eSnUSU RH                   S3-  nUSURH                   3-  nU RH                  URH                  :X  d   U5       eTRJ                  (       a  TRM                  5       (       a
  [9        5       $ TRN                  c   eTRP                  [R        RT                  U'   [W        U TTU(       a  URX                  OS 5      nTb  [/        T5      OSnSU-   n[[        UUR\                  TU5      nTRM                  5       (       d(  UR^                  b  UR_                  TRN                  5        [a        U5      $ ! [        R                   a  n	[        U	[        R                  5      (       d  [        R                  " 5         [         R#                  S[%        [&        U	R(                  5      5        TR+                  U	R,                  =(       d    [/        [1        U	5      5      5        [         R                   " 5       nUS:  a  [3        SSS/ S9   S n	A	GM   S n	A	GM  S n	A	f[        R4                   a  n	[        U	[        R                  5      (       d  [        R                  " 5         [         R7                  S	U	U R                  U R                  U R                  5        U(       a  [         R7                  S
5        [9        5       s S n	A	s  $ S n	A	ff = f)Nc           	         [         R                  [        R                  5      (       a!  [         R	                  [        XX#U5      5        g g r   )bytecode_logisEnabledForloggingDEBUGr  r\   )prefixr8  filenameline_nor$  s        r   log_bytecode6_compile.<locals>._compile_inner.<locals>.log_bytecode	  s8     ((77""#F(TJ 8r~   zORIGINAL BYTECODEzRestarting analysis due to %sd   z!Excessive RestartAnalysis() callsry  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.rz  z.Skipping frame %s %s                     %s %sz%No graph captured with one_graph=Truez;compiler collective wasn't run before compilation completedzMODIFIED BYTECODEc                    SS K nU R                  U R                  -   [        U R                  UR
                  -  5      -   [        U R                  UR                  -  5      -   $ )Nr   )inspectco_argcountco_kwonlyargcountr   co_flags
CO_VARARGSCO_VARKEYWORDS)r$  r  s     r   
count_args4_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 UnknownzTorch-Compiled Region: )r  r
  r8  r
  r  r
  r  r  r$  r   r   r   r$  r   r   r  )1rA  r  r  r  	itertoolscountr   r  attemptr1   r(   RestartAnalysisr   r  r   r   r  r  rb   r%   __traceback__r   restart_reasonr
  r   rD   r  r  rS   
all_statesr  r	  rc   r  co_varnamesco_freevarsco_cellvarsr!  is_empty_graphr   cleanupsrX   instancerF   guard_fail_fnrH   guard_managerguard_export_fnrV   )r$  rh  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  restart_reasonss                       r   r   _compile.<locals>._compile_inner  s    04yy{:		"	.1	<?	GO		 	LL	
  (G+2N ($,0A	 )P !(,=,H,H,T 	
I	
T ###LL	
 $**,Dt.K&& -
 #'h"%<%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4%''}}(((,2OO)'#(Ed	
 -7,BZ	2^C"""	
 $$&&5+@+@+L !!&--0 ..G && !!S%G%GHH"((*35qG
  ##A$4$4$DDGE*.))+'S=$ C "%6 !  ! == ,!!S%G%GHH"((*		LL$$'' IIEF)++,s,   LR32B?O??R3BR.&R3.R3r  T)reset_event_log_on_exitlog_pt2_compile_eventz$Unable to find recompilation reasonsrecompile_reasonc                V    SU R                    SU R                   SU R                   S3$ )N'z' (r  ))r  r  r  )r$  s    r   format_func_info"_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.rz  zBtorchdynamo start compiling %s %s:%s, stack (elided %s frames):
%s   ry  rs  dynamo_startc                 2  > S[        [        R                  " U4S j[        R                  " [
        R                  " ST-   S9R                  5       5      5      5      T R                  T R                  [        R                  " T R                  5      S./-   0$ )Nr  c                   > U S   T:g  $ )Nr  rx   )fconvert_frame_interns    r   r   ,_compile.<locals>.<lambda>.<locals>.<lambda>  s    !J-3G"Gr~      rs  )liner8  r  )r  r  	takewhiler   from_tracebackr$   extractsummaryr  r  intern_stringr  )r$  r"  rt  s   r   r   _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                     SSS.$ )Ndynamo_errorstringr8  encodingrx   rx   r~   r   r   r+  ;  s    * (%r~   c                 ,    [         R                  " 5       $ r   	traceback
format_excrx   r~   r   r   r+  ?  s    9#7#7#9r~   metadata_fn
payload_fnz: )r  zlist[Instruction]r  dict[str, object]r   r   )
r$  r   rh  r   r  rI   r  z2Callable[[list[Instruction], dict[str, Any]], Any]r   rS   )r$  r   r   r
  )btorch.fx.experimental.validatorr  r  r  r  r   	overrides _get_current_function_mode_stackr   r   r+  r^   r   r'   use_lazy_graph_moduler   r   rW   r   rQ   r   rM   rP   r5   rG   update_outerr4   r  rD  r   rg   fail_on_recompile_limit_hitr<   r   r?   rD   r  r  r  r  joinr$   r(  formatr   r*  r  rT  rU  rA  time_nsr  utilsReinplaceCountersr   rJ   run_gc_after_compiler[   r  r,  collectr  local_scoper.  r
  lenr   r  count_callsgraphnodesplaceholdersr9  r{   r:  r  r  suppress_errorsinline_inbuilt_nn_modulesr?  rf   r  r   r%  r(   get_exc_messager   rE   rB   r;   AssertionErrorr   r   rC   r@   r>   with_tracebackr  )8r$  r   r  r  r  rg  rh  r!  ri  r  r  r  r  r  r  rt  r  r  r  r  metrics_context
compile_pgr  reasonsexceeded
limit_typer  start_time_nsr5  r6  r7  r8  r  r.  r/  r0  r1  r2  r3  r4  opr9  r:  metricsr#  r  r  r"  r  r  r  r  r  r  r  r  s8   ````````` `  ```                             @@@@@@@@@@@r   r  r    si
   &  ),$(F.2F 	88:  4Q'4Q7H4Q	4Q 4Q 4Q 4Ql #o>


 
 F	

 

 ?
2 b/b/b/ b/ F	b/
 
b/ b/ b/H *+Ov;;<z23d$	
 	$'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	2(y%KL ^ }}##88!$NHH?@JJqM O ,.))JI"v'9!&--0(+F,<,<,C,C(D%!'!3!3!5#&v||'9'9#: $'(;(;$<!?E?W?W$X?WR__?W!$X.4.I.I(.IBOO.I % ( ##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 		
 	
 	43 	=<t ON  %Y(A  '	< Q,,Ia&KauV<NN++ : ,  @C?R?R:@<$&< %)",/'0-$   /Aw++,Bs1vh7 .1t<K'	<\ }}##88!$NHH?@JJqM ONN ,.))JI"v'9!&--0(+F,<,<,C,C(D%!'!3!3!5#&v||'9'9#: $'(;(;$<!?E?W?W$X?WR__?W$X!$X.4.I.I(.IBOO.I($ ( ##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 		
 	
 	
 	433 	=<<s   h&g-2g5H7f8	-X3f8	6,W2"B=f8	X5f8	X	D2f8		g	g-	h2
X<f8	
\C)\\\		4f5=,]2)	f52
^ <B>f5:af5&a=<D9f55f8	8
gg
	g-
g!g-$	h-
g;	7h
hc                  d    \ rS rSr      SS jr\SS j5       r S	           S
S jjrSrg)ConvertFramei  c                :    Xl         [        USS9U l        X l        g )NF)rh  )r   rm  _inner_convert_hooks)r   rg  r  s      r   r   ConvertFrame.__init__  s    
 +6'2;%Pr~   c                   ^  U 4S j$ )Nc                0   > [        U TR                  5      $ r   )convert_framert  rn  s    r   r   2ConvertFrame._clone_with_backend.<locals>.<lambda>  s    }WdkkBr~   rx   r   s   `r   rq   ConvertFrame._clone_with_backend  s	    BBr~   c                  ^ [         S   S==   S-  ss'    U R                  XX4US-   S9n[         S   S==   S-  ss'   U$ ! [         Ga5  n[        U[        5      (       a  e [        U[
        5      nU(       a  [        R                  [        R                  5      (       a  [        US5      (       a  [        US5      (       a  [        [        UR                  5      5         UR                  n	SR                  [         R"                  " U	5      5      n
S	U
 3m[$        R&                  R)                  S
S U4S jS9  [        R+                  TSS9  S S S 5        O! , (       d  f       O= f[,        R.                  (       d  U(       d  e [1        USS 5      nUR2                  n[5        X|X5      nU(       a  [6        R9                  USS9  O[6        R;                  USS9  [        U[<        5      (       a4  [?        [A        [B        RD                  [B        RD                  5      S9s S nA$ [        U[F        5      (       a4  [?        [A        [B        RH                  [B        RH                  5      S9s S nA$  S nA[?        5       $ S nAff = f)Nframestotalr&   rs  okr  
real_stackry  z&Graph break: skip: from user code at:
rB  c                     SSS.$ )Ndynamo_graph_break_reasonrE  rF  rx   rx   r~   r   r   'ConvertFrame.__call__.<locals>.<lambda>  s    (C,41r~   c                 8   > T  S[         R                  " 5        3$ )N
rI  )user_stack_traces   r   r   r    s    2B1C2iFZFZF\E]/^r~   rL  T)exc_infor"  )frame_exec_strategy)%rZ   rs  r  r   rC   rE   graph_break_logr  r  r  r  r   r   r  r  rV  rJ  format_listr   rT  rU  r  r'   rc  r   r  r=   r  r  rD  rA   rS   rU   rT   SKIPr?   RUN_ONLY)r   r  r  r  r  rt  r   r#  	soft_fail
user_stackuser_stack_formattedr"  r$  	error_msgr  s                 @r   r  ConvertFrame.__call__  s+    	7#q(#Q	((ETAX ) F Xt$)$M K	 !9::"1k2I _99'--HH 1l++<0H0H()EF%&\\
/1ww%11*=0, .UUiTj+k(77&) (_ 8  (--,%) .  GFF& ))) &a):DAO<<D(/IIT2I5!788)(9#((+*:*:) 
 A566)(9#,,k.B.B)  7 "##[K	sE   )A JBI<!A/E	I<
E'	#B<I<J%AI<(J<J)rt  rs  r   N)rg  rk   r  rI   r   r   )r   z*Callable[[WrapBackendDebug], ConvertFrame])r   r  r  rx   r~   r   rq  rq    s      
	 C C \$\$ *\$ 	\$
 @\$ \$ 
\$ \$r~   rq  c                    [        X5      $ )zHTry to convert a frame into an FX graph, if error leave frame unmodified)rq  )rg  r  s     r   rx  rx    s    ++r~   c                b   SSK Jn  [        R                  nS[        l        [	        U S5       n[
        R                  " U5      nS S S 5        [        [        R                  " WR                  R                  5       [        5       R                  5       5      5      Ul
         [        UR                  UR                  UR                  UR                  UR                   USSS [#        5       [%        SS5      S S 0 ['        SSS9S	9  U[        l        g ! , (       d  f       N= f! U[        l        f = f)
Nr&   )eagerFrbr   *   i  )r  r  )
rg  rh  r!  ri  r  r  r  r  r  r  )backends.debuggingr  r'   replay_record_enabledopenrK   loadr  r  chainr   itemsr  r$  r  r  r  rI   r2   r   )r  r  original_replay_valin_filer  s        r   replayr    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                    [         R                  S:  a  g[        R                  " U 5       H$  nUR                  S:X  d  M  UR
                  S-  s  $    [        S5      e)N)      r   RESUMEr  z$RESUME instruction not found in code)sysversion_infodisget_instructionsopnameoffsetRuntimeError)r$  insts     r   first_real_inst_idxr  7  sQ    
'!$$T*;;(";;!## + =
>>r~   c                  <    \ rS rSrSS.           SS jjrSrg)ConvertFrameProtocoli@  r   rs  c                   g r   rx   )r   r  r  r  r  rt  s         r   r  ConvertFrameProtocol.__call__A  s     !r~   rx   Nr  )ry   rz   r{   r|   r  r}   rx   r~   r   r  r  @  sL     !! *! 	!
 @! ! 
! !r~   r  c                  8    \ rS rSrSS jr        SS jrSrg)CatchErrorsWrapperiL  c                T    [         R                  " U5      " U 5        Xl        X l        g r   )r   r   r   r  )r   callbackr  s      r   r   CatchErrorsWrapper.__init__M  s    !$'*2'
r~   c           
     6   Uc   e[         R                  " UR                  5      n[        R                  S:  a#  UR
                  [        UR                  5      :  nO"UR
                  [        UR                  5      :  nU(       dF  U(       d?  [        R                  (       d*  [        SS9(       a  [        U R                  SS5      (       d  [        R                  [        R                  5      (       a  U(       a  SnO;[         R                  " UR                  5      (       a  SnO[        SS9(       a  SnOSn[        R!                  S	UR                  R"                  UUR                  R$                  5        ['        5       $ UR                  R$                  S
:X  a$  UR                  R"                  S:X  a
  ['        5       $ [(        R*                  R,                  R/                  5       S:X  a  [0        R2                  " 5       nU(       a  [4           SSKJn  U" UR:                  U R                  R                  S9n	[=        U R                  S5      (       d   S5       eU R                  R?                  U	R@                  5      n
U
" XU RB                  U5      sS S S 5        $ [4           [E        5          U R                  XU RB                  USS9sS S S 5        sS S S 5        $ ! , (       d  f       NN= f! , (       d  f       O= fS S S 5        g ! , (       d  f       g = f)N)r     F)include_infra_modesre  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)rx  __new__ddp_optimizerr   )DDPOptimizer)bucket_bytes_capbackend_compile_fnrq  zJDDPOptimizer only supports callback fns that know how to clone themselves.r&   rs  )#r*   r   r  r  r  f_lastir  r'   rC  r#   r   r   r  r  r  r  r  r  r  rS   r   r  rY  get_optimize_ddp_moder!   _get_active_ddp_modulecompile_lock"torch._dynamo.backends.distributedr  r  r  rq  
compile_fnr  r"   )r   r  r  r  is_skipfilehas_started_executionskip_reason
ddp_moduler  r  hijacked_callbacks              r   r  CatchErrorsWrapper.__call__R  sQ    &&&!''5w&$)MM4G4U$U!$)MM5H5V$V! "~~)eD ? ?ERR ..("8K &&u||4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  43\\+ "\* 43\\\s1   BK%L
0K0	L

K-0
K>	:L


L)r   r  N)r  r  r  rI   r   r   )r  ro   r  r  r  r  r   rS   )ry   rz   r{   r|   r   r  r}   rx   r~   r   r  r  L  s8    
HH *H @	H
 
Hr~   r  c                    [        X5      $ 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  ro   r   r   )NF)
r#  r  r$  r   r  Optional[DynamoFrameType]r!  r   r   r   )r*  r  r   r  r  )
rg  rk   rh  r   r!  r   ri  r  r   rb  )r  rm   r   r  )NN)"r$  r   r   rO  r  rO  r  rO  r  ztuple[CellType]rg  rk   rh  r   r!  r   ri  r  r  rI   r  r  r  r2   r  r  r  z4Optional[dict[str, Union[int, FrameStateSizeEntry]]]r  r   rt  r  r   rS   )rg  rk   r  rI   r   rq  )r  r
  r   r   r  )r  r  r  rI   r   r  )__doc__
__future__r   collectionsr   r>  r  r   r,  r  r  r  r0  r   rJ  r  	threadingrA  rJ  typingr   pathlibr   typesr   r   r   r   r	   r
   r   r   r   typing_extensionsr   r   r   torch._loggingtorch._C._dynamo.guardsr   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%   ry  r'   r(   r)   r*   bytecode_analysisr+   r,   bytecode_transformationr-   r.   r/   r0   r1   r  r2   r3   r4   r5   
eval_framer6   r7   r8   r9   r:   r;   r<   r=   r>   r?   r@   rA   rB   rC   rD   rE   r   rF   rG   rH   r  rI   pgorJ   replay_recordrK   resume_executionrL   symbolic_convertrM   rN   rO   rP   rQ   rR   rS   rT   rU   rV   rY  rW   rX   rY   rZ   r[   r\   r]   r^   r_   r`   ra   rb   rc   rd   re   rf   rg   rh   variables.torch_functionri   __annotations__numpyrj   ModuleNotFoundErrorTYPE_CHECKINGbackends.registryrk   repro.after_dynamorl   rm   rn   ro   variables.builderrp   	getLoggerry   r  rT  getArtifactLoggerr  r  RLockr  rs   rt   rv   r   r  r  r   r   r   r   #suppress_torch_distributed_warningsr  r%  r  Counterr&  r+  r)  rb  rm  r  torch.utils.hooksr  output_graphr  r  r  r  rq  rx  r  r  Protocolr  r  r  rx   r~   r   <module>r     sg  & #    
  	   	    
       > > : : ' !   4 4 9 M M %  ? Q & A M 9 9 G       
   * ;  " X X    ( J  
 
-4@@6 !~~//*E..228^L  T]t_	 	 ( iy37 0 7 *+MQ	%2J ,EP 11K 2Kb (,	**
* %* 	*
 
*  F 
>B[ [@ 15	RRR R /	R
 R $ - 
) ,7=( 8. (,HLW2" #W2
W2W2 W2  	W2
 W2 W2 W2 W2 /W2 W2 &W2 *W2 %W2 FW2  !W2" #W2$ %W2vj$ j$Z,;>?	!6?? 	!N Nb/"/+0//G(  	Bs   2N7 7OO