
    9inC                   2	   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ZddlZddlZddlZddlm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# 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/m0Z0 ddl1m2Z2m3Z3m4Z4m5Z5 ddl(m6Z6 ddl7m8Z8m9Z9m:Z:m;Z; ddl<m=Z= ddl>m?Z?m@Z@ ddlAmBZC ddlDmEZE ddlFmGZG ddlHmIZImJZJmKZK ddlLmMZMmNZN ddlOmPZPmQZQmRZRmSZSmTZT ddlUmVZVmWZW ddlXmYZYmZZZm[Z[m\Z\m]Z] ddl^m_Z_m`Z`maZambZb ddlcmdZdmeZemfZfmgZgmhZhmiZi ddlRmjZjmkZkmlZlmmZmmnZnmoZompZpmqZqmrZrmsZsmtZtmuZumvZvmwZw ddlxmyZy dd lzm{Z{m|Z|m}Z} dd!l~mZ dd"lmZmZ dd#lmZmZmZ dd$lmZ dd%lmZ dd&lmZmZmZmZmZ dd'lTmZ dd(lmZmZmZmZ dd)lmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZ dd*lmZ d+ed,<   	 ddlZn# e$ r dZY nw xY wej        r.dd-lmZ dd.lmZ dd/lmZ dd0lmZ dd1lmZ dd2lmZmZmZ dd3lmZ  ej        eĦ          Ze'j                            ed4          Ze'j                            ed5          Z ej                    Z e"d6          Z e%d7          Z G d8 d9          Z G d: d;          Z eϦ            Z eϦ            Zdad<ed=<    ej        eC          	 dddF            ZdddLZddOZeij        ddS            Z	 	 dddZZda ej                    Zd[ed\<   dd^Zdd_Ze G d` da                      ZddeZ G df dg          Z	 	 	 	 dddpZddqlmZ ddrlmZ  e            Zdsedt<   ddxZedTdddddydd            Ze G d d                      Ze G d d                      Z edh           G d d                      Ze G d d                      Ze G d d                      ZddZddZ	 dddZ	 dddTdddZe G d d                      ZddTdddZdTdddddyddZ	 	 dddddddZ G d d          Z	 dddZddZddZ G d dej                  ZddZ G d dæ          ZddńZdS )a  
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.

NOTE: _torchdynamo_orig_backend is used for convert frame wrappers to identify the inner wrapped function.
By going down the _torchdynamo_orig_backend chain, one can recover the original unwrapped backend,
which is checked for during the Dynamo cache lookup.
    )annotationsN)	dataclass)Path)CellTypeCodeTypeFunctionType
ModuleType)Any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_any_mode_without_ignore_compile_internals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
Constraint
dynamo_tlsinnermost_fn	skip_codeTorchPatcher)augment_exc_messageBackendCompilerFailedFailOnRecompileLimitHitformat_error_msgInternalTorchDynamoErrorPackageErrorRecompileLimitExceededResumePrologueTracingErrorShortenTracebackSkipCodeRecursiveExceptionTorchRuntimeErrorUncapturedHigherOrderOpErrorunimplementedUnsupported)reset_user_object_tracking)CheckFunctionManager'get_and_maybe_log_recompilation_reasonsGuardedCode)Hooks)DynamoTracerOutputOutputGraphCommon)_log_size_mismatch_recompile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)_get_error_on_graph_breakchromium_event_timedCleanupManagerCompileTimeInstructionCountercountersdynamo_timedformat_bytecodegen_record_file_name#get_hook_for_recompile_user_context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)Callable)WeakIdKeyDictionary)
CompilerFn)CompilePackage)WrapBackendDebug)BytecodeHook
CacheEntryDynamoFrameType)FrameStateSizeEntrybytecodegraph_breaks_T_Pc                      e Zd ZdS )TODO_UNKNOWNN)__name__
__module____qualname__     N/var/www/icac/venv/lib/python3.11/site-packages/torch/_dynamo/convert_frame.pyr   r      s        Dr   r   c                  .    e Zd ZddZddZdd	Zdd
ZdS )TrackerreturnNonec                :    g | _         t                      | _        d S N)seensetseen_idsselfs    r   __init__zTracker.__init__   s    35	"%%%r   
strong_objr   c                     t          |           j        vrOt          j        | fd          } j                            |            j                                       d S d S )Nc                8    j                                       S r   )r   remove)_idxr   s    r   <lambda>zTracker.add.<locals>.<lambda>   s    DM4H4H4M4M r   )idr   weakrefrefr   appendadd)r   r   objr   s   `  @r   r   zTracker.add   st    nndm##+j*M*M*M*M*MNNCIS!!!Mc""""" $#r   itemboolc                .    t          |          | j        v S r   )r   r   )r   r   s     r   __contains__zTracker.__contains__   s    $xx4=((r   c                j    | j                                          | j                                         d S r   )r   clearr   r   s    r   r   zTracker.clear   s.    	r   Nr   r   )r   r   r   r   )r   r   r   r   )r   r   r   r   r   r   r   r   r   r   r   r      sd        ( ( ( (# # # #) ) ) )     r   r   zOptional[GlobalStateGuard]initial_global_statesrcstrglobalsdict[str, Any]	co_fieldsOptional[dict[str, str]]r   r   c                P    t          | ||          }t          |j                   |S r   )original_forward_from_srcr=   __code__)r   r   r   results       r   fx_forward_from_src_skip_resultr      s*     'sGY??FfoMr   coder   skipint	list[str]c                   t          j        t                    t          j        d|z                                             }t          j        |          }t          t          j	        fd|                    | j
        | j        t          j        | j                  dgz   t          j                            dfd           fd|D             d| j
         d	| j         d
| j         gz   }|S )N   r   c                    | d         k    S )Nfilenamer   )fconvert_frame_interns    r   r   z"log_dynamo_start.<locals>.<lambda>   s    a
m';; r   )linenamer   dynamo_startc                     d iS )Nstackr   )r   s   r   r   z"log_dynamo_start.<locals>.<lambda>	  s    %  r   c                Z    g | ]'}|j         k    d |j         d|j         d|j          (S )Line: , Name: , Filename: )r   linenor   ).0framer   s     r   
<listcomp>z$log_dynamo_start.<locals>.<listcomp>  sP       >111 	POOuzOOu~OO111r   r   r   r   )r   intern_string__file__r&   extractsummaryfrom_tracebacklist	itertools	takewhileco_firstlinenoco_nameco_filenametorch_loggingtrace_structured)r   r   captured_tbframes_internedstack_stringsr   r   s        @@r   log_dynamo_startr      s3   %3H==#+T:::BBDDK /<<O;;;;	
 	
  'L"01ABB	
 	
	E 
N##            
 	[$ZZdlZZHXZZ		M r   fnCallable[_P, _T]c                V     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
    args_P.argskwargs	_P.kwargsr   r   c                 :   t                      }t          j                    }t          j                                        5  t                      5  t                      5  t          j                    }t          j                    }t          j	                    }t          j        
                                }t          j                    }t          j                    }	t          j                                        }
d }t          j                                        rTt          j                                        5  t          j                                        }d d d            n# 1 swxY w Y   t          j                            dd          }t          j        j        j        }t,          t          j        j        _        t/                      }t1          j                    }|                    t          j        j                                                   |                    t:                     t=                       	  | i ||                                 t          j                                         dk    s
J d            |                                 t          j        !                    |           t          j"        j#        $                    |           t          j%        ||           t          j&        |           t          j        '                    |
           t          j(        |	           t          j        
                                }||k    rt          j        )                                 |Ut          j                                        5  t          j        '                    |           d d d            n# 1 swxY w Y   t          j        *                    dd|           |t          j        j        _        |+                                s J d|,                                 d            cd d d            cd d d            cd d d            S # |                                 t          j                                         dk    s
J d            |                                 t          j        !                    |           t          j"        j#        $                    |           t          j%        ||           t          j&        |           t          j        '                    |
           t          j(        |	           t          j        
                                }||k    rt          j        )                                 |Ut          j                                        5  t          j        '                    |           d d d            n# 1 swxY w Y   t          j        *                    dd|           |t          j        j        _        |+                                s J d|,                                 d            w xY w# 1 swxY w Y   d d d            n# 1 swxY w Y   d d d            d S # 1 swxY w Y   d S )Ncudamatmulr   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   r   is_grad_enabled_C_PreserveDispatchKeyGuardrq   rr   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_stater   is_availableDisableTorchFunction_get_fp32_precision_getterfxgraph_moduler    r   ru   
contextlib	ExitStackenter_context_symbolic_trace_maybe_revert_all_patchesry   rM   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_fp32_precision_settercheckreason)r   r   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cuda_matmul_fp32_precprior_fwd_from_srccleanup
exit_stackcurr_mobile_allocator_stater   s                    r   _fnz"preserve_global_state.<locals>._fn   s   !##/11 H..00<	 <	(**<	 <	 788<	 <	
 $)#B#D#D "'"L"N"N#QSSO==?? ) "?,,L133K#l88::O!Nz&&(( @X2244 @ @%*Z%=%=%?%?N@ @ @ @ @ @ @ @ @ @ @ @ @ @ @$)H$G$G% %! "'!6!H6UEH!3)++G#-//J$$(BBDD   $$%HIII&(((r4*6**x99;;q@@@g A@@   """**?;;;(>>?STTT2'?    ---**?;;;'444HAACC , 03NNNH@@BBB!-6688 A A
00@@@A A A A A A A A A A A A A A A33H&;   ;M%7||~~  ffmmoofff  u<	 <	 <	 <	 <	 <	 <	 <	 <	 <	 <	 <	 <	 <	 <	 <	 <	 <	 <	 <	 <	 <	B x99;;q@@@g A@@   """**?;;;(>>?STTT2'?    ---**?;;;'444HAACC , 03NNNH@@BBB!-6688 A A
00@@@A A A A A A A A A A A A A A A33H&;   ;M%7||~~  ffmmoofff      u<	 <	 <	 <	 <	 <	 <	 <	 <	 <	 <	 <	 <	 <	 <	 <	 <	 <	 <	 <	 <	 <	 <	 <	 <	 <	 <	 <	 <	 <	 <	 <	 <	 <	 <	 <	 <	 <	 <	 <	 <	s   ZY8CY!9E$	Y!$E((Y!+E(,CY! Q$EY! O	=Y!	OY!OA.Y!?Y8Z$EY	; W'Y	'W++Y	.W+/A/Y	Y!!Y%%Y8(Y%)Y8,Z8Y<	<Z?Y<	 ZZZr   r   r   r   r   r   )	functoolswraps_torchdynamo_orig_backend)r   r#  s   ` r   preserve_global_stater(    sN     _RD D D D D DL %'C!Jr   r   r   r   c                "   | j         t          v rdS | j         j        D ]}|| j        v rv| j        |         }t	          |t
                    r&|j                            d          s	|t          u r dS t          r't          j        r|t          u st          |          r dS i d
fd| j                                        D ]} |          r dS t                              d| j         j        | j         j        | j         j                   d	S )z+Check if the frame has torch.* related bitsTztorch.r   objectr   r   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
        rHt          rAt           t          j                  st           t          j                  rd|<   |         S t           t          t          f          r&t!          fd D                       |<   |         S t           t"                    rGt                                                     }t!          fd|D                       |<   |         S t           t&          t(          t*          t          d          t,          f          rd|<   |         S t/                     r<t1           d          r,t!           fd j        D                       |<   |         S dS )z)Recursively check if the obj has a tensorFTc              3  .   K   | ]} |          V  d S r   r   r   v
