+
    \åûj¨,  ã                   ód  € ^ RI t ^ RIt^ RIHt ^ RIHt ^ RIHt ^ RIH	t	 ^ RI
Ht ^ RIHt ^ RIHt ^ RIHt ]P$                  ! ]4      t]P+                  ]P,                  4       . ROt]! R
R7      R R l4       tR R ltR R lt]! R
R7      R R l4       t]! R
R7       ! R R	4      4       tR# )é    N)ÚCallable)Úwraps)ÚQueue)ÚAny)Úcompatibility)ÚGraphModule)Ú
PassResultÚPassManagerF)Úis_backward_compatiblec                ór   € V ^8„  d   QhR\         R\        3,          R\         R\        R,          3,          /# )é   Úfn.ÚreturnN)r   r   r	   )Úformats   "Ú^C:\Ai_Coding\apps\studio\ComfyUI\.venv\Lib\site-packages\torch\fx\passes\infra\pass_manager.pyÚ__annotate__r      s2   € ÷ ñ œH S¬# XÕ.ð ´8¸CÄÈdÕARÐ<RÕ3Sñ ó    c                ó®   a € S f   R# \        S 4      R V 3R ll4       p\        P                  ! S 4      '       g   \        S 4      P                  Vn        V# )a  
Wrapper for passes which currently do not return a PassResult.
This wrapper makes them return a PassResult containing the modified object
and True for the "modified" flag.

Args:
    fn (Callable[Module, Any])

Returns:
    wrapped_fn (Callable[Module, PassResult])
Nc                óR   € V ^8„  d   QhR\         P                  R\        R,          /# )r   Úgmr   N©ÚnnÚModuler	   )r   s   "r   r   Ú)pass_result_wrapper.<locals>.__annotate__&   s#   € ÷ )ñ )”r—y‘yð )¤Z°$Õ%6ñ )r   c                 óÀ   <€ S! V 4      pVf   \        V R4      # \        V\         4      '       d   V# \        V\        P                  4      '       d   \        VR4      # R # )NT)r	   Ú
isinstancer   r   )r   Úresr   s   & €r   Ú
wrapped_fnÚ'pass_result_wrapper.<locals>.wrapped_fn%   sS   ø€ á�‹fˆØŠ;Ü˜b $Ó'Ð'Ü�cœ:×&Ò&ØˆJÜ˜œRŸY™Y×'Ò'Ü˜c 4Ó(Ð(ñ (r   )r   ÚinspectÚ
isfunctionÚtypeÚ__name__)r   r   s   f r   Úpass_result_wrapperr$      sN   ø€ ð 
‚záä
ˆ2ƒY÷)ó ð)ô ×Ò˜b×!Ò!Ü" 2›h×/Ñ/ˆ
ÔàÐr   c                óÆ   € V ^8„  d   QhR\         \         R\        3,          \         R\        3,          .\        3,          R\        \         R\        3,          ,          RR/# )r   Ú
constraint.Úpassesr   N)r   r   ÚboolÚlist)r   s   "r   r   r   5   sU   € ÷ ñ Üœ( 3¬ 8Õ,¬h°s¼C°xÕ.@ÐAÄ4ÐGÕHðä”˜#œs˜(Õ#Õ$ðð 
ñr   c                 óÀ   € \        V4       FN  w  r#\        W^,           R 4       F1  w  rEV ! W54      '       d   K  \        RV RV RV RV RV RV R24      h	  KP  	  R# )é   Nz,pass schedule constraint violated. Expected z before z but found z
 at index z and z in pass list.)Ú	enumerateÚRuntimeError)r&   r'   ÚiÚaÚjÚbs   &&    r   Ú"_validate_pass_schedule_constraintr2   5   sz   € ô ˜&Ö!‰ˆÜ˜f¨¥U W˜oÖ.‰DˆAÙ˜!×ÒÙÜØ>¸q¸cÀÈ!ÈØ˜a˜S 
