+
    ˜°³j=!  ã                   óü   € ^ RI t ^ RIHt ^ RIHt ^ RIHtHt R R3R R llt] P                  ! ]R	 R
R7      t
] P                  ! ]R RR7      tRR ltR R lt] ! R R4      4       t] ! R R4      4       tR tR# )é    N)Údeque)Ú	dataclass)ÚAnyÚLiteralc                 ó   € V P                   # ©N)Úchildren©Úxs   &ÚV/home/luca/screen-checking/.venv/lib/python3.14/site-packages/torch/profiler/_utils.pyÚ<lambda>r      s   € °1·:²:ó    Fc                ó$   € V ^8„  d   QhR\         /# )é   Úreverse)Úbool)Úformats   "r   Ú__annotate__r      s   € ÷ *ñ *Ìñ *r   c              #   óÊ   "  € V'       d   \         MR  p\        V! V 4      4      pV'       d5   V! V4      pVx € V! V! V4      4       F  pVP                  V4       K  	  K<  R# 5i)c                 ó   € V # r   © r
   s   &r   r   Ú_traverse.<locals>.<lambda>	   s   € ©qr   N)Úreversedr   Úappend)ÚtreeÚnext_fnÚchildren_fnr   ÚorderÚ	remainingÚ
curr_eventÚchild_events   &&&&    r   Ú	_traverser"      sV   é € ß�H¡[€EÜ‘e˜D“kÓ"€Iß
Ù˜YÓ'ˆ
ØÒÙ ¡¨ZÓ!8Ö9ˆKØ×Ñ˜[Ö)ó :ñ ùs
   ‚*A#­6A#c                 ó"   € V P                  4       # r   )Úpopr
   s   &r   r   r      s
   € ¸a¿e¹e¼gr   T)r   r   c                 ó"   € V P                  4       # r   )Úpopleftr
   s   &r   r   r      s
   €  §¡¤r   c                 ó˜   € Ve   V\        V 4      8¼  d   \        V 4      p\        W#4       F  pV! W,          4      '       g   K  Vu # 	  R # r   )ÚlenÚrange)ÚseqÚ	predicateÚstartÚendÚis   &&&& r   Úindex_of_first_matchr/      s@   € Ø
‚{�cœS ›X”oÜ�#‹hˆÜ�5ÖˆÙ�S•V×ÔØŠHñ ñ r   c                ó   € V ^8„  d   QhRR/# )r   ÚreturnNr   )r   s   "r   r   r   %   s   € ÷ ñ ˜tñ r   c                  ól   € ^ RI Hp  V ! 4       ;_uu_ 4         RRR4       R#   + '       g   i     R# ; i)r   ©ÚprofileN)Útorch.autograd.profilerr4   r3   s    r   Ú_init_for_cuda_graphsr6   %   s   € Ý/á	��Ø÷ 
��Šús   –"¢3	c                   ó0   a € ] tR t^,t o RtV 3R ltRtV tR# )ÚTimelineEventz-Represents an event in the profiler timeline.c                ó´   <€ V ^8„  d   Qh/ S[ ;R&   S[R,          ;R&   S[R,          R,          ;R&   S[S[ ,          R,          ;R&   S[S[S[3,          ;R&   # )	r   Ú	timestampÚ
event_typeNÚmarker_typeÚ
identifierÚevent)r,   r-   Úregular©ÚfilenameÚnode)Úintr   ÚstrÚdictr   )r   Ú__classdict__s   "€r   r   ÚTimelineEvent.__annotate__,   sg   ø‡ ‚ ñ �Nñ	 ñ
 Ð1Õ2Ñ2ñ ñ Ð+Õ,¨tÕ3Ñ3ñ ñ ‘c•	˜DÕ Ñ ñ ñ ‘‘S��>Ñò r   r   N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__Ú__annotate_func__Ú__static_attributes__Ú__classdictcell__©rF   s   @r   r8   r8   ,   s   ø‡ € á7÷ ƒ r   r8   c                   ó4   a € ] tR t^7t o RtRtV 3R ltRtV tR# )ÚContextStackEntryz5Represents a context (filename or node) in the stack.Nc                ó„   <€ V ^8„  d   Qh/ S[ R,          ;R&   S[S[,          ;R&   S[R,          ;R&   S[R,          ;R&   # )r   Úcontext_typer=   NÚmetadataÚtidr@   )r   rD   rC   rE   )r   rF   s   "€r   r   ÚContextStackEntry.__annotate__7   sK   ø‡ ‚ ñ Ð,Õ-Ñ-ñ	 ñ
 ‘c•	Ññ ñ �T�kÑñ ñ 