has_tensors     r   	<genexpr>z:has_tensor_in_frame.<locals>.has_tensor.<locals>.<genexpr>  s+      ">">Q::a==">">">">">">r   c              3  .   K   | ]} |          V  d S r   r   r-  s     r   r0  z:has_tensor_in_frame.<locals>.has_tensor.<locals>.<genexpr>  s+      "A"AQ::a=="A"A"A"A"A"Ar   N_fieldsc              3  J   K   | ]} t          |                    V  d S r   )getattr)r   r.  r/  r   s     r   r0  z:has_tensor_in_frame.<locals>.has_tensor.<locals>.<genexpr>  s5      "T"T1::gc1oo#>#>"T"T"T"T"T"Tr   )r   
isinstancer   TensornnModulero   type
issubclassr)   trace_numpyrz   ndarraygenericr   tupleanydictvaluesr   r   floatr   rn   hasattrr2  )r   obj_idrA  r/  r   s   `  r   r/  z'has_tensor_in_frame.<locals>.has_tensor  s   CXF## cEL%(/:;; !	3!	",S%(/"B"B!	  $HVF##		 RZ((	 -7sBJ,G,G	
  $HVF##C$'' 	"">">">">#">">">>>HVF##C 	 #**,,''F""A"A"A"A&"A"A"AAAHVF##C#sE4::t<== 	$HVF##3 	GC$;$; 	""T"T"T"T"T"T"T"TTTHVF## 5r   z0skipping because no torch.* %s             %s %sF)r   r*  r   r   )f_coder9   co_names	f_globalsr5  r	   r   
startswithr   rz   r)   r;  r^   f_localsrA  logdebugr   r   r   )r   r   r   valuer/  r   s       @@r   has_tensor_in_framerM  k  sP    |333t <( 	 	eo%%/'*C#z** ''1158E\\tt f( cRii8C==itt "H( ( ( ( ( ( (V &&((  :e 	44	 II	 #   5r   Fe	ExceptionOptional[DynamoFrameType]exportr   c                    d }t          | d          r,t          | |          }t          || j                   || _        t          | |           d S )Nexec_recordrQ  )rC  rj   rx   rS  record_filenamer?   )rN  r   r   rQ  rU  s        r   exception_handlerrV    s]     Oq-   ,.q$77_am<<<+&))))))r   z/typing.Counter[Union[int, FrameStateSizeEntry]]FRAME_COMPILE_COUNTERfuncc                <    t           j        rt          |           S | S r   )r)   cprofilecprofile_wrapper)rX  s    r   maybe_cprofiler\    s     &%%%Kr   c                H     t          j                   d fd            }|S )	Nr   r   r   r   r   r   c                    t          j                    }|s
J d            t          dj         dt	          |                              dd           d          }t          j                    }	 t          j                    } |j	        g| R i |}t          j                    |z
  }n4# t          $ r' t                              d           d} | i |}Y nw xY wt                              dj        ||           t          j        |          }	 |                    |           n+# t"          $ r t                              d	|           Y nw xY wt                              d
|           |                    d          }		 t'          j        ddddddt	          |          gt&          j                  5 }
t'          j        dddt	          |	          g|
j                   t                              d|	           d d d            n# 1 swxY w Y   n# t0          $ r t                              d           |                    t          j        j                                      d           |                    t          j        j                                      d           Y nw xY wt=          t	          |                    xr#t>          j         !                    dfd           |S )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)r   urlr   )manifold_links   r   r   z;cprofile_wrapper.<locals>.profile_wrapper.<locals>.<lambda>  s    !8OO r   )"r   current_trace_idr   r   r   replacecProfileProfiletimeruncall
ValueErrorrJ  	exceptionwarningra  Stats
dump_statsOSErrorwith_suffix
subprocessPopenPIPE
check_callrb  FileNotFoundError
sort_statsSortKeyTIMEprint_stats
CUMULATIVEr   r   r   r   )r   r   trace_idprofile_pathprofstart_tsretvalprofile_latencypssvg_pathgprof2dot_processrj  rX  s              @r   profile_wrapperz)cprofile_wrapper.<locals>.profile_wrapper  s   !244++++++MDMMMCMM$9$9#s$C$CMMM
 
 !!	+y{{H
 "T\$888888F"ikkH4OO 	+ 	+ 	+MM5666OT4*6**FFF	+ 	EM		
 	
 	
 \$	>OOL)))) 	> 	> 	>MM.=====	>'666++F33	E!87-%% "   J #%GT3x==9+2    >III!J J J J J J J J J J J J J J J" ! 	E 	E 	EKKN   MM&.-..::2>>>MM&.344@@DDDDD	E @
 
 
= 	 N++OOOO   s\   2:B- -.CCD. .%EE
4H >AHH HH HH BJ32J3r$  )r%  r&  )rX  r  s   ` r   r[  r[    sE    _TA A A A A AF r   c                      e Zd ZU dZded<   dS )ConvertFrameBoxNzOptional[bool]error_on_graph_break)r   r   r   r  __annotations__r   r   r   r  r    s$         +///////r   r  frame_state*dict[str, Union[int, FrameStateSizeEntry]]r   c                   d| vrt           | d<   t           dz  a | d         }t          |t                    sJ t          |         }t          |xx         dz  cc<   d }t	          j                    x}r|j        }t          |||          S )N_idr(   )compiled_autograd_idframe_idframe_compile_id)FRAME_COUNTERr5  r   rW  r   current_compile_idr  r   )r  r  r  r  priors        r   get_compile_idr  "  s     K*E5!Hh$$$$$,X6(###q(###1333u :$91)   r   c                  F    e Zd Z	 	 	 	 d d!dZed"d            Zddd#dZdS )$ConvertFrameAssertTFNcompiler_fnr}   	one_graphr   rQ  export_constraintsOptional[typing.Never]packageOptional[CompilePackage]r   r   c                    t                       || _        || _        || _        || _        || _        t                      | _        d S r   )rt   r'  
_one_graph_export_export_constraints_packager  _box)r   r  r  rQ  r  r  s         r   r   zConvertFrameAssert.__init__:  sF     	&''')4&##5 #%%			r   *Callable[[CompilerFn], ConvertFrameAssert]c                      fdS )Nc                F    t          | j        j        j                  S r   )convert_frame_assertr  r  r  backendr   s    r   r   z8ConvertFrameAssert._clone_with_backend.<locals>.<lambda>M  s%    3OL$	 
  
 r   r   r   s   `r   _clone_with_backendz&ConvertFrameAssert._clone_with_backendK  s    
 
 
 
 	
r   r   r   r   r   cache_entryOptional[CacheEntry]hooksrQ   r  r  r   r   r_   c                  t                       |j        }t          ||          }t                              |           |t
          v rt                      S t          j        	                    d          r6t          j        	                    d          |j
        k    rt                      S |j
        dk    r(|j                            d          rt                      S |j
        dk    rt                      S |j
        dk    rT|j                            t          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.          j                   t3          |          st                      S t5          j                    }|r%d|j        j        v r|j        }|rd|j        j        v |r#|j        t:          j        u rt          d          S t?                      a tC          |          }	|	j"        }
tG          dd|j
        |
tI          |	          |j        |j%        |j&        |j'        d           |j
                            tP                    s8|j
         d|j         d|j%         }tR          j*        +                    |           tY          t[          |	                    5  t]          |j        |j/        |j0        |j        |j1        | j2        | j3        | j4        | j5        ||||||	|dz   | j6        | j7                  }d d d            n# 1 swxY w Y   tp          j9        r'| j6         ddl:m;} |<                    | j6                   |S )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dynamoz_convert_frame_assert._compile)r   r  
compile_idr   r   
cache_sizeaccumulated_cache_size :r(   )r  r  r   r  convert_frame_box)DynamoCache)=rm   rE  r6   input_codesr   output_codesr_   osenvirongetr   r   endswithrH  pathdirnamer   optimr   r   
f_builtinsr2   rK   r,   FUNDAMENTALrM  sys	_getframef_backr*   "_nonrecursive_disable_wrapper_coder   r   r  r  r   r   r   +num_cache_entries_with_same_id_matched_objsnum_cache_entriesrX   r;   traced_frame_infosr   r   r   _compilerG  rI  closurer'  r  r  r  r  r  r)   caching_precompiler  r  record_package)r   r   r  r  r  r   r   r  
prev_framer  r  infor   r  s                 r   __call__zConvertFrameAssert.__call__T  sB    	|'{;;
<%'''JNN788	(
;<<LL%'''<;&&4+;+D+D,
 ,
& &'''<=(( &'''<:%%$*:*E*EGOOEK011+
 +
%
 &'''
 <:%%$*:j*H*H%''' LJ&& J..)** /
 &''' 
	4Z5 '2		 	 	 	 #5)) 	(%''' ]__
	+0J4E4QQQ#*J 	+0J4E4QQQ 	;!Z%RRR%E::::  011#K00
&,<$!*oo#/"&"5(T*4*F 	
 	
 	
 |&&'DEE 	7lMMT%5MM8KMMD)00666^J7788 	 	 .('%AX"&)%  F	 	 	 	 	 	 	 	 	 	 	 	 	 	 	, $ 	6)B,,,,,, &&t}555s   4ANN #N TFNN)r  r}   r  r   rQ  r   r  r  r  r  r   r   )r   r  r   r   r  r  r  rQ   r  r  r   r   r   r_   r   r   r   r   propertyr  r  r   r   r   r  r  9  s         59,0& & & & &" 
 
 
 X
 I I I I I I I Ir   r  Tr  r}   r  r  r  r  r  c                (    t          | ||||          S )zHFully convert a frame into an FX graph, raising an exception if we fail.)r  )r  r  rQ  r  r  s        r   r  r    s"     Y(:G  r   )OrderedDict)RemovableHandlezdict[int, BytecodeHook]_bytecode_hookshookr   r  c                L    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   )r  handles     r   register_bytecode_hookr    s"    
 _--F!%OFIMr   rQ  r  r  distributed_stater  types.CodeTypedict[str, object]localsbuiltinsr  tuple[CellType]tf_mode_stack'list[torch.overrides.TorchFunctionMode]speculation_logr]   instructionslist[Instruction]code_options4Optional[dict[str, Union[int, FrameStateSizeEntry]]]r  Optional[DistributedState]rR   c               .   ddl mm                                  t	                      }t          |	| ||||||
