
    Vh~                       d dl mZ d dlZd dlZd dlZd dlZd dlmZ d dlm	Z	m
Z
 d dlZd dlmZ d dlmZ ddlmZmZ dd	lmZ dd
lmZmZmZmZmZmZmZ  ej:                  e      Zej@                  jC                  ed      Z"e
rddl#m$Z$ ddZ%ddZ&	 	 	 	 ddZ'	 	 	 	 	 	 	 	 	 	 ddZ(	 	 	 	 ddZ)ddZ*d Z+d Z,	 	 	 	 ddZ-ddZ.ddZ/d Z0	 	 	 	 	 	 	 	 d dZ1y)!    )annotationsN)defaultdict)AnyTYPE_CHECKING)StorageWeakRef)
OrderedSet   )configir)WeakDep)contains_collectivecontains_waitfind_recursive_deps_of_nodefind_recursive_users_of_nodeis_collectiveis_fallback_opis_waitoverlap)BaseSchedulerNodec                     t        | ddd      S )z7
    Greedily schedules waits as late as possible.
    FTraise_comms
sink_waitsreorder_for_overlap_schedule_for_commsnodess    E/home/dcms/DCMS/lib/python3.12/site-packages/torch/_inductor/comms.pyr   r   $   s     Ed     c                     t        | ddd      S )z8
    Greedily schedules comms as early as possible.
    TFr   r   r   s    r   r   r   -   s     DU r    c                     t        | ddd      S )a  
    This achieves the following overall scheduling procedure:
        Step 1: Given that we've currently scheduled comm N, we now schedule all compute nodes
            that are required for comm N + 1 but do not depend on comm N, to run at the same time with comm N.
        Step 2: If all those compute nodes are sufficient to overlap comm N, we're done.
            Otherwise, we now need to look elsewhere to find compute that overlaps with comm N.
            We prioritize compute nodes that are needed sooner.
        Step 3: We schedule the compute nodes dependent on comm N and required for comm N + 1.
        Step 4: We schedule comm N + 1.
        Repeat this for subsequent comm nodes.
    Tr   r   r   s    r   reorder_compute_for_overlapr#   6   s     DTt r    c                    i }i i i i ct        |       D ]y  \  }}|j                         D ]  }|||<   	 |j                         D ]  }||<   	 ||j                         <   |j                         }	t        j
                  |	<   d|	<   ||	<   { d}
| D ]  }|rZt        |      rO|
|j                         <   |j                  D ]'  }|   j                         }t        |   |
      |<   ) |
dz  }
_|sbt        |      snd|j                         <     G fdd      | D ci c]  }|t        d |j                  D              ! c}g t        t              | D ci c]  }|t        |       c}j                         D ]J  \  }}t        |      dk(  rt!        j"                   |             |D ]  }|   j%                  |        L g fdfdfd}t              rIt!        j&                        j(                  }|rt        |      r	 ||       n |       t              rIj                         D ]  \  }}t        |      dk(  rJ d	         S c c}w c c}w )
a  
    Schedule `snodes` for various comm optimization objectives.

    Args:
        snodes: the nodes to be scheduled.
        raise_comms: whether to greedily schedule collectives as early as possible
        sink_wait: whether to greedily schedule waits as late as possible
        reorder_compute_for_overlap: whether to reorder compute nodes to
            optimize for compute/communication overlapping.

    Returns:
        The new schedule order.

    Some notes on the synergy between different options:
        - `raise_comms` provides more overlapping oppurtunies for `reorder_compute_for_overlap`.
        - When both `raise_comms` and `sink_waits` is `True`, `raise_comms` is prioritized.
    r   r	   c                  &    e Zd Zd fdZd Zy)$_schedule_for_comm.<locals>.Runnablec                    || _         t        t        |j                                     }|   j	                         }|   |   |   f| _        y N)snodenextiterget_operation_namesget_namescore)selfr)   name