¨1¨#¨U°1°#°ZÀ¸sð Cðóð ó /ó "r   c          	      óÌ   € V ^8„  d   QhR\         \        R\        3,          ,          R\         \        R\        3,          ,          R\         \        R\        3,          ,          /# )r   r'   .Úconstraintsr   )r)   r   r   )r   s   "r   r   r   D   sN   € ÷ 6ñ 6Ü”˜#œs˜(Õ#Õ$ð6Ü37¼ÀÄcÀÕ8JÕ3Kð6ä	Œ(�3œ�8Õ
Õñ6r   c                óz  a€ \        V4      ^ 8X  d   V # V  Uu/ uF  q". bK  	  pp\        P                  V ^ 4      o\        4       pV  Fz  pV  FP  pWV8X  d   K  V F?  pV! WV4      '       d   K  W6,          P	                  V4       SV;;,          ^,          uu&   KA  	  KR  	  SV,          ^ 8X  g   Ki  VP                  V4       K|  	  \        P                  V R4      p. p	VP                  4       '       g}   VP                  4       pV	P	                  V4       RW‚&   W2,           FI  p
WŠ,          '       d   K  SV
;;,          ^,          uu&   SV
,          ^ 8X  g   K8  VP                  V
4       KK  	  K’  \        \        V3R lSP                  4       4      4      p\        V4      ^ 8w  d   RV 2p\        V4      hV	# u upi )zÁ
Args
    passes: Passes that we are ordering
    constraints: Constraints applied on these passes

Returns
    A sorted list of callables and a boolean of if a circular dependency
    existed
FTc                 ó   <€ SV ,          ^ 8g  # )r   © )ÚpÚindegree_maps   &€r   Ú<lambda>Ú*_topological_sort_passes.<locals>.<lambda>s   s   ø€ ¨°a­¸AÒ)=r   z:Circular dependency detected within the following passes: )ÚlenÚdictÚfromkeysr   ÚappendÚputÚemptyÚgetr)   ÚfilterÚkeysr-   )r'   r4   r8   ÚgraphÚ
candidatesr/   r1   r&   ÚvisitedÚsorted_passesÚnÚcycle_passesÚerrorr9   s   &&           @r   Ú_topological_sort_passesrL   D   s‡  ø€ ô ˆ;Ó˜1ÔØˆñ QWÓ@WÑPVÈ1ÀBÂÑPV€EÐ@WÜ26·-±-ÀÈÓ2J€LÜ,1«G€JÛˆÛˆAØŒvÙã)�
Ù! !×'Ô'Ø•H—O‘O AÔ&Ø  —O qÕ(•Oó *ñ	 ð ˜�?˜aÖØ�N‰N˜1Öñ ô /3¯m©m¸FÀEÓ.J€GØ.0€Mà×Ñ× Ò Ø�N‰NÓˆØ×Ñ˜QÔØˆ‰
à—�ˆAØ—:–:Ø˜Q— 1Õ$“Ø •? aÖ'Ø—N‘N 1Ö%ó	 ô œÔ=¸|×?PÑ?PÓ?RÓSÓT€LÜ
ˆ<Ó˜AÔàHÈÈÐWð 	ô ˜5Ó!Ð!àÐùòM AXs   ˜F8c          
      óÒ   € V ^8„  d   QhR\         R\        3,          R\         R\        3,          R\         \         R\        3,          \         R\        3,          .\        3,          /# )r   Úthis.Úthatr   ©r   r   r(   )r   s   "r   r   r   ~   sW   € ÷ ñ Ü
�3œ�8Õ
ðÜ$,¨S´#¨XÕ$6ðäŒx˜œS˜Õ!¤8¨C´¨HÕ#5Ð6¼Ð<Õ=ñr   c                ó   a a€ R VV 3R llpV# )a·  
Defines a partial order ('depends on' function) where ``this`` must occur
before ``that``.

For example, the following pass list and constraint list would be invalid::

    passes = [pass_b, pass_a]

    constraints = [this_before_that_pass_constraint(pass_a, pass_b)]

Args:
    this (Callable): pass which should occur first
    that (Callable): pass which should occur later

Returns:
    depends_on (Callable[[Object, Object], bool])
c                óp   € V ^8„  d   QhR\         R\        3,          R\         R\        3,          R\        /# )r   r/   .r1   r   rP   )r   s   "r   r   Ú6this_before_that_pass_constraint.<locals>.__annotate__“   s3   € ÷ &ñ &”h˜s¤C˜xÕ(ð &¬X°c¼3°hÕ-?ð &ÄDñ &r   c                 ó(   <€ V S8g  ;'       g    VS8g  # ©Nr7   )r/   r1   rO   rN   s   &&€€r   Ú
depends_onÚ4this_before_that_pass_constraint.<locals>.depends_on“   s   ø€ Ø�D‰y×%Ð%˜A ™IÐ%r   r7   )rN   rO   rV   s   ff r   Ú this_before_that_pass_constraintrX   }   s   ù€ ÷,&ñ &ð Ðr   c                   óÌ   a € ] tR t^™t o RtRt^tRV 3R lR lltV 3R lR ltV 3R lR	 lt	V 3R
 lR lt