||||||||          d	fd}	  |             t                    }|j        }|J |j        sJ |j        |	d d <   |
	                    |j
                   t          |	           t          |	           t          t          |	                    |	d d <   n)# t          $ r}t          d          |_         d }~ww xY w|S )
Nr   )bisecttranslation_validation_enabled)r  r  exn_vt_stackr  r  r   r   c                    	 j                                          t          j         j                  5                                  5                                   d d d            n# 1 swxY w Y   d d d            n# 1 swxY w Y   nw# t          j        $ r                                   t          j	        t          j
        t          j        f$ r  t          $ r!              r  j         j                    w xY wj                                          i _        d S # j                                          i _        w xY wr   )outputmark_bytecode_tracing_startr   tracing_contextset_current_txrunr+   UnspecializeRestartAnalysisr   SpeculationRestartAnalysisTensorifyScalarRestartAnalysis	SkipFramerO  	shape_envcall_cleanup_hooksrI  )r  r  tracerr  s   r   
run_tracerztrace_frame.<locals>.run_tracer/  s   	!M55777677  9N9N9P9P  

                             . 	 	 	!!###*.M
 	 	 	
  	 	 	--// 0v}.///	
 M,,... FOOO M,,... FO    se   2B B
A+B+A/	/B2A/	3B6B BB 	B
B D' A4DD' '"E	T)errorr   )torch.fx.experimental.validatorr  r  restartrZ   r[   rR   output_graphoutput_instructionsupdater  r3   r0   r/   r.   rO  _torch_dynamo_tracer_output)r   r   r  r  r  r  r  r  r  r  r  rQ  r  r  r  r  r  r  tracer_outputr  rN  r  r
  r  s           `            @@@r   trace_framer    s   ( WVVVVVVV!##L"'!+#  F(! ! ! ! ! ! ! ! !,
*622+!!!)))) 4QQQF/000(666(66601A,1O1OPPQQQ   (:6(N(N(N% s   BC, ,
D6DDc                  P    e Zd ZU dZded<   ded<   ded<   	 	 	 	 dddZ	 dddZdS )DynamoOutputao  
    Represents the core data returned from a single dynamo run, including:
      - Guards, wrapped inside tracer_output.output_graph.guards
      - Generated bytecode
      - Other information needed for compilation.
    This data structure should capture all the "interesting" information dynamo
    produces on the frontend side before it enters user backend.
    rR   r  r  r   zOptional[float]last_attempt_start_timeNFr   r  Optional[Hooks]saver   r  r  strict_errorr   rN   c           	     r    | j         j        }|J t          ||||r|j        nd |r|j        nd ||          S N)save_guardsr  )r  r  rN   guard_fail_fnguard_filter_fn)r   r   r  r  r  r  r  s          r   build_guardszDynamoOutput.build_guardse  sa     )6'''##(2Ed%*4E!!%
 
 
 	
r   argdefsOptional[tuple[Any, ...]]GraphCaptureOutputc           	         | j         j        }|J t          t          |                                |j        |j        |j        |j                  |j        |j	        | j
        | j         j        || j         j                  S r   )r  r  r#  rS   dump_guards_stateimport_sourcesr  export_metadatatracked_fakes_id_to_sourcetraced_coder   r  rG  )r   r!  r  s      r   graph_capture_outputz!DynamoOutput.graph_capture_outputy  s     )6'''!..00+&,7  '$M&(
 
 	
r   NFNFr   r  r  r  r  r   r  r  r  r   r   rN   r   )r!  r"  r   r#  )r   r   r   __doc__r  r   r*  r   r   r   r  r  V  s           &%%%,,,,
 "&,0"
 
 
 
 
* 48
 
 
 
 
 
 
r   r  c                  F    e Zd ZU dZded<   ded<   ded<   ded	<   d
ed<   dS )BackendInputa   
    Represents core data structure that dynamo will pass to a backend, including:
      - Graph module
      - Example inputs
      - The FakeTensorMode used for compiling graph.
    This data structure should capture all the information dynamo produces
    on for the user backend.
    r   
backend_idtorch.fx.GraphModuler   r
   example_inputsz,torch._subclasses.fake_tensor.FakeTensorMode	fake_moder|   tensor_to_contextN)r   r   r   r-  r  r   r   r   r/  r/    sW           OOO&&&&;;;;******r   r/  )frozenc                      e Zd ZU ded<   ded<   ded<   ded<   ded	<    ej        e
          Zded<   ddddZddZ	dS )GraphRuntimeEnvr  r   dict[str, str]r&  r   used_globalsr"  r  r!  )default_factoryset[str]external_refsNextra_globalsr0  r   compiled_fnCallable[..., Any]r>  Optional[dict[str, Any]]r   c                   d | j                                         D             }i || j        |pi ||i}|                     |           t	          j        | j        || j        | j                  S )Nc                >    i | ]\  }}|t          j        |          S r   )	importlibimport_module)r   aliasmodule_names      r   
<dictcomp>z4GraphRuntimeEnv.forward_callable.<locals>.<dictcomp>  s9     
 
 
"{ 9*;77
 
 
r   r  r!  )	r&  itemsr9  _check_external_refstypesr   r   r  r!  )r   r0  r?  r>  r&  rG  s         r   forward_callablez GraphRuntimeEnv.forward_callable  s    
 
&*&9&?&?&A&A
 
 



 "
 	
 
	 	!!),,,!MLL	
 
 
 	
r   rG  r   c                z    g }| j         D ]}||vr|                    |           |rt          d| d          d S )Nz&Missing required external references: zM. Please load AOT compiled function with `f_globals=<enclosing global scope>`)r<  r   RuntimeError)r   rG  missing_refsr   s       r   rK  z$GraphRuntimeEnv._check_external_refs  sw    % 	) 	)C)####C((( 	^ ^ ^ ^  	 	r   )r0  r   r?  r@  r>  rA  r   r@  )rG  r   r   r   )
r   r   r   r  dataclassesfieldr   r<  rM  rK  r   r   r   r7  r7    s         """"    &&&&&&&&/k/DDDMDDDD 37
 
 
 
 
 
8
 
 
 
 
 
r   r7  c                      e Zd ZU dZded<   ded<   ded<   ded	<   d
ed<   d
ed<   ded<   	 	 	 	 d!d"dZd#dZed$d             ZdS )%r#  z)
    Minimal version of DynamoOutput
    rS   r  r8  r&  zlist[CodeType]r)  r   r   r"  r  r!  r   rG  NFr   r  r  r  r  r   r  r  r  r   rN   c           	     \    t          || j        ||r|j        nd |r|j        nd ||          S r  )rN   r  r  r  )r   r   r  r  r  r  s         r   r   zGraphCaptureOutput.build_guards  sM     $#(2Ed%*4E!!%
 
 
 	
r   r7  c                2   ddl m} i }| j        j        j                                        D ])} ||          }||| j        v r| j        |         ||<   *|                     | j                  }t          | j        | j
        || j        | j        |          S )Nr   )get_global_source_name)r   r&  r9  r  r!  r<  )torch._dynamo.sourcerV  r  r'  graph_input_idx_to_local_sourcerA  rG  _get_external_refsr   r7  r&  r  r!  )r   rV  r9  sourceglobal_namer<  s         r   get_runtime_envz"GraphCaptureOutput.get_runtime_env  s    ?????? .NUUWW	H 	H0088K"dn,,,0N;,G[) //>>].%LL'
 
 
 	
r   r;  c                   dd l }t                      } |j        |           D ][}|j        dk    r"|j        r|                    |j                   /|j        dk    r!|j        r|                    |j                   \|S )Nr   LOAD_GLOBAL	LOAD_NAME)disr   get_instructionsopnameargvalr   )r   r`  r<  instructions       r   rY  z%GraphCaptureOutput._get_external_refs  s    