ˆt�Ñò r   r   )	rH   rI   rJ   rK   rL   rV   rM   rN   rO   rP   s   @r   rR   rR   7   s   ø‡ € á?ð
 €C÷ ƒ r   rR   c           
     óh  a€ ^ RI Hp V P                  R. 4      p. oR pV3R lpV FŽ  pRV9  g   RV9  d   K  V! V4      '       dG   VR,          ^R pVP                  R4      '       d   V! R	We4       KO   \	        V4      pV! R
XV4       Kg  VR,          pSP                  \        VRRRV4      4       K�  	  SP                  R R7       . p	S EFK  p
V
P                  ;R8X  Ed¸    V
P                  f   \        R4      hV
P                  R	8X  dª   \        V
P                  \        4      '       g,   \        R\        V
P                  4      P                    24      hVP                  V
P                  4      pV
P"                  P                  R4      pV	P                  \%        R	V
P                  W¼4      4       Kë  V
P                  R
8X  dÐ   RpV
P"                  P                  R4      p\'        V	4       F5  pVP(                  R	8X  g   K  VP*                  V8X  g   K)  VP,                  p M	  V'       dd   VP                  R/ 4      pV
P                  V9   d>   VV
P                  ,          pV	P                  \%        R
V
P                  VV4      4       EKÅ  EKÈ  EKË  EKÎ  ;R8X  d    \/        \1        V	4      ^,
          RR4       FY  pV	V,          pV
P                  VP(                  8X  g   K)  V
P                  VP                  8X  g   KF  V	P3                  V4        EKN  	  EKS  R8X  g   EK\  RpRpV
P"                  P                  R4      p\'        V	4       Fu  pVP*                  V8X  g   K  VP(                  R
8X  g   K)  VP,                  '       g   K=  VP,                  P                  RR4      pVP,                  P                  RR4      p M	  V'       g	   V'       d=   V
P"                  P5                  R/ 4      pV'       d   VVR&   V'       d	   VVR&   EKH  EKK  EKN  	  R#   \
         d     EL®i ; i)aF  
Maps recorded profiler events to their corresponding fx nodes and adds stack traces.

Builds a timeline of all events (regular ops and FX markers for filenames/nodes),
sorts by timestamp, then processes chronologically while maintaining a context stack of active
filename/node scopes. Regular events are augmented with stack traces and node names from the
innermost active context. Runtime is O(n log n) for n events.

Args:
    traced_data: Json of profiler events from Chrome trace