fused_namename_to_fused_nodescores_0scores_1scores_2s       r   __init__z-_schedule_for_comm.<locals>.Runnable.__init__   sV    DJU6689:D+D1::<J$$$DJr    c                4    | j                   |j                   k  S r(   r.   )r/   others     r   __lt__z+_schedule_for_comm.<locals>.Runnable.__lt__   s    ::++r    N)returnNone)__name__
__module____qualname__r6   r:   )r2   r3   r4   r5   s   r   Runnabler&      s    	 		,r    r@   c              3  4   K   | ]  }|j                     y wr(   )r0   ).0deps     r   	<genexpr>z%_schedule_for_comm.<locals>.<genexpr>   s     Gs#((Gs   c                    j                  |        | j                         D ]N  }|   D ]D  } |    j                  |       t        |          dk(  s)t	        j
                   |              F P y)zU
        Schedules `snode` and put all unblocked nodes onto the ready queue.
        r   N)appendget_buffer_namesremovelenheapqheappush)r)   buf_namer@   buffer_usersready	scheduled
unmet_depss     r   schedulez$_schedule_for_comm.<locals>.schedule   sv     	..0 	;H%h/ ;5!((2z%()Q.NN5(5/:;	;r    c                     D  cg c].  } t        | j                        st        | j                        s| 0 }} t        |      dk(  ryt	        |d       S c c} w )zh
        Return the next node in the ready queue that's neither a collective or
        a wait.
        r   Nc                    | j                   S r(   r8   xs    r   <lambda>zG_schedule_for_comm.<locals>.get_overlapping_candidate.<locals>.<lambda>   s
    QWW r    key)r   r)   r   rI   min)rU   
candidatesrN   s     r   get_overlapping_candidatez5_schedule_for_comm.<locals>.get_overlapping_candidate   s]     
&qww/agg8N 

 

 z?a:#455