"%%% 03/99 	: 	:K!]22% :!%%k&8999#{22% :!%%k&8999r   r+  r,  )r   r7  )r   r  r   r;  )	r   r   r   r-  r  r   r\  staticmethodrY  r   r   r   r#  r#    s           $###""""&&&&&&&&
 "&,0"
 
 
 
 
$
 
 
 
2    \  r   r#  c                  8    e Zd ZU dZded<   ded<   dddddZdS )CaptureOutputa  
    CaptureOutput should represent all the information produced from torch
    compiler for a single graph capture. This intends to be consumed by
    various compiler frontends so that we can share as much compiler internals
    as possible and avoid great divergence between different stacks.
    This data structure should eventually contain all the information compiler
    produces as more refactors happens to converge different compiler
    frontends.
    r#  r*  zOptional[BackendInput]backend_inputN)r?  r>  r?  Optional[Callable[..., Any]]r>  rA  r   r@  c                   | j                                         }| j        J | j        j        }|p| j        j        }|                    |||          S )Nr=  )r*  r\  rh  r0  r   rM  )r   r?  r>  runtime_envr0  s        r   rM  zCaptureOutput.forward_callable0  sf     /??AA!---'2
!DT%7%D++= , 
 
 	
r   )r?  ri  r>  rA  r   r@  )r   r   r   r-  r  rM  r   r   r   rg  rg     s`           -,,,))))
 5926	
 
 
 
 
 
 
 
r   rg  modr
   %tuple[FunctionType, Optional[object]]c                   ddl }t          | t          j        j                  r| j        }t          |d          r|j        }t          | j	                  dk    rt          | j
                  dk    rt          t          j        j        j        j                  dk    rt          t          j        j        j        j                  dk    rt          | j                  dk    rt          | j                  dk    rzt          t          j        j        j        j                  dk    rNt          t          j        j        j        j                  dk    r"|t          j        j        j        k    r| j        } n.t          | t          j        j                  r| j        } n| j        } t          | d          r| j        | j        fS  |j        |           r| dfS t3          d|            )z
    Utility function to get the function to trace, and optionally a bound self
    object, from a callable (nn.Module, function, or method).
    r   N__self__zUnsupported model code type )inspectr5  r   r7  r8  forwardrC  __func__len_forward_pre_hooks_forward_hooksmodulesmodule_global_forward_pre_hooks_global_forward_hooks_backward_pre_hooks_backward_hooks_global_backward_pre_hooks_global_backward_hooksr   GraphModule
_call_implr  ro  
isfunctionrO  )rl  rp  resolved_forwards      r   get_traced_fnr  @  s   
 NNN#ux'' ;#Z00 	9/8
 &''1,,C&''1,,EH$+EFF!KKEH$+ABBaGGC+,,11C'((A--EH$+FGG1LLEH$+BCCqHH EHO$;;; +CCUX122 	.CC,CsJ A|S\))		C	 	  ADy?#??@@@r   inspect.Signaturec                .    t          j        | d          S )NF)follow_wrapped)rp  	signature)r   s    r   _get_signaturer  m  s    R6666r   r   tuple[Any, ...]r   rA  	FrameInfoc                   ddl }t          |           \  }}||f|z   }|i }t          |          } |j        |i |}|                                 |j        }|j        pd}	|j        j        }
|
s|	rOt          |	          t          |
          k    sJ |
                    d t          |
|	          D                        t          |j        |j        ||j        |j        pd|j                  S )zL
    Create a frame to trace, given a model, args, and optional kwargs.
    r   Nr   c                $    i | ]\  }}||j         S r   )cell_contents)r   r   cells      r   rH  z_get_frame.<locals>.<dictcomp>  s!    OOO*$T4%OOOr   rI  )r  r  r  bindapply_defaults	arguments__closure__r   co_freevarsrs  r  zipr  __globals____dict____defaults__)rl  r   r   r  r   self_optr  bound_argumentsrI  r  freevarss              r   
_get_framer  q  s%    OOO %%LB{T!~r""I$ind5f55O""$$$(Hn"G{&H 
7 
7||s8}},,,,OOHg8N8NOOO	
 	
 	
 

$"   r   constraints _is_export_deprecated_do_not_user  Optional[list[Constraint]]r  c                   t          | ||          }t          t          t          i                               5  t	          |||          cddd           S # 1 swxY w Y   dS )a  
    This API captures a full graph for a model, given example inputs to trace with.

    Specifically, it takes a callable (nn.Module, method, or function), args, and
    optional kwargs, and returns Dynamo-captured graph along with other important
    compile-time information. This serves as the common graph-capture mechanism
    for different torch compiler AOT frontends (e.g. AOT precompile, export).

    Note that this API doesn't apply context managers like metrics context,
    and the expectation is that the caller will apply them depending
    on the use case.

    The CaptureOutput is separated into two parts:
    1. Frontend specific information, which includes:
        - guards
        - generated bytecode
        - other information tracked by OutputGraphCommon.
    2. Backend specific information (indexed by unique backend id) such as:
        - fx graph
        - example inputs
    r  N)r  r   r   r  _fullgraph_capture_frame)rl  r   r   r  r  r   s         r   fullgraph_capturer    s    : sD&))E	r(:(:;;	<	< 
 
'#-M
 
 

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
s   AA!Ac                  L    e Zd ZU ded<   ded<   ded<   ded<   ded<   d	ed
<   dS )r  r  r   r  r   r  r  r  r  r"  r!  N)r   r   r   r  r   r   r   r  r    sZ         &&&&&&r   c                  ddl m d dfd}	 t          | j        | j        | j        | j        | j        |||d	t                      

  
        }nz# t          $ rm}t          |           t          j        r |}|j        (|j                            d            |j        }|j        (|                    d           |j        d }~ww xY wt          |                    | j                            S )Nr   )TracingContextgmr1  r2  list[torch.Tensor]r   c                                                     }|j        }|j        }|J t          | j        d         t
                    sJ t          | j        d         | |||          | S )Nr0  )r  r3  r4  r5  metar   r/  )r  r2  r  r3  r4  r  rh  s        r   fullgraph_compilerz4_fullgraph_capture_frame.<locals>.fullgraph_compiler  sy     ),,..#-	+=$$$"',/55555$GL!2~yBS
 
 	r   T)r  rQ  r  r  restart_reasons)r  r1  r2  r  r   r1  )torch._guardsr  compile_framer   r   r  r  r  r   rL   r?   r)   verbose	__cause__with_tracebackrg  r*  r!  )	r   r  r  r  dynamo_outputrN  cur_exnr  rh  s	          @@r   r  r    s?    -,,,,,,0M      6%JMLNM*3*EE
 
 
  
6 
6 
6A> 	!"+,,T222'G + t$$!+5
6 **5=99  s   >A 
C	A(CC	r  r;  c                  	
 t                      d 	
fd}d}t          j                    D ]}|t          j                    _        	 t          d	| d
          5  t           |          \  }}|J t          |||          cddd           c S # 1 swxY w Y   t# t          j
        $ r}t          |t          j                  st          j                     t                              dt#          t$          |j                             t)          |dd          }|r|                                 |                    |j        pt1          t3          |                               t5          j                    }|dk    rt7          dddg            Y d}~rd}~wt          j        $ r}t          |t          j                  st          j                     t)          |dd          }|r|                                 t                              d| j         j         j                     d}~ww xY wdS )a  
    A helper function taking a frame and backend, then return the generated bytecode
    and guards as a common data structure.
    This is a shared interface for multiple compiler frontends (e.g. torch.compile,
    torch.export) that needs to capture a graph out of python code.
    r  r  r  r  r   rR   c                    t           j                                        }t          || |	
          }|J |S )Nr  )r   	overrides _get_current_function_mode_stackr  )r  r  r  r  r  r  r   r  r  rQ  r  r  r   r  r  r  r  s       r   	transformz compile_frame.<locals>.transform  su     O<<>> 	 $1#/!
 
 
& (((r   Ncompile_attempt_Tlog_pt2_compile_event)r  r   r  zRestarting analysis due to %sr  d   z!Excessive RestartAnalysis() callsr  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.r  z*Skipping frame %s %s                 %s %s)r  r  r  r  r   rR   )!r]   r   countr   r  attemptrh   r4   r  r+   RestartAnalysisr5  r  r   r   rJ  r  rp   r'   __traceback__r4  _cleanup_output_graphr   restart_reasonr   r9  ro  rK   r  rK  r   r   r   )r   r   r  r  r  r  r  r  rQ  r  r  r  r  r  r  r  r   r  rN  failed_tracer_outputr  s   ``````` `````       @r   r  r    s   0 %&&O                 8 #?$$ 3 3'.$0	:::RVWWW  *?i*P*P'-$000#"/%,C                     " 	 	 	a!CDD '$&&&HH/11?CC  
 $+1.KT#R#R # =$::<<< 0 @CQLLAAA&*ikk#}}?!2     } 	 	 	a!CDD '$&&&#*1.KT#R#R # =$::<<<II #   	I3 3sJ   B73)B+B7+B/	/B72B/	3B77IC)F55IBI		I)r   r  r  r  rQ   r  r  r  r5   r  r  Optional[ConvertFrameBox]r_   c               j  
:;<= ddl m}m} d<t          d          dS:fd            }t          dT
;<=fd            :t                      }                    |           nt          j                    }t          t          j                  5  t          t                              5  t          ddd          5  t          d                                          5  |5  t#          ddd          5  |5  t%                      =t'                      x}rt)          |t+                                ;nd ;d }t-          |          r,|r*t/          
|t1                              }|sdn|d         }d}t          j        s6|r4t/          
|t1                    d          }|sd n|d         }|d|v rd}|                    ||d           t7                      }|r"d |D             }|                    d|           t9          |          \  }} |rdUd!}!t:                              d"| t?          t          |            |!|           |t@                     t          j!        rtE          |  d#          |rtE          |  d$          tG          d%          rtI          |  d&          tK          d'd(|  d)|  d*g +           t:          &                    d,| j'        | j(        | j)        |d-z   d.*                    tW          j,        d-|z   /          -                                                     t]          | |          }"t_          j0                    }#d }$d }%d }&d }'d }(tb          j2        j3        j4        5                                 d })d }*	  || ||	          \  })}*tm                       |*r@|*j7        x}+r7|+8                                r#ts          |            |rd0|v rtu                       |)tb          j2        j
        j;        rWt#          d1d23          5  t:          <                    d4           t{          j>        d5           d d d            n# 1 swxY w Y   d },|*r|*j7        },|,ri |,_?        |,j@        x}-ri |-_A        d5d6l3mB}. t          |.          }/|%|,t          |,jE                  }0t          |,jF        jE                  }1|,G                                }2t          |,jH        jI                  }3|,J                                }4t          |,jK                  }5d7 |,jL        D             }6d8 |,jM        D             }7tb          j2        j3        j4                                         nQd }0d }1d }2d }3i }4d }5t%          i           }6t%          i           }7t%                      =t_          j0                    |#z
  d9z  <i d:|/d;| j'        d<| j(        d=| j)        d>|jN        d?|jO        d@|0dA|1dB|2dC|3dD|5dE|$dF|%dG|'dH|(dI|6dJ|7=<|)d ut          jP        dt          <          |"t          |4          |&dK	}8|                    |8           |r|*r|*jR        nt                      |_R        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 # t          $ r7}9t          |9          jV        }$t          |9          }%t          jX                    g}&t          |9| |L           tb          jZ        [                    dMdN dO P           t          j]        |9          \  }'}(t?          |9dQd           }*t          |9t          t          t          t          t          t          |t          |t          t          t          f          r t          t          |9          jV         dRt          |9                     j                    |9jk                  d d }9~9ww xY w# tb          j2        j
        j;        rWt#          d1d23          5  t:          <                    d4           t{          j>        d5           d d d            n# 1 swxY w Y   d },|*r|*j7        },|,ri |,_?        |,j@        x}-ri |-_A        d5d6l3mB}. t          |.          }/|%|,t          |,jE                  }0t          |,jF        jE                  }1|,G                                }2t          |,jH        jI                  }3|,J                                }4t          |,jK                  }5d7 |,jL        D             }6d8 |,jM        D             }7tb          j2        j3        j4                                         nQd }0d }1d }2d }3i }4d }5t%          i           }6t%          i           }7t%                      =t_          j0                    |#z
  d9z  <i d:|/d;| j'        d<| j(        d=| j)        d>|jN        d?|jO        d@|0dA|1dB|2dC|3dD|5dE|$dF|%dG|'dH|(dI|6dJ|7=<|)d ut          jP        dt          <          |"t          |4          |&dK	}8|                    |8           |r|*r|*jR        nt                      |_R        w xY w# 1 swxY w Y   d d d            n# 1 swxY w Y   d d d            n# 1 swxY w Y   d d d            n# 1 swxY w Y   d d d            n# 1 swxY w Y   d d d            n# 1 swxY w Y   d d d            d S # 1 swxY w Y   d S )VNr   )BisectValidationExceptionValidationExceptiong        compile_inner)
phase_namer   r   r  r   r  rQ   r   7tuple[ConvertFrameReturn, Optional[DynamoTracerOutput]]c           
        t          j                    5 }|                    t          j        j                            t          j        t          t          j                                                   |                    t          j                                | ||          cd d d            S # 1 swxY w Y   t                      d fS r   )r  r  r  r   _dynamocallback_handlerinstall_callbacksr   DYNAMOr   r   r  rf   recordr_   )r   r  r  r   _compile_inners       r   r  z_compile.<locals>.compile_inner  s     !## 	:u.@@#*C0Q0S0S,T,T   
  = D F FGGG!>$	599	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	:   
 	
s   BB55B9<B9-tuple[ConvertFrameReturn, DynamoTracerOutput]c                   t          j                     x}}d#d} |d| j        | j        | j        |            d }	 t	          |  !|#"          }nV# t
          j        $ rD}|rt                              d           |j	        J t                      |j	        fcY d }~S d }~ww xY wj        
J d            |j        }|j        }	|j        |j        }|J  |d| j        | j        | j        |           t          t                                                     D ]A\  }
}t%          d|
 d          5   || |          }||}d d d            n# 1 swxY w Y   B| t&          |<   t(                              |           ||z
  |	j        J |	j        }d$d}|J  ||           } ||          }d}|d| j        d |          dz  }|d|j        d |          z  }| j        d |         |j        d |         k    s
J |            d}|d| j         dz  }|d|j         z  }| j        |j        k    s
J |            d}|d| j         dz  }|d|j         z  }| j        |j        k    s
J |            |j        r$|                                rt                      |	fS |j        J |j        t<          j        |<   t%          dd          5  |                     | |"d u           }d d d            n# 1 swxY w Y   "b|j!        J ""                    |j!        |           "#                    |j$        j%                   "&                    |j'        j(                   tS                    nd!}d"|z   }tU          ||j+        |          }|                                s!|j,        |,                    |j                   t[          |          |	fS )%Nprefixr   r   r   line_nor   r   r   r   r   c           	         t                               t          j                  r-t                               t          | ||||                     d S d S r   )bytecode_logisEnabledForloggingDEBUGrK  ri   )r  r   r   r  r   s        r   log_bytecodez6_compile.<locals>._compile_inner.<locals>.log_bytecode  s[     ((77 ""#FD(GTJJ     r   zORIGINAL BYTECODEr  z,No graph captured with export/fullgraph=Truez;compiler collective wasn't run before compilation completedzMODIFIED BYTECODEbytecode_hooks_Tr  c                    dd l }| j        | j        z   t          | j        |j        z            z   t          | j        |j        z            z   S )Nr   )rp  co_argcountco_kwonlyargcountr   co_flags
CO_VARARGSCO_VARKEYWORDS)r   rp  s     r   
count_argsz4_compile.<locals>._compile_inner.<locals>.count_args  sY    NNN  ()t}w'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 r   )r  r  r  UnknownzTorch-Compiled Region: )r  r   r   r   r   r   r  r   r   r   r   r   r   r   r   r   ).ro  r   r   r   r  r+   r  rJ  rK  r  r_   
all_statesr   r  r  	enumerater  rA  rh   rs   r  r   r  co_varnamesr  co_cellvarsrQ  is_empty_graphr  cleanupsre   instancer   guards_stateadd_guarded_codeadd_inlined_sourcer  r)  update_device_typecurrent_tracergraphr   rP   guard_managerguard_export_fnrb   )$r   r  r  r  
start_timer  out_coder  rN  r  r   r  hook_outputr  r  total_argcount_oldtotal_argcount_newmsgcheck_fncompile_id_strannotation_strguarded_coder  r  r  r  r  r  dynamo_time_before_restartrQ  r  r  r   r  r  r  s$                         r   r  z _compile.<locals>._compile_inner  s    04y{{:*	 	 	 	 	L	
 	
 	
 	G)#5'"3  MM } 	G 	G 	G J		HIII0<<<%'')FFFFFFFF		G !(,=,H,T,TI -U,T,T !)%30<&3&K####L	
 	
 	
 #?#9#9#;#;<< 	+ 	+IC555TRRR + +"d422**H+ + + + + + + + + + + + + + +
 #'h"""%<z%I")555+	 	 	 	 ###'Z--'Z11T4+;<O=O<O+PTTTTV8+?@SAS@S+TVVV0001#$7%7$789 9 99 9 9 $Ct/?CCCCEx/CEEE8#7777777#Ct/?CCCCEx/CEEE8#7777777 = 	7V2244 	7%''66}(((,2O).EEE 	 	$11D('	 2  H	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 (444$$X%:HEEE&&v'='IJJJ&&v'<'BCCC,6,BZ	2^C""	
 
 $$&& 	15+@+L !!&-000 ..==sA   A B,(9B'!B,'B,?EE 	#E 	LL	L	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 reasonsF)skip_loggingz%[inline-inbuilt-nn-modules-candidate])recompile_reason#inline_inbuilt_nn_modules_candidatec                2    h | ]} |            d d         S )N   r   )r   user_contexts     r   	<setcomp>z_compile.<locals>.<setcomp>  s4     ! ! !)5tt$! ! !r   recompile_user_contextsr   c                8    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  s+    U4<UUD,<UUt?RUU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 %szK reached, because fail_on_recompile_limit_hit = True this is a HARD failurea1   reached with fullgraph=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.r  zBtorchdynamo start compiling %s %s:%s, stack (elided %s frames):
%s   r  r   zsize mismatch at indexgc
gc_time_us)r  z run_gc_after_compile: running gcr(   )
curr_framec                    h | ]	}|j         
S r   r   r   ops     r   r  z_compile.<locals>.<setcomp>8  s    $X$X$XR_$X$X$Xr   c                    h | ]	}|j         
S r   r  r  s     r   r  z_compile.<locals>.<setcomp>9  s'     ( ( ((*BO( ( (r   g    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specialize_float
is_forward%dynamo_compile_time_before_restart_usstack_tracegraph_node_shapesexception_stack_tracerT  artifactc                     dddS )Ndynamo_errorstringr   encodingr   r   r   r   r   z_compile.<locals>.<lambda>  s    * (% % r   c                 (    t          j                    S r   	traceback
format_excr   r   r   r   z_compile.<locals>.<lambda>  s    9#7#9#9 r   metadata_fn
payload_fnr  z: )r   r   r  r   r  rQ   r   r  )r   r   r  r   r  rQ   r   r  )r   r   r   r   )lr  r  r  r   r\  rl   code_contextr  nullcontextr   r)   use_lazy_graph_moduler   r   rd   r!   guardrh   r   r   rY   r\   r8   rO   r<   inline_inbuilt_nn_modulesupdate_outerrk   r7   rJ  rs  r4  rw   fail_on_recompile_limit_hitrA   r   rE   rK   rK  r   r   r   joinr&   r   formatr   ro  time_nsr   r  utilsReinplaceCountersr   rV   r  has_outputsrU   rT   run_gc_after_compiler  r  collectlocal_scoperoot_txrI  r  r   rs  r  r  count_callsr  nodesget_graph_sizes_structuredplaceholdersr!  r"  r  r  r%  rv   r  rc   rO  r9  r   r3  r4  rV  r   r   r+   get_exc_messager5  rL   rI   r@   AssertionErrorr   r   rJ   rG   rD   rF   rC   r  r  )>r   r   r  r  r  r  r  rQ  r  r  r  r  r   r  r  r   r  r  r  r  r  metrics_contextr8  
compile_pgr  reasonsr  inbuilt_nn_reasonsinbuilt_nn_recompile_reasonr	  user_contexts_msgexceeded
limit_typer  r(  start_time_nsr  r  r*  r  r   r  r  r  r  r
  r  r  r  r  r  r  r)  r  r!  r"  metricsrN  r  r  r  r  s>    ````` `` `  `` `                                         @@@@r   r  r  n  sE   .        ),"o>>>
 
 
 
 
 ?>