Returns:
    Dict mapping recorded event names to their aten operations with added stack traces
)Ú_FX_METADATA_REGISTRYÚtraceEventsc                 óÎ   € V P                  R 4      R8H  ;'       dK    V P                  RR4      P                  R4      ;'       d"    V P                  RR4      P                  R4      # )ÚcatÚcpu_opÚnameÚ z## z ##)ÚgetÚ
startswithÚendswith)r>   s   &r   Úis_fx_marker_eventÚLmap_recorded_events_to_aten_ops_with_stack_trace.<locals>.is_fx_marker_eventW   s^   € à�I‰I�eÓ Ñ(÷ 6ð 6Ø—	‘	˜& "Ó%×0Ñ0°Ó7÷6ð 6à—	‘	˜& "Ó%×.Ñ.¨uÓ5ð	
r   c           	      ó¬   <€ VR ,          pW2R,          ,           pSP                  \        VRWV4      4       SP                  \        VRWV4      4       R# )ÚtsÚdurr,   r-   N)r   r8   )r;   r=   r>   Ústart_tsÚend_tsÚevent_timelines   &&&  €r   Úappend_fx_marker_eventÚPmap_recorded_events_to_aten_ops_with_stack_trace.<locals>.append_fx_marker_event^   sR   ø€ Ø˜•;ˆØ %�LÕ(ˆØ×ÑÜ˜( G¨ZÀUÓKô	
ð 	×ÑÜ˜& %¨ÀÓGö	
r   rf   rg   r^   z.pyrA   rB   r?   Nc                 ó   € V P                   # r   )r:   r
   s   &r   r   ÚBmap_recorded_events_to_aten_ops_with_stack_trace.<locals>.<lambda>~   s   €  a§k¢kr   )Úkeyr,   z+identifier must not be None for start eventz0identifier must be str for filename marker, got rV   Únode_metadatar-   Ústack_tracezNo model stack trace availabler_   ÚargsÚ	node_nameéýÿÿÿéÿÿÿÿ)Útorch.fx.tracebackrY   r`   rb   rC   Ú
ValueErrorr   r8   Úsortr;   r=   ÚAssertionErrorr<   Ú
isinstancerD   ÚtyperH   r>   rR   r   rT   rV   rU   r)   r(   r$   Ú
setdefault)Útraced_datarY   Útrace_eventsrc   rk   r>   ÚcontentÚ
node_indexrh   Úcontext_stackÚtimeline_eventrU   rV   Úcurrent_file_metadataÚ	ctx_entryrp   Ú	node_metar.   Úcurrent_stack_traceÚcurrent_node_nameÚ	event_tidrr   rj   s   &                     @r   Ú0map_recorded_events_to_aten_ops_with_stack_tracer‰   A   sÛ  ø€ õ 9à—?‘? =°"Ó5€Lð +-€Nò
õ
ó ˆØ�uÔ ¨UÔ 2Ùá˜e×$Ò$Ø˜F•m A bÐ)ˆGà×Ñ ×&Ò&Ù& z°7ÖBðÜ!$ W£�Jñ ' v¨z¸5ÖAð ˜T•{ˆHØ×!Ñ!¤-°¸)ÀTÈ4ÐQVÓ"WÖXñ' ð, ×ÑÑ1ÐÔ2ð .0€Mô )ˆØ×'Ñ'ßÙ!×,Ñ,Ò4Ü(Ð)VÓWÐWà!×-Ñ-°Ô;Ü% n×&?Ñ&?Ä×EÒEÜ,ð#Ü#'¨×(AÑ(AÓ#B×#KÑ#KÐ"LðNóð ð
  5×8Ñ8¸×9RÑ9RÓS�HØ(×.Ñ.×2Ñ2°5Ó9�CØ!×(Ñ(Ü)Ø&¨×(AÑ(AÀ8óöð
 $×/Ñ/°6Ô9à,0Ð)Ø(×.Ñ.×2Ñ2°5Ó9�CÜ%-¨mÖ%<˜	à%×2Ñ2°jÖ@Ø )§¡°Ö 4à4=×4FÑ4FÐ1Ù!ñ &=÷ -Ø(=×(AÑ(AÀ/ÐSUÓ(V˜Ø)×4Ñ4¸ÔEØ5BØ .× 9Ñ 9õ6˜Ið *×0Ñ0Ü 1Ø$*¨N×,EÑ,EÀyÐRUó!"÷ò	 Fò -ò :ö0 åœs =Ó1°AÕ5°r¸2Ö>�AØ -¨aÕ 0�Ià&×2Ñ2°i×6LÑ6LÖLØ*×5Ñ5¸×9MÑ9MÖMà%×)Ñ)¨!Ô,Ûô ?÷ �ð '+Ð#Ø$(Ð!Ø*×0Ñ0×4Ñ4°UÓ;�	ä!)¨-Ö!8�Ià —}‘}¨	Ö1Ø$×1Ñ1°VÖ;À	×@R×@RÒ@RØ2;×2DÑ2D×2HÑ2HØ -Ð/Oó3Ð/ð 1:×0BÑ0B×0FÑ0FÀvÈrÓ0RÐ-ñ "ñ "9÷ '×*;Ø)×/Ñ/×:Ñ:¸6À2ÓF�Dß*Ø.A˜˜]Ñ+ß(Ø,=˜˜[Ô)ò )ò	 +<óY )øô! "ô Úðús   Á7P"Ð"P1Ð0P1)r   N)Ú	functoolsÚcollectionsr   Údataclassesr   Útypingr   r   r"   ÚpartialÚtraverse_dfsÚtraverse_bfsr/   r6   r8   rR   r‰   r   r   r   Ú<module>r‘      sŽ   ðã Ý Ý !ß ñ *>Èu÷ *ð × Ò  Ñ4EÈtÔT€Ø× Ò ØÑ,°eô€ô
õð ÷ð ó ðð ÷ð ó ðôT>r   