s   3Ac                   t        |       sJ  |        |    }|dkD  rM        x}Dj                  |        |j                         ||j                     z  }|dkD  r
        x}Dt        j                         y)z
        Schedules collective node `snode`, along with one or more compute nodes
        to overlap with it. The strategy is described in the comment of
        `reorder_compute_for_overlap`.
        r   N)r   rH   r)   rJ   heapify)r)   collective_cost	candidater[   rN   rQ   snode_to_costs      r   schedule_collective_for_overlapz;_schedule_for_comm.<locals>.schedule_collective_for_overlap   s     #5)))'.a799FLL#Y__%}Y__==O a799F
 	er    z;Detected unscheduled nodes. Nodes with unmet dependencies: )	enumeraterG   r,   r-   sysmaxsizer   	ancestorsrY   r   r   unmet_dependenciesr   estimate_op_runtimeitemsrI   rJ   rK   addheappopr)   )r   r   r   r   buf_name_to_snodeidxr)   rL   op_name	node_namecomm_idxancanc_fused_namedepsrC   ra   r@   rM   r[   r2   rN   rQ   rO   r3   r4   r5   r`   rP   s                   @@@@@@@@@@@@r   r   r   I   s   L #%r2 Hh' "
U..0 	0H*/h'	0 002 	0G*/w'	0/45>>+,NN$	!kk!" H +.u5)1HU^^%& S!3C!8!A!A!C+.x/G+R(S MHM%0)*HU^^%&+, ,  < 	zGe.F.FGGG<J
 E=H=TLDJK5U/66KM!'') )tt9>NN5(5/2 	)C!!%(	)) I	; 	;6& e*e$**#6u#=+E2UO e* "'') 
t4yA~ 	
I*V	
~
 Q< Ls   9$J5Jc                x   t         j                  j                         s| S | D cg c]  }t        |      s| }}t	        dt        |            D ]a  }t        t        ||   j                                     }||dz
     j                         D ]!  }||   j                  t        ||             # c | S c c}w )z
    Decide global ordering of comms, by just enforcing the ordering that's in the input graph
    (might not be the same ordering as the eager mode program).
    TODO: Come up with a better approach
    r	   mutating_buf)torchdistributedis_availabler   rangerI   r*   r+   rG   add_fake_depr   )nodesname_to_bufr2   n
comm_nodesiru   bufs           r   decide_global_ordering_of_commsr      s     ))+"=&9!&<!=J=1c*o& PDA!?!?!ABCa!e$557 	PCqM&&ws'NO	PP L >s
   B7B7c                    t         j                  dk(  r| j                         }|S t        t         j                        sJ t        j                  |       }|S )z:
    Returns estimated op runtime in nanoseconds (ns)
    default)r
   rg   get_estimated_runtimecallable)r)   runtimes     r   rg   rg      sR     !!Y.--/ N 22333,,U3Nr    c                   d}t        | j                  t        j                        rd| j                  j                   d}d}| j                  j                         }t        |t        j                        rd|j                   d|j                   d}| j                  j                         xs d}| j                  j                  j                   | | d| dS )N z ()z (size=z	, stride=)
isinstancenoder   ExternKernelOutpython_kernel_nameget_output_specLayoutsizestridemaybe_get_name	__class__r=   )r)   detailout_tensor_infolayoutrn   s        r   node_summaryr     s    F%**b001ejj334A6OZZ'')F&"))$#FKK=	&--J

))+1rIjj""++,VH_4ER	{RSTTr    c                   d}d }| D ]  }|tt        |      r|t        |      z  }|j                  }n.t        |j                        rt	        d      |t        |      z  }t
        j                  t        |              yt        |      rt	        d      t        |j                        r"t
        j                  t        |              d }t
        j                  dt        |               t
        j                  d|dz  dz          y )Ng        z8Wait is not expected when there is no collective runningzkFound two collectives running at the same time. `visualize_overlap` needs to be updated to handle this casez| zEst. runtime (ms): i  )r   rg   r   r   AssertionErroroverlap_logdebugr   )ordertotal_est_runtimecur_comm_noder)   s       r   visualize_overlapr     s   "M > "5)!%8%??! %

$$N  "%8%??!e!4 57"5)$R  $!!\%%8$9; $!!B|E':&;"<=->. 
/$6=>?r    c                   | }t         j                  D ]  }t        |t              r|t	               v rt	               |   }t
        j                  j                         dk(  r%t        j                  d| d       	 t        |        ||      }t
        j                  j                         dk(  st        j                  d| d       	 t        |        |S # t        $ r(}t        j                  t        |             Y d }~d }~ww xY w# t        $ r)}t        j                  t        |             Y d }~&d }~ww xY w)Nr   z.==== Visualize overlap before reordering pass z ====z-==== Visualize overlap after reordering pass )r
   'reorder_for_compute_comm_overlap_passesr   strglobalsrv   rw   get_rankr   r   r   	Exception)r   r   pes       r   $reorder_compute_and_comm_for_overlapr   0  s    E;; *a!wy.	!A%%'1,@5I*!%( %%%'1,?s%H*!%(#*( L  *!!#a&))*  *!!#a&))*s0   :C	D	D	!DD		D>D99D>c           
        t        | j                        t        t               t        t               t              D ]  \  }}|j                  dk(  s|j
                  t        j                  j                  j                  j                  k(  sR|j                  d   j                  dk(  sJ d| d|j                  d    d       |j                  d   }|j                  d   }|dkD  r|   j                  |       |   j                  |        fd}t        t               }t              D ]  \  }}|j                  dk(  s|j
                  t        j                  j                  j                  j                  k(  sR|}|j                  d   j                  dk(  sJ d	 d
|  d        |      s|   j                  |        d }d D ]  }|j                  dk(  st        |j
                  t        j                   j"                        sB|j
                  j$                  j&                  sc ||      rl ||j)                               sJ d| d        |j+                         D ]!  \  }	t        |	      D ]  \  }
}|   }|j                  d   u sJ |j                  \  }|dz   }|
t-        |	      dz
  k  r|	|
dz      nt-              dz
  }|| }t/        fd|D              rJ d d| d|  d       |D ]  }|j                  dk(  s|j                  v s"|j
                  t        j                  j                  j                  j                  k7  s^t1        fd|j                  D              }||_          $ |j+                         D ].  \  }	t        |	      D ]  \  }
}|   }| j3                  |        0 D ]q  }|j                  dk(  s|j
                  t        j                  j                  j                  j                  k(  sO|j                  d   |v sa| j3                  |       s y)a  
    This FX graph pass replaces uses of FSDP2 unsharded params with their corresponding
    graph intermediates that were fsdp.copy_ into the unsharded params in the original graph.

    NOTE: Can only apply this pass to any of the FSDP2 unsharded params that have this pattern
    (or repetition of): `resize_(full) -> copy_ -> resize_(0)`. Because of this, for partial-graph case
    where `resize_(full) -> copy_` is in one graph and `resize_(0)` is in another graph, we can't
    remove these resize and copy ops and thus we will have worse performance there.

    In other words, "do we try to remove all the resize_(full) -> copy_ -> resize_(0) nodes for this unsharded param"
    is actually a per-unsharded-param decision, since for each unsharded param, we look at its resize sequence pattern
    (in `check_resize_pattern()`) to determine if its set of resize and copy nodes can be removed.
    call_functionr   placeholderz1Resize can only operate on graph inputs, but got z# which is resizing non-graph-input 
r	   c                l   j                  | g       }j                  | g       }t        |      t        |      k(  s2t        j                  d|  dt        |       dt        |       d       yt	        ||      D ]7  \  }}||k\  st        j                  d|  d|    d| d	|    d| d
        y y)NzH
Unequal number of resize-to-full and resize-to-0 nodes for graph input z:
z vs. zK.
Skipping `remove_fsdp2_unsharded_param_graph_input_usage` FX graph pass.
Fz
For graph input z: resize-to-full node z
 at index z 
happens after resize-to-0 node zd.
Skipping `remove_fsdp2_unsharded_param_graph_input_usage` FX graph pass for that unsharded param.
T)getrI   logwarningzip)graph_inputresized_to_full_idxesresized_to_0_idxesresize_to_full_idxresize_to_0_idx&graph_input_to_resized_to_0_node_idxes)graph_input_to_resized_to_full_node_idxes	node_lists        r   check_resize_patternzLremove_fsdp2_unsharded_param_graph_input_usage.<locals>.check_resize_patternn  s    !J M M!
 DGGUWX()S1C-DDKKHHS} U E#&8"9!: ;  47!#54
 	/ "_43I>P4Q3RR\]o\p q  )/ :;:oEV W 	 r    z\
Assumed all FSDP2 `unsharded_param`s to be graph input, but it's not true!
Offending node: z	. Graph: c                    | j                   t        j                  j                  j                  j
                  k(  xs; | j                   t        j                  j                  j                  j
                  k(  S r(   )targetrv   opsfsdpcopy_r   inductorresize_storage_bytes_)r   s    r   is_allowed_mutationzKremove_fsdp2_unsharded_param_graph_input_usage.<locals>.is_allowed_mutation  sO    KK599>>//777 O{{eii00FFNNN	
r    c           	     n   t        | j                  t        j                  j                        r^t        | j                  j                  j                        D cg c])  \  }}|j                  |j                  j                  r|+ c}}ng }t        |D cg c]5  }t        | j                  |   j                  d   j                               7 c}      }t        |D cg c](  }t        |j                  d   j                               * c}      }t        ||z        dkD  S c c}}w c c}w c c}w )Nvalr   )r   r   rv   _ops
OpOverloadrb   _schema	arguments
alias_infois_writer   r   argsmetauntyped_storagerI   )r   unsharded_paramsr   rU   mutated_arg_idxesmutated_node_arg_storagesunsharded_paramstorages_of_unsharded_paramss           r   -is_node_mutating_unsharded_param_or_its_aliaszeremove_fsdp2_unsharded_param_graph_input_usage.<locals>.is_node_mutating_unsharded_param_or_its_alias  s    $++uzz'<'<= &dkk&9&9&C&CDAq<<+0E0E   	 %/ + tyy|007GGIJ%
! (2 (8# 33E:JJLM(
$ ,/KKLqPP)s   .D':D-"-D2zdUser mutation on FSDP2 unsharded param is not allowed when Traceable FSDP2 is used. Violating node: c              3  2   K   | ]  } |g        y wr(    )rB   r   r   r   s     r   rD   zAremove_fsdp2_unsharded_param_graph_input_usage.<locals>.<genexpr>  s#       >d_DUVs   z(Assumed no ops mutating unsharded param z in subgraph z, but it's not true!
Graph: c              3  .   K   | ]  }|u rn|  y wr(   r   )rB   argreplacementr   s     r   rD   zAremove_fsdp2_unsharded_param_graph_input_usage.<locals>.<genexpr>  s%      % (+o'=3F%s   N)listr{   r   rb   opr   rv   r   r   r   r   r   rF   r   r   r   r   r   r   
is_mutablekeysrh   rI   anytuple
erase_node)graphrl   r   r   new_sizer   'unsharded_param_to_fsdp_copy_node_idxesfsdp_copy_noder   fsdp_copy_node_idxesr   fsdp_copy_node_idx_subgraph_start_idxsubgraph_end_idxsubgraph_nodesnew_argsr   r   r   r   r   r   s                    @@@@@@r   .remove_fsdp2_unsharded_param_graph_input_usager   L  s    U[[!I 1<D0A--8->*y) P	TGG&uyy11GGOOO99Q<??m3  :2267Z[_[d[def[gZh i6 3 ))A,Kyy|H!|9+FMMcR6{CJJ3OP"J /:$.?+y) 	U	T77o%$++9M9M9U9U*U!N"iilO"%%6  = !5' 29 6 $O47HOOPST	U
Q4  GG&4;;

(=(=>##..'-D=BBD eeidj k : 
1	6	6	8") 	%./C%D 	)!A!&'9:N!&&q)_<<<+00NA{!3a!7 s/0144 %QU+^a' 
 ''9:JKN *  ))8(9~FV Ww   ' 
)GG.'4994uyy'9'9'O'O'W'WW$ %#'99%  H !)DI
))	)	")P 
1	6	6	8- 	%./C%D 	-!A!&'9:N^,	-	-  #GG&uyy11GGOOO		! GGT"#r    c                  	 	 dd l 		j                  j                         sJ 	j                  j                  j
                  r 	j                  j                  j                  sJ 	 ddl
m}m}m}m}m} 	 	fd} |       } | |	j                  j                  j
                  j                    |t"        j$                   |	j                  j&                  j(                  j                    |d       |d       |d       |d       |d	       |d
       |d             |d             |d       |d            |d       d	fd       } ||        |j+                  |        y # t        t        t        f$ r Y y w xY w)Nr   r	   )CallFunction
KeywordArgMatchPatternMatcherPassregister_graph_patternc                J   t        | j                        }|D ]  }|j                  t        j                  k(  s!|j
                  d   j                  j                  j                  j                  j                  u se|j
                  d   dk(  sx| j                  |        y )Nr   r	   )r   r{   r   operatorgetitemr   r   r   all_gather_copy_inr   r   )gr   r}   rv   s      r   remove_unused_getitemz8reinplace_fsdp_all_gather.<locals>.remove_unused_getitem5  su    M	 	 AH,,,FF1I$$		(I(I(Q(QQFF1INQ	 r    all_gather_inputsinp_split_sizesall_gather_input_numel
world_sizerankdtypedeviceitem_idx
group_size
group_namec                &    | j                   d   dk(  S )Nr   r   )kwargs)matchs    r   rV   z+reinplace_fsdp_all_gather.<locals>.<lambda>W  s    %,,z":a"? r    )	pass_dictextra_checkc                |    fd}| j                  ||d   |d   |d   |d   |d   |d   |d   |d	   |d
   g	       y )Nc                     | d d }| d   }| d   } j                   j                  j                  j                  | }|d   }|d   }j                   j                  j
                  j                  ||||      }|S )Nr   r	   )out)r   r   r   r   _c10d_functionalall_gather_into_tensor_out)	r   copy_in_argsr   r  r   r   	getitem_1all_gather_into_tensorrv   s	           r   replzEreinplace_fsdp_all_gather.<locals>.reinplace_all_gather.<locals>.replZ  s      9LbJbJ!J!B!B!J!J" )+G*1-I		**EEMMZ N  #
 *)r    r   r   r   r   r   r   r   r   r  )replace_by_example)r  r   r  r  rv   s       r   reinplace_all_gatherz7reinplace_fsdp_all_gather.<locals>.reinplace_all_gatherB  si    0	*$ 	  *+()/0|$vwx |$|$
	
r    )r  r   )5torch.distributed.fsdp._fully_shard._fsdp_collectivesrw   rx   r   r  r  r  ImportErrorAttributeErrorr   pattern_matcherr   r   r   r   r   r   r   r   r   r   apply)
r   r   r   r   r   r   r   
graph_passr  rv   s
            @r   reinplace_fsdp_all_gatherr    ss   
D  --/// II&&==		**EE	
FE
  	  $%JII&&==EE  IINN55==230178|,v&w'x(	 :& |$|$#	
& ?+. 
/. 
D % UE 8 s   A"E( (E?>E?c                    t        | t        j                  j                  j                  t        j                  j                  j
                  f      rJ t        | j                         dd        S )N   )r   rv   	_inductor	schedulerFusedSchedulerNodeGroupedSchedulerNodeintr-   )r)   s    r   
get_op_idxr"    s]    OO%%88OO%%::	
   u~~#$$r    c           	     z	   ! ddl m  g }t        t                  }d}d}i }i }i ! !fd}	| D ]  }
t	        |
j
                  t        j                  j                  j                  j                        rt        fd|
j                  D              rd}|
}t               }t        |||       t        t        j                  j                  j                  j                  t        j                  j                  j                  j                  t        j                  j                  j                   j                  g      t#        ||| fd	       t%        |d
       }t'        |      }d}t)        t'        |            D ]W  }||   }t+        |j
                  t        j                  j                  j                   j                        r|dz  }|dkD  sU|} n |d | }d }t)        t'        |      dz
        D ]3  }t-        ||dz      j
                  t.        j0                        s.|dz   } n |J  |	|d |       } |	||d        }|||<   't+        |
j
                  t        j                  j                  j2                  j                        skd}|
}t               }t#        |||       t%        |d       }d }t)        t'        |      dz
        D ]3  }t-        ||dz      j
                  t.        j0                        s.|dz   } n |J  |	|d |       } |	||d        }|||<    t'        !      dkD  sJ |rt'        |      dkD  sJ |rt'        |      dkD  sJ | D ]N  }
|
j5                         !v r!|
j5                            }
|
|v r-|j7                  |
       |j9                  |
       P d }|j;                         D ]j  \  }}|at=        t?        |jA                                     }|jC                         D ],  }|jE                  tG        |j5                         |             . |}l d }|j;                         D ]j  \  }}|at=        t?        |jA                                     }|jC                         D ],  }|jE                  tG        |j5                         |             . |}l |S )Nr	   )r  Fc                    j                   j                  |       }| D ]  }||j                         <    ||j                         <   |S r(   )r   creater-   )snodes_to_group
group_noder)   r  snode_name_to_final_snodes      r   _create_group_nodez:enforce_comm_ordering_for_fsdp.<locals>._create_group_node  sV    33::?K
$ 	EE:D%enn&67	E;E!*"5"5"78r    )r   c              3     K   | ]I  }t        |   j                  t        j                  j                  j
                  j                         K y wr(   )r   r   rv   r   r   r   r   )rB   rU   r2   s     r   rD   z1enforce_comm_ordering_for_fsdp.<locals>.<genexpr>  sD      
  "1%**EIINN,M,M,U,U
s   AATc                    t        | j                        xs0 t        | j                        xr | j                  j                  v  S r(   )r   NopKernelSchedulerNodeExternKernelSchedulerNoder   op_overload)rU   allowed_opsr  s    r   rV   z0enforce_comm_ordering_for_fsdp.<locals>.<lambda>  sF    q)"B"BC "1i&I&IJ >FF..+=	' r    )criteria_cbc                    t        |       S r(   r"  rT   s    r   rV   z0enforce_comm_ordering_for_fsdp.<locals>.<lambda>  
    JqM r    rW   r   c                    t        |       S r(   r2  rT   s    r   rV   z0enforce_comm_ordering_for_fsdp.<locals>.<lambda>   r3  r    rt   )$r   r  r   r   r   r   rv   r   r  r  r   r   re   r   wait_tensorr   split_with_sizes_copyr   sortedrI   ry   r   r   r   _WaitKernel	chunk_catr-   rF   ri   rh   r*   r+   rG   get_outputsrz   r   )"r   r|   r2   	new_orderrO   	ag_exists	rs_exists$ag_grouped_node_to_wait_grouped_node$rs_grouped_node_to_wait_grouped_noder)  r)   ag_snodeag_related_snode_setag_related_snodesend_idx_of_current_ag_blockcopy_out_countr   	cur_snodewait_node_idxag_group_nodeag_wait_group_noders_snoders_related_snode_setrs_related_snodesrs_group_noders_wait_group_nodeprev_ag_waitwait_group_noderu   oprev_rs_waitr/  r  r(  s"     `                            @@@r   enforce_comm_ordering_for_fsdprR    s   
 )+I3!III+-(+-( "  nUJJ59955PPXX
 
 __	
 
 IHLVL  ($"	 %II..IIQQII..::BBIINN88@@K )$" !'$*A! +..?*@'N3012 -a0	!NNEIINN$H$H$P$P #a'N!A%23/ !22N3N O !M301A56 /A6;;R^^L$%EM !,,,./@-/PQM "44Emn4U!VBT0? EJJ		(@(@(H(HIIH MWL ($"	 !'$*A!
 !M301A56 /A6;;R^^L$%EM !,,,./@-/PQM "44Emn4U!VBT0?]nU` ()A---781<<<781<<<  >>88-enn.>?EIe L*N*T*T*V '&#]%C%C%E FGL!--/ **AJJL|D '' L*N*T*T*V '&#]%C%C%E FGL!--/ **AJJL|D '' r    )r   list[BaseSchedulerNode]r;   rS  )
r   rS  r   boolr   rT  r   rT  r;   rS  )r{   rS  r;   rS  )r)   r   r;   float)r   torch.fx.Graph)r   rV  r;   r<   )r   1list[torch._inductor.scheduler.BaseSchedulerNode]r|   z4dict[str, torch._inductor.scheduler.SchedulerBuffer]r2   zdict[str, BaseSchedulerNode]r;   rW  )2
__future__r   rJ   loggingr   rc   collectionsr   typingr   r   rv    torch.multiprocessing.reductionsr   torch.utils._ordered_setr   r   r
   r   dependenciesr   utilsr   r   r   r   r   r   r   	getLoggerr=   r   _logginggetArtifactLoggerr   r  r   r   r   r#   r   r   rg   r   r   r   r   r  r"  rR  r   r    r   <module>rc     s>   #    
 # %  ; /  !   g!nn..xC,#&W#WW W 	W
 Wt",		U>#8A#Hl^%n=nEn 5n 7	nr    