" \> \> \> \> \> \> \> \> \> \> \> \> \> \> \> \> \> \> ^\>| *++O&-&9T"""z?U?W?W  	v;<<t tz2233t t 	d$	
 	
 	
t t 	BCCIIKKt t 	t t 	$-%H	
 	
 	
t t 	t t %(EE'))): 	% 0Z\\ J J $ +/J'' 	E 	=UL$=$= G ?FU667ST:  /4+/ 	;E 	;!HUL$=$=D" " " /I4Fq4I (
 ,7;./ / 7;3 	$$$47Z 	
 	
 	
 #F"G"G" 	N! !9P! ! !  9;LMMM6z:NN* ,	V V V V
 KK;
 
++  && #   1 -!nnn    -! ` ` `   !M   -
-D-D-DEEE 97:77!2%/!2 !2 !2     			QL1HGG%-1t8<<<CCEEFF	
 	
 	
4 'tT22#'	%)5926 04-33555`	*7-i*O*O'L- 3%2%??\3 !,,..3
 ,D111# 3(@DT(T(T0222f }#8 "!$NNN " "HH?@@@JqMMM" " " " " " " " " " " " " " " F 4&3 )%'"#^+6 )&(FO))))))JI"v'9!&-00(+F,<,C(D(D%!'!3!3!5!5#&v|'9#:#: $*$E$E$G$G!$'(;$<$<!$X$Xv?W$X$X$X!( (.4.I( ( ($ #599;;;;"(,%!%#' $&!$(!$'GG!'*2ww$"%%%.2lnn}.LPS-S*Y4< t/ !$"5	
 jT )**F { ()> !. #$4 $%6 Y { +,D )*@  $%6!" '(<#$ $30J$0$<$*$;"9B.: :  +%():%;%;)>9  GB ((111 !  %5M66244 "6a	t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t tV  +	< +	< +	< Q,Ia&&K%.%9%;%;$<!auV<<<<N++  :9 ,    @C?R:@ @<$&< $A'DdKKM%)",/'0-$ .  <"  /Aww+77s1vv77  .11t<S+	<d }#8 "!$NNN " "HH?@@@JqMMM" " " " " " " " " " " " " " " F 4&3 )%'"#^+6 )&(FO))))))JI"v'9!&-00(+F,<,C(D(D%!'!3!3!5!5#&v|'9#:#: $*$E$E$G$G!$'(;$<$<!$X$Xv?W$X$X$X!( (.4.I( ( ($ #599;;;;"(,%!%#' $&!$(!$'GG!'*2ww$"%%%.2lnn}.LPS-S*Y4< t/ !$"5	
 jT )**F { ()> !. #$4 $%6 Y { +,D )*@  $%6!" '(<#$ $30J$0$<$*$;"9B.: :  +%():%;%;)>9  GB ((111 !  %5M66244 "6    a	t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t ts  'l(l"k99k"	<kj4Jj'A!['j//Q*j*Q..j1Q.2Hjj4kk"	'k93l?l(`#D2```(j/b 4j bjbHjjj!!j4$j!%j4(k4j88k;j8<k?k"	kk"	kk"	k9"k&&k9)k&*k9-l9k==l k=ll(l	l(l	l((l,/l,c                  >    e Zd Z	 ddd