V 3R lR ltV 3R lR ltV 3R lR ltV 3R lR ltV 3R ltRtV tR# )r
   a$  
Construct a PassManager.

Collects passes and constraints. This defines the pass schedule, manages
pass constraints and pass execution.

Args:
    passes (Optional[List[Callable]]): List of passes. A pass is a
        callable which modifies an object and returns a PassResult
    constraint (Optional[List[Callable]]): List of constraints. A
        constraint is a callable which takes two passes (A, B) and returns
        True if A depends on B and False otherwise. See implementation of
        `this_before_that_pass_constraint` for example.
    steps (int): Max number of times we run the passes (default = 1).
    run_checks_after_each_pass (bool): Whether to run checks and linting
        after each pass
    suppress_check_failures (bool): Whether to raise errors when running
        checks
FNc                óì   <€ V ^8„  d   QhRS[ S[RS[R,          3,          ,          R,          RS[ S[S[RS[3,          S[RS[3,          .S[3,          ,          R,          RS[R,          RS[RS[RR/# )	r   r'   .Nr4   ÚstepsÚrun_checks_after_each_passÚsuppress_check_failuresr   ©r)   r   r	   r   r(   Úint)r   Ú__classdict__s   "€r   r   ÚPassManager.__annotate__´   s’   ø€ ÷ ?ñ ?á‘X˜c¡:°Õ#4Ð4Õ5Õ6¸Õ=ð?ñ ™(¡H¨S±#¨XÕ$6¹ÀÁcÀÕ8JÐ#KÉTÐ#QÕRÕSØ
õð?ñ
 �T�zð?ñ %)ð?ñ "&ð?ð 
ñ?r   c                ó~   € T;'       g    . V n         T;'       g    . V n        V'       d   W0n        W@n        WPn        R # rU   )r'   r4   r[   r\   r]   )Úselfr'   r4   r[   r\   r]   s   &&&&&&r   Ú__init__ÚPassManager.__init__´   s5   € ð —l�l ˆŒØ&×,Ð,¨"ˆÔßØŒJà*DÔ'Ø'>Ö$r   c                óF   <€ V ^8„  d   QhRS[ RS[R,          3,          RR/# )r   Ú_pass.Nr   )r   r	   )r   r`   s   "€r   r   ra   Å   s*   ø€ ÷  ñ  ™h s©J¸Õ,=Ð'=Õ>ð  À4ñ  r   c                óJ   € V P                   P                  V4       RV n        R# )z.
Adds a pass into the current list of passes.
FN)r'   r?   Ú
_validated)rc   rg   s   &&r   Úadd_passÚPassManager.add_passÅ   s   € ð 	�‰×Ñ˜5Ô!ØˆŽr   c                óh   <€ V ^8„  d   QhRS[ S[ RS[3,          S[ RS[3,          .S[3,          RR/# )r   r&   .r   NrP   )r   r`   s   "€r   r   ra   Ì   s>   ø€ ÷  ñ  Ù"¡H¨S±#¨XÕ$6¹ÀÁcÀÕ8JÐ#KÉTÐ#QÕRð à	ñ r   c                óJ   € V P                   P                  V4       RV n        R# )z9
Adds a constraint into the current list of constraints.
FN)r4   r?   ri   ©rc   r&   s   &&r   Úadd_constraintÚPassManager.add_constraintÌ   s   € ð 	×Ñ×Ñ 
Ô+ØˆŽr   c                ó   <€ V ^8„  d   QhRR/# ©r   r   Nr7   )r   r`   s   "€r   r   ra   Õ   s   ø€ ÷ 	ñ 	 dñ 	r   c                óŒ   € V P                   '       d   R# V P                   F  p\        WP                  4       K  	  RV n         R# )z{
Validates that current pass schedule defined by `self.passes` is valid
according to all constraints in `self.constraints`
NT)ri   r4   r2   r'   rn   s   & r   Úvalidate_constraintsÚ PassManager.validate_constraintsÕ   s3   € ð
 �?�?ˆ?ÙØ×*Ô*ˆJÜ.¨z¿;¹;ÖGñ +àˆŽr   c                ó   <€ V ^8„  d   QhRR/# rr   r7   )r   r`   s   "€r   r   ra   à   s   ø€ ÷ 
ñ 
 4ñ 
r   c                ó^   € \        V P                  V P                  4      V n        RV n        R# )a2  
Finds a valid traversal order based on the given constraints and orders
the passes based on this order.

If a circular dependency exists between the constraints and steps = 1,
then we will raise an error because if steps != 1 this means that we
will re-run the passes, allowing for circular dependencies.
TN)rL   r'   r4   ri   )rc   s   &r   Úsolve_constraintsÚPassManager.solve_constraintsà   s#   € ô /¨t¯{©{¸D×<LÑ<LÓMˆŒØˆŽr   c                óN   <€ V ^8„  d   QhRS[ S[P                  .R3,          RR/# )r   ÚcheckNr   )r   r   r   )r   r`   s   "€r   r   ra   ì   s+   ø€ ÷ &ñ &¡©"¯)©)¨°dÐ):Õ ;ð &Àñ &r   c                óÄ   € \         P                  ! V4      p\        \        VP                  P                  4       4      4      ^8w  d   \        R4      h\        V RV4       R# )z¯
Adds a function which takes runs various checks on a given graph module.
This function is run before and after each pass if the
`run_checks_after_each_pass` flag is enabled.
zEPassManager check function should only take in one variable, a moduler{   N)r    Ú	signaturer<   r)   Ú
parametersÚvaluesÚ	TypeErrorÚsetattr)rc   r{   Úsigs   && r   Ú
add_checksÚPassManager.add_checksì   sQ   € ô ×Ò Ó&ˆäŒt�C—N‘N×)Ñ)Ó+Ó,Ó-°Ô2ÜØWóð ô 	��g˜uÖ%r   c                ó8   <€ V ^8„  d   QhRS[ P                  RR/# )r   Úmoduler   N)r   r   )r   r`   s   "€r   r   ra   û   s   ø€ ÷ ñ ™BŸI™Ið ¨$ñ r   c                ó   € R # rU   r7   )rc   r†   s   &&r   r{   ÚPassManager.checkû   s   € Ùr   c                ó:   <€ V ^8„  d   QhRS[ P                  RS[/# )r   r†   r   r   )r   r`   s   "€r   r   ra   þ   s   ø€ ÷ ?4ñ ?4™rŸy™yð ?4©Zñ ?4r   c           	     óŠ  € V P                   '       g   V P                  4        V P                  V4       Rp\        V P                  4       EFd  pRp\        V P                  4       EF.  w  rV\        P                  ! V4      '       d   VP                  M\        V4      P                  p\        P                  RV4        V! V4      p\        V\        4      '       g)   \        VR4      '       g   \!        RV R2R,           4      hVP"                  pT;'       g    VP$                  p\        V\&        4      '       d1   \        P                  RWqP(                  4       VP+                  4        V P,                  '       d   V P                  V4       EK.  EK1  	  T;'       g    TpV'       d   EKe   M	  \        W4      #   \.         dy   p	T P                  RT  U
u. uF@  p
\        P                  ! T
4      '       d   T
P                  M\        T
4      P                  NKB  	  Mu up
i pp
R	T R
T 2p\/        T4      T	hRp	?	ii ; i)aM  
Runs a list of passes in the order based on `self.passes` on the given
graph module. Each time a pass is run, checks and linting will be run on
the graph module if `run_checks_after_each_pass` is set.

If the module is a graph module, we will run the list of passes until
the graph stops changing, or until `steps` number of times.
FzRunning pass '%s'Úgraph_modulezThe result of the pass z should be type PassResult.z)Please wrap it with pass_result_wrapper()zGraph after pass '%s': %sNz$An error occurred when running the 'z#' pass after the following passes: )ri   rx   r{   Úranger[   r,   r'   r    r!   r#   r"   ÚloggerÚdebugr   r	   Úhasattrr€   r‹   Úmodifiedr   rE   Ú	recompiler\   Ú	Exception)rc   r†   Úoverall_modifiedÚ_r�   r.   r   Úfn_namer   Úer8   Úprev_pass_namesÚmsgs   &&           r   Ú__call__ÚPassManager.__call__þ   sý  € ð ��ˆØ×"Ñ"Ô$ð 	�
‰
�6Ôð !ÐÜ�t—z‘z×"ˆAØˆHô # 4§;¡;×/‘�Ü)0×);Ò);¸B×)?Ò)?˜"Ÿ+š+ÄTÈ"ÃX×EVÑEV�Ü—‘Ð0°'Ô:ð0Ù˜V›*�Cä% c¬:×6Ò6¼wØ˜^÷@ò @ô (Ø5°g°YÐ>YÐZØIõJóð ð
 !×-Ñ-�Fà'×7Ð7¨3¯<©<�Hä! &¬+×6Ò6ÜŸ™Ð%@À'Ï<É<ÔXØ×(Ñ(Ô*ð ×6×6Ð6ØŸ
™
 6×*ò 7ñ1 0ðH  0×;Ð;°8Ðß’8ÙñU #ôX ˜&Ó3Ð3øô !ô 0ð "&§¡¨R¨a¡ó'á!0˜Aô '.×&8Ò&8¸×&;Ò&;˜Ÿ
š
ÄÀaÃ×AQÑAQÒQÚ!0ùò'�Oð 'ð AÀÀ	ÐIlÐm|Ðl}Ð~�CÜ# C›.¨aÐ/ûð0ús8   Ã AF?ÄA$F?Æ F?Æ?IÇ
H=Ç H"
Ç<%H"
È!H=È=Ic                óÐ   <€ V ^8„  d   Qh/ S[ S[RS[R,          3,          ,          ;R&   S[ S[S[RS[3,          S[RS[3,          .S[3,          ,          ;R&   S[;R&   S[;R&   # )r   .Nr'   r4   ri   r[   r^   )r   r`   s   "€r   r   ra   ™   sr   ø‡ ‚ ñ, ‘˜#™z¨DÕ0Ð0Õ1Õ2Ñ2ñ- ñ. ‘h¡¨©c¨Õ 2±H¸SÁ#¸XÕ4FÐGÉÐMÕNÕOÑOñ/ ñ0 Ññ1 ñ2 �Nò3 r   )ri   r4   r'   r\   r[   r]   )NNNFF)r#   Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__ri   r[   rd   rj   ro   rt   rx   rƒ   r{   r™   Ú__annotate_func__Ú__static_attributes__Ú__classdictcell__)r`   s   @r   r
   r
   ™   sn   ø‡ € ñð, €JØ€E÷?ò ?÷" ð  ÷ ð  ÷	ð 	÷
ð 
÷&ð &÷ð ÷?4ð ?4÷K ƒ r   )r$   rX   r
   )r    ÚloggingÚcollections.abcr   Ú	functoolsr   Úqueuer   Útypingr   Útorch.nnr   Útorch.fx._compatibilityr   Útorch.fx.graph_moduler   Útorch.fx.passes.infra.pass_baser	   Ú	getLoggerr#   r�   ÚsetLevelÚWARNINGÚ__all__r$   r2   rL   rX   r
   r7   r   r   Ú<module>r°      s©   ðÛ Û Ý $Ý Ý Ý å Ý 1Ý -Ý 6ð 
×	Ò	˜8Ó	$€Ø ‡��—‘Ô  â
T€ñ  eÔ,ôó -ðõ@õ6ñr  eÔ,ôó -ðñ6  eÔ,÷c4ð c4ó -òc4r   