Zedd            Z	 dddZdS )ConvertFrameNr  r}   r  rQ   r  r  r   r   c                P    || _         t          |d|          | _        || _        d S )NF)r  r  )r'  r  _inner_convert_hooks)r   r  r  r  s       r   r   zConvertFrame.__init__{  s7     *5&25'
 
 
 r   *Callable[[WrapBackendDebug], ConvertFrame]c                      fdS )Nc                .    t          | j                  S r   )convert_framer]  r  s    r   r   z2ConvertFrame._clone_with_backend.<locals>.<lambda>  s    }K 
  
 r   r   r   s   `r   r  z ConvertFrame._clone_with_backend  s    
 
 
 
 	
r   r   r   r   r  r  r  r  r   r   r_   c                b   t                               |j                   t          d         dxx         dz  cc<   	 |                     |||||dz             }t          d         dxx         dz  cc<   |S # t
          $ r}t          |t                    r | j        j        j	        d u}|J | j        j        j	        r t          |t                    r t          |t                    }	|j        }
|	rt                              t          j                  rt!          |d          rt!          |d          rt#          t%          |j                            5  |j        }d                    t-          j        |                    }t1          j        |
          }d	| d
| t4          j                            dd fd           t                              dt<          j                   d d d            n# 1 swxY w Y   t<          j         s|	s tC          |dd           }|j        }
tE          ||
||          }|	rtF          $                    |d           ntF          %                    |d           t          |tL                    r7tO          tQ          tR          j*        tR          j*                            cY d }~S t          |tV                    r7tO          tQ          tR          j,        tR          j,                            cY d }~S Y d }~nd }~ww xY wtO                      S )Nframestotalr(   r   okr  
real_stackr  zGraph break: torch.compile cannot properly resume from this graph break, which results in a skip.
torch.compile will skip tracing the frame zN and fall back to eager.
The graph break occurred in the following user code:
r+  c                     dddS )Ndynamo_graph_break_reasonr.  r/  r   r   r   r   r   z'ConvertFrame.__call__.<locals>.<lambda>  s    (C,41 1 r   c                 4      dt          j                     S )N
r2  )user_stack_traces   r   r   z'ConvertFrame.__call__.<locals>.<lambda>  s    2B/^/^iFZF\F\/^/^ r   r5  T)exc_info
stack_inforU  )rl  )frame_exec_strategy)-r  r   rE  rg   r\  rO  r5  rF   r  r  rJ   rL   graph_break_logr  r  r  rC  r   r   r  rf  r?  r3  format_listr+   format_frame_infor   r   r   rK  r)   r  suppress_errorsr4  rB   rJ  r  rs  rH   r_   ra   r`   SKIPrE   RUN_ONLY)r   r   r  r  r  r   r   rN  r  	soft_failr   
user_stackuser_stack_formatted
frame_inforU  	error_msgrk  s                   @r   r  zConvertFrame.__call__  s    	%%%7###q(###h	(({E;TAX )  F Xt$$$)$$$M b	 b	 b	!788  #(=TI ! (333"'<    !9:: "1k22I<D
  _99'-HH  1l++ <0H0H ()E)EFF  %&\
/1ww%1*==0 0, &)%:4%@%@
6IS6 6  46 6 ) 77&) ) (_'^'^'^ 8    (--,%)'-~ .   )              4 ) )  &a):DAAO<D(D/5III 6T2222I555!788 )(9#(+*:) )        
 A566 )(9#,k.B) )            {b	H "###sQ   9A7 7L CLBG?3L?H	LH	B=LL 
ALL L r   )r  r}   r  rQ   r  r  r   r   )r   r^  r   r  r  r   r   r   rZ  rZ  z  sw        
 -1	
 
 
 
 
 
 
 
 X
 t$ t$ t$ t$ t$ t$ t$r   rZ  c                &    t          | ||          S )zHTry to convert a frame into an FX graph, if error leave frame unmodified)r  )rZ  )r  r  r  s      r   ra  ra    s     UG<<<<r   r   c                   ddl m} t          j        }dt          _        t	          | d          5 }t          j        |          }d d d            n# 1 swxY w Y   t          t          j	        |j
                                        t                                                                          |_
        t          j        d          5  	 t          |j        |j
        |j        |j        |j        |ddd t'                      t)          dd          d d i t+          dd          	           |t          _        n# |t          _        w xY w	 d d d            d S # 1 swxY w Y   d S )
Nr(   )eagerFrbr   *   i  )r  r  )
r  r  rQ  r  r  r  r  r   r  r  )backends.debuggingr}  r)   replay_record_enabledopenrW   loadr@  r   chainr   rJ  r*   r  r  r   r  r  r  rQ   r5   r   )r   r}  original_replay_valin_filer  s        r   replayr    s   )))))) 6#(F 	h		 / %g../ / / / / / / / / / / / / / /)/&.*>*>*@*@'))//BSBSTTUUFN		(	/	/ ? ?	?!#'gg4Q:: $b3GGG   $ ,?F((+>F(>>>>()? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?s<   AAAEA D:-E:EEE Ec                    t           j        dk     rdS t          j        |           D ]}|j        dk    r|j        dz  c S t          d          )N)      r   RESUMEr  z$RESUME instruction not found in code)r  version_infor`  ra  rb  offsetrO  )r   insts     r   first_real_inst_idxr  /  sc    
'!!q$T** $ $;("";!#### #
=
>
>>r   c                      e Zd ZddddZdS )ConvertFrameProtocolr   r   r   r   r  r  r  rQ   r  r  r   r   r   r_   c                   d S r   r   )r   r   r  r  r  r   s         r   r  zConvertFrameProtocol.__call__9  s	     !Sr   Nr  )r   r   r   r  r   r   r   r  r  8  s7         ! ! ! ! ! ! ! !r   r  c                     t                      S r   )r$   r   r   r   &should_skip_due_to_torch_dispatch_moder  D  s    :<<<r   c                      e Zd ZddZddZdS )CatchErrorsWrappercallbackr  r  rQ   r   r   c                \     t          j        |          |            || _        || _        d S r   )r%  r&  r'  r  )r   r  r  s      r   r   zCatchErrorsWrapper.__init__I  s/    !	!!$''')1&


r   r   r   r  r  r  r  r_   c           	        |J t                               |j                   t          j        |j                  }t
          j        dk    r|j        t          |j                  k    }n|j        t          |j                  k    }|s2|s0t          j
        s$t                      rt          | j        dd          st                              t           j                  rg|rd}n1t          j        |j                  rd}nt%          d          rd}nd}t                              d	|j        j        ||j        j                   t-                      S |j        j        d
k    r|j        j        dk    s/|j        j                            d          r|j        j        dk    rt-                      S t0          j        j                                        dk    rt9          j                    }|rt<          5  ddlm }  ||j!        | j        j                  }	tE          | j        d          s
J d            | j        #                    |	j$                  }
 |
||| j%        |          cd d d            S # 1 swxY w Y   t<          5  tM                      5  |                     ||| j%        |d          }|cd d d            cd d d            S # 1 swxY w Y   d d d            d S # 1 swxY w Y   d S )N)r     r  Fztraced frame alreadyzin skipfiles)include_infra_modeszSnon-infra torch dispatch mode present, this is not supported today in torch.compilezdynamo tracing is disabledz#skipping: %s (reason: %s, file: %s)r  __new__zcollections/__init__.py_makeddp_optimizerr   )DDPOptimizer)bucket_bytes_capbackend_compile_fnr  zJDDPOptimizer only supports callback fns that know how to clone themselves.r(   r   )'r  r   rE  r-   r  r  r  f_lastir  r)   disabler  r4  r'  rJ  r  r  r  r%   rK  r   r   r_   r  r   r  rB  get_optimize_ddp_moder"   _get_active_ddp_modulecompile_lock"torch._dynamo.backends.distributedr  r  rC  r  
compile_fnr  r#   )r   r   r  r  is_skipfilehas_started_executionskip_reason
ddp_moduler  r  hijacked_callbackr   s               r   r  zCatchErrorsWrapper.__call__N  s    &&&%%%!'55w&&$)M4G4U4U$U!!$)M5H5V5V$V! "	( 	( ~		( 788	(   >	5QQ	( .. ( ?"8KK &u|44 ?"0KK.5III ?"wKK">K		9L(L,	   &''' L$
22u|7Ky7X7XL$--.GHH 8Y $// &'''=4466/II0GIIJ !  OOOOOO$0L)3)D+/+I+c% % %M #68M    e   6JJ)4  &
 -,{DJ #               *  	 	133 	 	33{DJ! 4  F 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	sI   5A3I55I9<I9K(!K7K(K	K(K	K((K,/K,N)r  r  r  rQ   r   r   )r   r   r  r  r  r  r   r_   )r   r   r   r   r  r   r   r   r  r  H  sB           
O O O O O Or   r  r  c                "    t          | |          S r   )r  )r  r  s     r   catch_errors_wrapperr    s     h...r   r   )r   r   r   r   r   r   r   r   rz  )r   r   r   r   r   r   )r   r   r   r   )r   r   r   r   )NF)
rN  rO  r   r   r   rP  rQ  r   r   r   )rX  r   r   r   )r  r  r   r   r  )r  r}   r  r   rQ  r   r  r  r  r  r   r  )r  r   r   r  )"r   r  r   r  r  r  r  r  r  r  r  r}   r  r  r  r   r  r]   r  r  r  r  rQ  r   r  r  r  r  r  r  r  r  r   rR   )rl  r
   r   rm  )r   r
   r   r  )rl  r
   r   r  r   rA  r   r  )rl  r
   r   r  r   rA  r  r  r  r   r   rg  )r   r  r  r  r  r   r   rg  )r   r  r   r  r  r  r  r  r  r  r  r}   r  r   r  r;  rQ  r   r  r  r  r  r  r  r  r  r   r  )NN)&r   r   r   r  r  r  r  r  r  r  r  r}   r  r   rQ  r   r  r  r  rQ   r  r  r  r5   r   rP  r  r  r  r   r   r   r  r  r  r  r   r_   )r  r}   r  rQ   r  r  r   rZ  )r   r   r   r   r  )r   r   )r  r  r  rQ   r   r  )r-  
__future__r   collectionsr  rm  rQ  r`  r%  r  rD  rp  r   r  r  ra  r   rx  r  	threadingro  r3  rL  typingr   r   pathlibr   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   r  r   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$   r%   torch.utils._tracebackr&   r'   r  r)   r*   r+   r,   r-   bytecode_analysisr.   r/   bytecode_transformationr0   r1   r2   r3   r4   r  r5   r6   r7   r8   
eval_framer9   r:   r;   r<   r=   r>   r?   r@   rA   rB   rC   rD   rE   rF   rG   rH   rI   rJ   rK   rL   graph_bytecode_inputsrM   r  rN   rO   rP   r  rQ   r  rR   rS   pgorT   rU   rV   replay_recordrW   resume_executionrX   symbolic_convertrY   rZ   r[   r\   r]   r^   r_   r`   ra   rb   rB  rc   rd   re   rf   rg   rh   ri   rj   rk   rl   rm   rn   ro   rp   rq   rr   rs   rt   ru   rv   rw   rx   variables.torch_functionry   r  numpyrz   ModuleNotFoundErrorTYPE_CHECKINGcollections.abcr{   torch.utils.weakr|   backends.registryr}   r  r~   repro.after_dynamor   r   r   r   variables.builderr   	getLoggerr   rJ  r   getArtifactLoggerr  ro  RLockr  r   r   r   r   r  r  r   r&  r   r   r(  #suppress_torch_distributed_warningsrM  rV  r  CounterrW  r\  r[  r  r  r  r  r  torch.utils.hooksr  r  r  r  r  r/  r7  r#  rg  r  r  r  r  r  r  r  r  rZ  ra  r  r  Protocolr  r  r  r  r   r   r   <module>r     s    . # " " " " "              



     				           				       



             ! ! ! ! ! !       > > > > > > > > > > > > 0 0 0 0 0 0 0 0 0 0 0 0 ' ' ' ' ' ' ! ! ! ! ! !      4 4 4 4 4 4 2 2 2 2 2 2 4 4 4 4 4 4 9 9 9 9 9 9 M M M M M M M M M M M M % % % % % %            ? > > > > >        Q P P P P P & & & & & & A A A A A A         
 M L L L L L L L E E E E E E E E E E E E E E G G G G G G G G                                                                        > = = = = =         
       ? ? ? ? ? ? ? ?         
 + * * * * * ; ; ; ; ; ;              " ! ! ! ! ! X X X X X X X X X X X X                                               0 J I I I I I       	BBB 
 	7((((((444444------''''''444444@@@@@@@@@@666666 g!!~//*EE.228^LL y  WT]]Yt__	 	 	 	 	 	 	 	       ( giiwyy37  7 7 7 7 *++MQ    ,+    DQ Q Q Qh 1K K K 21Kb (,	* * * * * K     
   E E E EP 0 0 0 0 0 0 0 0   .d d d d d d d dR 15(,
 
 
 
 
 $ # # # # # - - - - - - ,7;== 8 8 8 8     15HL48(,#O O O O O Od 5
 5
 5
 5
 5
 5
 5
 5
p + + + + + + + +" $. . . . . . . .b I I I I I I I IX 
 
 
 
 
 
 
 
>*A *A *A *AZ7 7 7 7 (,$ $ $ $ $T (,$

 /3-2$
 $
 $
 $
 $
 $
N ' ' ' ' ' ' ' ' /3-2	5 5 5 5 5 5D 15HL48(,j j j j j jt (,HLI" (, 48+I I I I I IXH$ H$ H$ H$ H$ H$ H$ H$\ )-= = = = =? ? ? ?@? ? ? ?	! 	! 	! 	! 	!6? 	! 	! 	!= = = =U U U U U U U Up/ / / / / /s   2G7 7H H