+
    –°³j($ ã                   óž  € ^ RI t ^ RIt^ RIt^ RIt^ RIHtHt ^ RIHtH	t	H
t
 ^ RIt^ RIt^ RIHt ^ RIHu 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"    ]%]&,          ]%]%]&,          ,          ,          ]PN                  ,          ],          ](R]&3,          ,          ]PR                  ,          t*^ RIH+t+  R t,RÌR R llt-RÌR R llt.RÌR R llt/RÌR R llt0RÌR R llt1RÌR R llt2RÌR R llt3RÌR R llt4RÌR  R! llt5RÌR" R# llt6RÌR$ R% llt7RÌR& R' llt8RÌR( R) llt9RÌR* R+ llt:RÌR, R- llt;R. t<RÌR/ R0 llt=RÌR1 R2 llt>R3 R4 lt?R5 t@]P‚                  P…                  R6]?]@R77       R8 R9 ltCR: tD]P‚                  P…                  R;]C]DR77       R< R= ltER> tF]P‚                  P…                  R?]E]FR77       R@ RA ltGRB tH]P‚                  P…                  RC]G]HR77       RD RE ltIRF tJ]P‚                  P…                  RG]I]JR77       ]P‚                  P…                  RH]E]FR77       ]P‚                  P…                  RI]G]HR77       ]P‚                  P…                  RJ]I]JR77       RK RL ltKRM tL]P‚                  P…                  RN]K]LR77       RO RP ltMRQ tN]P‚                  P…                  RR]M]NR77       RS RT ltORU tP]P‚                  P…                  RV]O]PR77       RÌRW RX lltQ ! RY RZ]P¤                  4      tS RÌR[ R\ lltTRÌR] R^ lltURÌR_ R` lltV]P‚                  P¯                  RaRÍRbRc7      Rd Re l4       tX]XP²                  Rf Rg l4       tZRh Ri lt[Rj t\]XP…                  ][]\R77       Rk Rl lt]Rm Rn lt^] P¾                  RÎRo Rp ll4       t`Rq taRr tbRs tcRt tdRu teRv tfRw tgRx thRy tiRz tjR{ tkR| tlR} tmR~ tnR toR€ tpR� tqR‚ trRƒ tsR„ ttR… tuR† tv]P‚                  Pï                  R‡Rˆ4      tx]xPó                  R‰]dRŠ4       ]xPó                  R‹]lRŠ4       ]xPó                  RŒ]kRŠ4       ]xPó                  R�]nRŠ4       ]xPó                  RŽ]eRŠ4       ]xPó                  R�]fRŠ4       ]xPó                  R�]gRŠ4       ]xPó                  R‘]hRŠ4       ]xPó                  R’]qRŠ4       ]xPó                  R“]rRŠ4       ]xPó                  R”]sRŠ4       ]xPó                  R•]tRŠ4       ]xPó                  R–]uRŠ4       ]xPó                  R—]vRŠ4       ]xPó                  R˜]pRŠ4       ]xPó                  R™]cRŠ4       ]xPó                  Rš]mRŠ4       ]P‚                  Pï                  R›Rˆ4      tz]zPó                  R“]rRŠ4       ]zPó                  R•]tRŠ4       ]zPó                  R˜]pRŠ4       ]Pö                  Pø                  Pû                  ]Pü                  Pþ                  PX                  EP                   4       ]Pö                  Pø                  Pû                  ]Pü                  Pþ                  PX                  4       ]Pö                  Pø                  Pû                  ]Pü                  Pþ                  EP                  EP                   4       ]Pö                  Pø                  Pû                  ]Pü                  Pþ                  EP                  4       ]Pö                  Pø                  Pû                  ]Pü                  Pþ                  EP                  EP                   4       ]Pö                  Pø                  Pû                  ]Pü                  Pþ                  EP                  4       ]Pö                  Pø                  Pû                  ]Pü                  Pþ                  EP                  EP                   4       ]Pö                  Pø                  Pû                  ]Pü                  Pþ                  EP                  4       ]P‚                  Pï                  RœR�4      t„]P‚                  Pï                  RœRˆ4      t…. RÏOt†]EP                  ]ˆ,          t‰]† Fa  tŠ]Š^ ]ŠEP                  Rž4       tŒ]�! ]RŸ]Œ 24      tŽ]„EP                  ]Š]EP                   EP"                  R 7       ]…Pó                  ]Œ]ŽR¡4       Kc  	   RÐR¢ R£ llt’RÑR¥ R¦ llt“]EP(                  EP*                  R¤]EP(                  EP,                  R§]EP(                  EP.                  R¨]EP(                  EP0                  R©]EP(                  EP2                  Rª]EP(                  EP4                  R«]EP(                  EP6                  R¬]EP(                  EP8                  R­/t�RÒR® R¯ lltžRÓR° R± lltŸRÔR² R³ llt RÒR´ Rµ llt¡RÕR¶ R· llt¢RÕR¸ R¹ llt£Rº R» lt¤R¼ R½ lt¥^ R¾IH¦t§H¨t©Hªt«H¬t­H/t®H.t¯H=t°H±t²H‚t³H�t´Hµt¶H1t·H5t¸ R¿ t¹RÀ tºRÁ t»RÂ t¼RÃ t½RÄ t¾RÅ t¿RÆ tÀRÇ tÁ]­]¹]®]¹]¸]º]·]º]¯]»]°]¼]«]½]¶]¾]©]º]§]¹]´]¿]³]À]²]Á/tÂRÈ RÉ ltÃ ! RÊ RË]EPˆ                  EPŠ                  4      tÆR#   ] d    ^ RIHt  E	LÍi ; i  ]# d    ]PH                  ! R
^R7       R t" E	Lëi ; i)Öé    N)ÚCallableÚSequence)ÚAnyÚcastÚTYPE_CHECKING)Ú_maybe_view_chunk_cat)Ú
DeviceMesh)Úget_proxy_mode)Ú_functional_collectives_impl)Útree_map_only)Úis_dynamo_compilingzdUnable to import torchdynamo util `is_torchdynamo_compiling`, so won't support torchdynamo correctly©Ú
stacklevelc                  ó   € R # )F© r   ó    Új/home/luca/screen-checking/.venv/lib/python3.14/site-packages/torch/distributed/_functional_collectives.pyÚis_torchdynamo_compilingr   "   s   € Ùr   zdist.tensor.DeviceMesh)Ú_chunk_or_narrow_catc                óT   € \         P                  P                  P                  V 4      # )z•
Wait on a tensor returned by the collectives ops.

Waiting follows device semantics, which means blocking on CPU and synchronizing streams on CUDA.
)ÚtorchÚopsÚ_c10d_functionalÚwait_tensor)Útensors   &r   r   r   ˆ   s   € ô �9‰9×%Ñ%×1Ñ1°&Ó9Ð9r   c                ó\   € V ^8„  d   QhR\         P                  R\        R\        R\        /# )é   ÚselfÚsrcÚgroupÚtag©r   ÚTensorÚintÚ
RANK_TYPESÚstr)Úformats   "r   Ú__annotate__r(   ‘   s,   € ÷ &ñ &”E—L‘Lð &¤sð &´:ð &ÄCñ &r   c                ó”   € \        W#4      p\        P                  P                  P	                  W\        V4      4      p\        V4      # )a  
Broadcasts the tensor to all processes in the given process group.

Args:
    src (int): Source rank
    group (ProcessGroup or List[int]): The process group to work on.
    tag (str, optional): A unique identifier for the collective. Default: empty string
)Ú_resolve_groupr   r   r   Ú	broadcastÚ_group_or_group_nameÚ_maybe_wrap_tensor)r   r   r    r!   r   s   &&&& r   r+   r+   ‘   s@   € ô ˜5Ó&€EÜ�Y‰Y×'Ñ'×1Ñ1ØÔ'¨Ó.ó€Fô ˜fÓ%Ð%r   c                ó\   € V ^8„  d   QhR\         P                  R\        R\        R\        /# )r   r   ÚreduceOpr    r!   )r   r#   r&   r%   )r'   s   "r   r(   r(   ¡   s,   € ÷ &ñ &”U—\‘\ð &¬Sð &¼ð &Ì#ñ &r   c                ó°   € \        W#4      p\        P                  P                  P	                  WP                  4       \        V4      4      p\        V4      # )aÈ  
Reduces the tensor data across all machines in such a way that all get
the final result.

The input tensor is left unmodified.

Group can be one of:
    List[int]: ranks participating in the collective.
    List[List[int]]: 2D mesh of ranks taking part of this collective in MPMD.
    ProcessGroup: Will perform a collective using the ranks and tag of the PG.
    DeviceMesh: Do a SPMD collective over all ranks of the mesh
    (DeviceMesh, int): Do a MPMD collective over one dimension of the DeviceMesh

:: N.B. If you pass a PG or a 1D list to perform a MPMD collective, the compiler won't be able to recover
that information and perform collective algebraic optimization. Use other forms of input for that.
)r*   r   r   r   Ú
all_reduceÚlowerr,   r-   )r   r/   r    r!   r   s   &&&& r   r1   r1   ¡   sG   € ô" ˜5Ó&€EÜ�Y‰Y×'Ñ'×2Ñ2Ø�n‰nÓÔ 4°UÓ ;ó€Fô ˜fÓ%Ð%r   c          
      ó|   € V ^8„  d   QhR\         P                  R\        R\        R\        R\         P                  /# ©r   r   Ú
gather_dimr    r!   Úreturnr"   )r'   s   "r   r(   r(   ¹   sB   € ÷ 'ñ 'Ü
�,‰,ð'äð'ô ð'ô 
ð	'ô
 ‡\�\ñ'r   c                óæ  € \        W#4      p\        P                  ! V4      p\        P                  P
                  P                  W\        V4      4      p\        V4      pV^ 8w  d‹   \        V\        4      '       di   \        VP                  4      pV^8”  d   \        P                  ! V^V 4      M^pV^ ,          V8H  ;'       d    V^8H  p	V	'       g   VP                  4       p\!        WdV4      pV# )aõ  
Gather tensor data across from all machines and concatenate over ``gather_dim``.

Note that it currently only supports gather_dim = 0.

The input tensor is left unmodified.
Group can be one of:
    List[int]: ranks participating in the collective.
    List[List[int]]: 2D mesh of ranks taking part of this collective in MPMD.
    ProcessGroup: Will perform a collective using the ranks and tag of the PG.
    DeviceMesh: Do a SPMD collective over all ranks of the mesh
    (DeviceMesh, int): Do a MPMD collective over one dimension of the DeviceMesh

:: N.B. If you pass a PG or a 1D list to perform a MPMD collective, the compiler won't be able to recover
that information and perform collective algebraic optimization. Use other forms of input for that.
)r*   Úc10dÚ_get_group_size_by_namer   r   r   Úall_gather_into_tensorr,   r-   Ú
isinstanceÚAsyncCollectiveTensorÚlistÚshapeÚmathÚprodÚwaitr   )
r   r5   r    r!   Ú
group_sizer   Úresr>   Únumel_betweenÚcan_use_views
   &&&&      r   Úall_gather_singlerF   ¹   sË   € ô, ˜5Ó&€EÜ×-Ò-¨eÓ4€JÜ�Y‰Y×'Ñ'×>Ñ>ØÔ.¨uÓ5ó€Fô ˜VÓ
$€CØ�Q„ô �cÔ0×1Ò1Ü˜Ÿ™“OˆEØ>HÈ1¼nœDŸIšI e¨A¨jÐ&9Ô:ÐRSˆMØ  �8 zÑ1×HÐH°mÀqÑ6HˆLßØ—h‘h“j�Ü# C°ZÓ@ˆØ€Jr   c                ó\   € V ^8„  d   QhR\         P                  R\        R\        R\        /# ©r   r   r5   r    r!   r"   )r'   s   "r   r(   r(   ã   s4   € ÷ ;ñ ;Ü
�,‰,ð;äð;ô ð;ô 
ñ	;r   c                ó   € \        WW#4      # )a$  
Gather tensor data across from all machines and concatenate over ``gather_dim``.

Note that it currently only supports gather_dim = 0.

This function is the same as all_gather_single but will propagate the
backwards gradient across workers.

See all_gather_single for more details on usage.
)rF   ©r   r5   r    r!   s   &&&&r   Úall_gather_single_autogradrK   ã   s   € ô" ˜T¨uÓ:Ð:r   c          
      óh   € V ^8„  d   QhR\         P                  R\        R\        R\        R\        /# ©r   r   r/   Úscatter_dimr    r!   ©r   r#   r&   r$   r%   )r'   s   "r   r(   r(   ÷   s>   € ÷ 'ñ 'Ü
�,‰,ð'äð'ô ð'ô ð	'ô
 
ñ'r   c                óŠ  € \        W44      p\        P                  ! V4      pV P                  V4      V,          ^ 8w  d"   \	        RV P                  ^ 4       RV R24      hV^ 8w  d   \        WV^ R7      p \        P                  P                  P                  V VP                  4       V\        V4      4      p\        V4      pV# )aø  
Reduces the tensor data across all machines in such a way that all get
the final result, then scatter the results to corresponding ranks.


The input tensor is left unmodified.
Group can be one of:
    List[int]: ranks participating in the collective.
    List[List[int]]: 2D mesh of ranks taking part of this collective in MPMD.
    ProcessGroup: Will perform a collective using the ranks and tag of the PG.
    DeviceMesh: Do a SPMD collective over all ranks of the mesh
    (DeviceMesh, int): Do a MPMD collective over one dimension of the DeviceMesh
:: N.B. If you pass a PG or a 1D list to perform a MPMD collective, the compiler won't be able to recover
that information and perform collective algebraic optimization. Use other forms of input for that.
zinput dimension 0 (ú" must be a multiple of group_size Ú))Ú
narrow_dimÚcat_dim)r*   r8   r9   ÚsizeÚAssertionErrorr   r   r   r   Úreduce_scatter_tensorr2   r,   r-   )r   r/   rN   r    r!   rB   r   rC   s   &&&&&   r   Úreduce_scatter_singlerX   ÷   s»   € ô, ˜5Ó&€EÜ×-Ò-¨eÓ4€Jà‡y�y�Ó 
Õ*¨aÔ/ÜØ! $§)¡)¨A£, Ð/QÐR\ÐQ]Ð]^Ð_ó
ð 	
ð �aÔÜ# DÀÐVWÔXˆä�Y‰Y×'Ñ'×=Ñ=ØØ�‰ÓØÜ˜UÓ#ó	€Fô ˜VÓ
$€CØ€Jr   c          
      óh   € V ^8„  d   QhR\         P                  R\        R\        R\        R\        /# rM   rO   )r'   s   "r   r(   r(   !  sE   € ÷ Jñ JÜ
�,‰,ðJäðJô ðJô ð	Jô
 
ñJr   c                ó   € \        WW#V4      # )a`  
Reduces the tensor data across all machines in such a way that all get
the final result, then scatter the results to corresponding ranks.

This function is the same as reduce_scatter_single but will propagate the
backwards gradient across workers.

Currently only the "sum" reduceOp is supported.

See reduce_scatter_single for more details on usage.
)rX   ©r   r/   rN   r    r!   s   &&&&&r   Úreduce_scatter_single_autogradr\   !  s   € ô& ! °ÀSÓIÐIr   c          
      ó|   € V ^8„  d   QhR\         P                  R\        R\        R\        R\         P                  /# r4   r"   )r'   s   "r   r(   r(   =  sB   € ÷ ;ñ ;Ü
�,‰,ð;äð;ô ð;ô 
ð	;ô
 ‡\�\ñ;r   c                 óœ   € \         P                  P                  4       '       g   \        P                  ! R \
        ^R7       \        WW#4      # )zž`torch.distributed._functional_collectives.all_gather_tensor` is deprecated. Please use `torch.distributed._functional_collectives.all_gather_single` instead.r   )r   ÚcompilerÚis_compilingÚwarningsÚwarnÚFutureWarningrF   rJ   s   &&&&r   Úall_gather_tensorrd   =  s>   € ô �>‰>×&Ñ&×(Ò(Ü�Šð`äØõ		
ô ˜T¨uÓ:Ð:r   c                ó\   € V ^8„  d   QhR\         P                  R\        R\        R\        /# rH   r"   )r'   s   "r   r(   r(   M  s:   € ÷ Dñ DÜ
�,‰,ðDäðDô ðDô 
ñ	Dr   c                 óœ   € \         P                  P                  4       '       g   \        P                  ! R \
        ^R7       \        WW#4      # )z°`torch.distributed._functional_collectives.all_gather_tensor_autograd` is deprecated. Please use `torch.distributed._functional_collectives.all_gather_single_autograd` instead.r   )r   r_   r`   ra   rb   rc   rK   rJ   s   &&&&r   Úall_gather_tensor_autogradrg   M  s>   € ô �>‰>×&Ñ&×(Ò(Ü�ŠðiäØõ		
ô & d¸ÓCÐCr   c          
      óh   € V ^8„  d   QhR\         P                  R\        R\        R\        R\        /# rM   rO   )r'   s   "r   r(   r(   ]  sE   € ÷ Jñ JÜ
�,‰,ðJäðJô ðJô ð	Jô
 
ñJr   c                 óž   € \         P                  P                  4       '       g   \        P                  ! R \
        ^R7       \        WW#V4      # )z¦`torch.distributed._functional_collectives.reduce_scatter_tensor` is deprecated. Please use `torch.distributed._functional_collectives.reduce_scatter_single` instead.r   )r   r_   r`   ra   rb   rc   rX   r[   s   &&&&&r   rW   rW   ]  s@   € ô �>‰>×&Ñ&×(Ò(Ü�ŠðdäØõ		
ô ! °ÀSÓIÐIr   c          
      óh   € V ^8„  d   QhR\         P                  R\        R\        R\        R\        /# rM   rO   )r'   s   "r   r(   r(   n  sE   € ÷ Sñ SÜ
�,‰,ðSäðSô ðSô ð	Sô
 
ñSr   c                 óž   € \         P                  P                  4       '       g   \        P                  ! R \
        ^R7       \        WW#V4      # )z¸`torch.distributed._functional_collectives.reduce_scatter_tensor_autograd` is deprecated. Please use `torch.distributed._functional_collectives.reduce_scatter_single_autograd` instead.r   )r   r_   r`   ra   rb   rc   r\   r[   s   &&&&&r   Úreduce_scatter_tensor_autogradrl   n  s@   € ô �>‰>×&Ñ&×(Ò(Ü�ŠðmäØõ		
ô *¨$¸+ÈcÓRÐRr   c                ó¨   € V ^8„  d   QhR\         \        P                  ,          R\        R\        R\        R\         \        P                  ,          /# )r   r   r/   r    r!   r6   )r=   r   r#   r&   r%   )r'   s   "r   r(   r(     sF   € ÷ 6ñ 6Ü
Œu�|‰|Õ
ð6Ü(+ð6Ü4>ð6ÜEHð6ä	Œ%�,‰,Õñ6r   c                óÎ   € \        W#4      p\        P                  P                  P	                  V VP                  4       \        V4      4      p\        \        \        V4      4      # )aÜ  
Reduces a list of tensors across all machines in such a way that all get
the final result.

The all tensors in the input list are left unmodified.

Group can be one of:
    List[int]: ranks participating in the collective.
    List[List[int]]: 2D mesh of ranks taking part of this collective in MPMD.
    ProcessGroup: Will perform a collective using the ranks and tag of the PG.
    DeviceMesh: Do a SPMD collective over all ranks of the mesh
    (DeviceMesh, int): Do a MPMD collective over one dimension of the DeviceMesh

:: N.B. If you pass a PG or a 1D list to perform a MPMD collective, the compiler won't be able to recover
that information and perform collective algebraic optimization. Use other forms of input for that.
)
r*   r   r   r   Úall_reduce_coalescedr2   r,   r=   Úmapr-   )r   r/   r    r!   Útensor_lists   &&&& r   ro   ro     sR   € ô& ˜5Ó&€EÜ—)‘)×,Ñ,×AÑAØØ�‰ÓÜ˜UÓ#ó€Kô
 ”Ô&¨Ó4Ó5Ð5r   c          	      óœ   € V ^8„  d   QhR\         \        P                  ,          R\        R\        R\         \        P                  ,          /# ©r   r   r    r!   r6   ©r=   r   r#   r%   r&   )r'   s   "r   r(   r(   ›  s>   € ÷ 6ñ 6Ü
Œu�|‰|Õ
ð6Ü%/ð6Ü69ð6ä	Œ%�,‰,Õñ6r   c                óÞ   € \        W4      p\        P                  ! V4      p\        P                  P
                  P                  V V\        V4      4      p\        \        \        V4      4      # )a×  
Gather a list of tensors across from all machines.

Note that it currently only supports gather_dim = 0.

The input tensor is left unmodified.
Group can be one of:
    List[int]: ranks participating in the collective.
    List[List[int]]: 2D mesh of ranks taking part of this collective in MPMD.
    ProcessGroup: Will perform a collective using the ranks and tag of the PG.
    DeviceMesh: Do a SPMD collective over all ranks of the mesh
    (DeviceMesh, int): Do a MPMD collective over one dimension of the DeviceMesh

:: N.B. If you pass a PG or a 1D list to perform a MPMD collective, the compiler won't be able to recover
that information and perform collective algebraic optimization. Use other forms of input for that.
)r*   r8   r9   r   r   r   Ú all_gather_into_tensor_coalescedr,   r=   rp   r-   )r   r    r!   rB   rq   s   &&&  r   Úall_gather_single_coalescedrw   ›  s[   € ô& ˜5Ó&€EÜ×-Ò-¨eÓ4€JÜ—)‘)×,Ñ,×MÑMØØÜ˜UÓ#ó€Kô
 ”Ô&¨Ó4Ó5Ð5r   c                óÊ   € V ^8„  d   QhR\         \        P                  ,          R\        R\         \        ,          R\
        R\        R\         \        P                  ,          /# ©r   Úinputsr/   rN   r    r!   r6   ©r=   r   r#   r&   r$   r%   )r'   s   "r   r(   r(   ¸  sZ   € ÷ -6ñ -6Ü”—‘Õð-6äð-6ô ”c•ð-6ô ð	-6ô
 
ð-6ô 
Œ%�,‰,Õñ-6r   c                ó®  € \        W44      p\        P                  ! V4      p\        V4      \        V 4      8w  d%   \	        R\        V4       R\        V 4       R24      h\        \        W 4      4       F„  w  pw  rxVP                  V4      V,          ^ 8w  d'   \	        RV RVP                  V4       RV RV 24      hV^ 8w  g   KT  \        P                  ! W…VR7      p	\        P                  ! V	4      W&   K†  	  \        P                  P                  P                  V VP                  4       V\        V4      4      p	\!        \#        \$        V	4      4      # )	aü  
Reduces a list of tensors across all machines in such a way that all get
the final result, then scatter the results to corresponding ranks.

The input tensors are left unmodified.
Group can be one of:
    List[int]: ranks participating in the collective.
    List[List[int]]: 2D mesh of ranks taking part of this collective in MPMD.
    ProcessGroup: Will perform a collective using the ranks and tag of the PG.
    DeviceMesh: Do a SPMD collective over all ranks of the mesh
    (DeviceMesh, int): Do a MPMD collective over one dimension of the DeviceMesh

:: N.B. If you pass a PG or a 1D list to perform a MPMD collective, the compiler won't be able to recover
that information and perform collective algebraic optimization. Use other forms of input for that.
zLength of scatter_dim (z) must equal length of inputs (rR   zinput dimension z (rQ   z for tensor at index )Údim)r*   r8   r9   ÚlenrV   Ú	enumerateÚziprU   r   ÚchunkÚcatr   r   Úreduce_scatter_tensor_coalescedr2   r,   r=   rp   r-   )
rz   r/   rN   r    r!   rB   Úidxr}   r   rq   s
   &&&&&     r   Úreduce_scatter_single_coalescedr…   ¸  sH  € ô, ˜5Ó&€EÜ×-Ò-¨eÓ4€Jä
ˆ;Óœ3˜v›;Ô&ÜØ%¤c¨+Ó&6Ð%7Ð7VÔWZÐ[aÓWbÐVcÐcdÐeó
ð 	
ô (¬¨KÓ(@ÖAÑˆ‰]ˆcØ�;‰;�sÓ˜jÕ(¨AÔ-Ü Ø" 3 % r¨&¯+©+°cÓ*:Ð);Ð;]Ð^hÐ]iÐi~ð  @Cð  Dð  Eóð ð �!Ž8ÜŸ+š+ f¸cÔBˆKÜŸ)š) KÓ0ˆF‹Kñ Bô —)‘)×,Ñ,×LÑLØØ�‰ÓØÜ˜UÓ#ó	€Kô ”Ô&¨Ó4Ó5Ð5r   c          	      óœ   € V ^8„  d   QhR\         \        P                  ,          R\        R\        R\         \        P                  ,          /# rs   rt   )r'   s   "r   r(   r(   ë  s>   € ÷ 
9ñ 
9Ü
Œu�|‰|Õ
ð
9Ü%/ð
9Ü69ð
9ä	Œ%�,‰,Õñ
9r   c                 óœ   € \         P                  P                  4       '       g   \        P                  ! R \
        ^R7       \        WV4      # )z·`torch.distributed._functional_collectives.all_gather_into_tensor_coalesced` is deprecated. Please use `torch.distributed._functional_collectives.all_gather_single_coalesced` instead.r   )r   r_   r`   ra   rb   rc   rw   )r   r    r!   s   &&&r   rv   rv   ë  s>   € ô �>‰>×&Ñ&×(Ò(Ü�ŠðjäØõ		
ô ' t°CÓ8Ð8r   c                óÊ   € V ^8„  d   QhR\         \        P                  ,          R\        R\         \        ,          R\
        R\        R\         \        P                  ,          /# ry   r{   )r'   s   "r   r(   r(   ø  sb   € ÷ Vñ VÜ”—‘ÕðVäðVô ”c•ðVô ð	Vô
 
ðVô 
Œ%�,‰,ÕñVr   c                 óž   € \         P                  P                  4       '       g   \        P                  ! R \
        ^R7       \        WW#V4      # )zº`torch.distributed._functional_collectives.reduce_scatter_tensor_coalesced` is deprecated. Please use `torch.distributed._functional_collectives.reduce_scatter_single_coalesced` instead.r   )r   r_   r`   ra   rb   rc   r…   )rz   r/   rN   r    r!   s   &&&&&r   rƒ   rƒ   ø  sA   € ô �>‰>×&Ñ&×(Ò(Ü�ŠðnäØõ		
ô +¨6¸[ÐQTÓUÐUr   c                 óø  € \        V \        P                  P                  4      '       g   \	        R \        V 4       24      h\        P                  P                  V P                  4       \        P                  P                  4      '       d   R# V P                  p\        VP                  4      ^ 8”  dE   VP                  ^ ,          pVP                  RJ;'       d    VP                  P                  '       * # R# )z$Expected torch._ops.OpOverload, got FN)r;   r   Ú_opsÚ
OpOverloadrV   ÚtypeÚ_CÚ%_dispatch_has_kernel_for_dispatch_keyÚnameÚDispatchKeyÚCompositeImplicitAutogradÚ_schemar~   Ú	argumentsÚ
alias_infoÚis_write)ÚtgtÚschemaÚ	first_args   &  r   Ú_is_view_oprš     s¾   € Ü�cœ5Ÿ:™:×0Ñ0×1Ò1ÜÐCÄDÈÃIÀ;ÐOÓPÐPô ‡x�x×5Ñ5Ø�‰‹
”E×%Ñ%×?Ñ?÷ò ñ Ø�[‰[€FÜ
ˆ6×ÑÓ˜qÔ Ø×$Ñ$ QÕ'ˆ	à×#Ñ#¨4Ð/×UÐU¸	×8LÑ8L×8UÑ8UÔ4UÐUñ !r   c                óÐ   € V ^8„  d   QhR\         P                  R\        \        ,          R,          R\        \        ,          R,          R\        R\
        R\         P                  /# ©r   r   Úoutput_split_sizesNÚinput_split_sizesr    r!   r6   ©r   r#   r=   r$   r%   r&   )r'   s   "r   r(   r(     s^   € ÷ 2&ñ 2&Ü
�,‰,ð2&äœS�	 DÕ(ð2&ô œC•y 4Õ'ð2&ô ð	2&ô
 
ð2&ô ‡\�\ñ2&r   c                ór  € VeI   \         ;QJ d    R V 4       F  '       d   K   RM	  RM! R V 4       4      '       g   \        RV 24      hVeI   \         ;QJ d    R V 4       F  '       d   K   RM	  RM! R V 4       4      '       g   \        RV 24      h\        W44      p\        P                  ! V4      pVe   Vf8   Vf   Ve   \        R4      hV P
                  ^ ,          V,          .V,          pTp\        P                  P                  P                  V VV\        V4      4      p\        V4      # )a  
Each process splits input tensor and then scatters the split list
to all processes in a group. Then concatenate the received tensors from all
the processes in the group and return single output tensor.

Group can be one of:
    List[int]: ranks participating in the collective.
    List[List[int]]: 2D mesh of ranks taking part of this collective in MPMD.
    ProcessGroup: Will perform a collective using the ranks and tag of the PG.
    DeviceMesh: Do a SPMD collective over all ranks of the mesh
    (DeviceMesh, int): Do a MPMD collective over one dimension of the DeviceMesh

:: N.B. If you pass a PG or a 1D list to perform a MPMD collective, the compiler won't be able to recover
that information and perform collective algebraic optimization. Use other forms of input for that.
c              3   ób   "  € T F%  p\        V\        \        P                  34      x € K'  	  R # 5i©N©r;   r$   r   ÚSymInt©Ú.0rU   s   & r   Ú	<genexpr>Ú$all_to_all_single.<locals>.<genexpr>2  s'   é € ð 
Ù>P°dŒJ�tœc¤5§<¡<Ð0×1Ð1Ó>Pùó   ‚-/FTz2All output_split_sizes must be int or SymInt, got c              3   ób   "  € T F%  p\        V\        \        P                  34      x € K'  	  R # 5ir¢   r£   r¥   s   & r   r§   r¨   9  s%   é € ÐWÑEV¸T”:˜d¤S¬%¯,©,Ð$7×8Ð8ÓEVùr©   z1All input_split_sizes must be int or SymInt, got z^output_split_sizes and input_split_sizes must either be specified together or both set to None)ÚallrV   r*   r8   r9   r>   r   r   r   Úall_to_all_singler,   r-   )r   r�   rž   r    r!   rB   r   s   &&&&&  r   r¬   r¬     s9  € ð, Ò%ß‹sñ 
Ù>Pó
�s�sŠsñ 
Ù>Pó
÷ 
ò 
ô !ØDÐEWÐDXÐYóð ð Ò$ß‹sÑWÑEVÓW�s�sŠsÑWÑEVÓW×WÒWÜ ØCÐDUÐCVÐWóð ô ˜5Ó&€EÜ×-Ò-¨eÓ4€JØÒ!Ð%6Ò%>Ø"Ò*Ð/@Ò/HÜ ð9óð ð #Ÿj™j¨�m¨zÕ9Ð:¸ZÕGÐØ.ÐÜ�Y‰Y×'Ñ'×9Ñ9ØØØÜ˜UÓ#ó	€Fô ˜fÓ%Ð%r   c                óÐ   € V ^8„  d   QhR\         P                  R\        \        ,          R,          R\        \        ,          R,          R\        R\
        R\         P                  /# rœ   rŸ   )r'   s   "r   r(   r(   P  sf   € ÷ Vñ VÜ
�,‰,ðVäœS�	 DÕ(ðVô œC•y 4Õ'ðVô ð	Vô
 
ðVô ‡\�\ñVr   c                ó   € \        WW#V4      # )z2
Same as all_to_all_single but supports autograd.
)r¬   )r   r�   rž   r    r!   s   &&&&&r   Úall_to_all_single_autogradr¯   P  s   € ô ˜TÐ7HÐQTÓUÐUr   c                ó8   € V ^8„  d   QhR\         P                  /# ©r   Úgrad_output©r   r#   )r'   s   "r   r(   r(   c  s   € ÷ ñ ¬5¯<©<ñ r   c                ó   € V# )zü
Backward for wait_tensor: identity (no-op).
Wait is just a synchronization primitive, so gradient flows through unchanged.

Args:
    ctx: Context object
    grad_output: Gradient from downstream operations

Returns:
    Gradient unchanged (identity)
r   ©Úctxr²   s   &&r   Úwait_tensor_backwardr·   c  s
   € ð Ðr   c                ó   € R# )z¦
Setup context for wait_tensor backward.
Args:
    ctx: Context object to save state for backward
    inputs: Tuple of (tensor,)
    output: Output from forward pass
Nr   ©r¶   rz   Úoutputs   &&&r   Úwait_tensor_setup_contextr»   r  s   € ñ r   z_c10d_functional::wait_tensor)Úsetup_contextc                ó8   € V ^8„  d   QhR\         P                  /# r±   r³   )r'   s   "r   r(   r(   „  s   € ÷ +ñ +¬%¯,©,ñ +r   c                óê   € V P                   pV P                  pVR9  d   \        RV R24      h\        P                  P
                  P                  VP                  4       W24      p\        V4      RR3# )aS  
Backward for all_reduce: all_reduce with same reduce_op.
Forward aggregates tensors, backward aggregates gradients.

Args:
    ctx: Context object
    grad_output: Gradient from downstream operations

Returns:
    Tuple of (grad_input, grad_group_name, grad_reduce_op)
    grad_group_name and grad_reduce_op are None (not differentiable)
zCall_reduce backward only supports 'sum' and 'avg' reductions, got 'Ú'N)ÚsumÚavg)	Ú
group_nameÚ	reduce_opÚRuntimeErrorr   r   r   r1   Ú
contiguousr   )r¶   r²   rÂ   rÃ   rº   s   &&   r   Úall_reduce_backwardrÆ   „  sz   € ð —‘€JØ—‘€Ið ˜Ô&ÜØQÐR[ÐQ\Ð\]Ð^ó
ð 	
ô
 �Y‰Y×'Ñ'×2Ñ2Ø×ÑÓ  )ó€Fô �vÓ  dÐ*Ð*r   c                óF   € Vw  r4pWPn         VP                  4       V n        R# )zº
Setup context for all_reduce backward.
Args:
    ctx: Context object to save state for backward
    inputs: Tuple of (input, reduce_op, group_name)
    output: Output from forward pass
N©rÂ   r2   rÃ   )r¶   rz   rº   ÚinputrÃ   rÂ   s   &&&   r   Úall_reduce_setup_contextrÊ   ¤  s!   € ð $*Ñ €E�jØ„NØ—O‘OÓ%€C†Mr   z_c10d_functional::all_reducec                ó8   € V ^8„  d   QhR\         P                  /# r±   r³   )r'   s   "r   r(   r(   ¸  s   € ÷ +ñ +´e·l±lñ +r   c                óÂ   € V P                   pV P                  p\        P                  P                  P                  VP                  4       RVV4      p\        V4      RR3# )aœ  
Backward for all_gather_into_tensor: reduce_scatter with sum.

Forward gathers tensors from all ranks, backward scatters gradients back
with sum reduction.

Args:
    ctx: Context object with group_name and group_size
    grad_output: Gradient from downstream operations

Returns:
    Tuple of (grad_input, grad_group_size, grad_group_name)
    grad_group_size and grad_group_name are None (not differentiable)
rÀ   N)rÂ   rB   r   r   r   rW   rÅ   r   )r¶   r²   rÂ   rB   rº   s   &&   r   Úall_gather_into_tensor_backwardrÍ   ¸  s[   € ð —‘€JØ—‘€Jô �Y‰Y×'Ñ'×=Ñ=Ø×ÑÓ ØØØó	€Fô �vÓ  dÐ*Ð*r   c                ó(   € Vw  r4pWPn         W@n        R# )zÈ
Setup context for all_gather_into_tensor backward.

Args:
    ctx: Context object to save state for backward
    inputs: Tuple of (input, group_size, group_name)
    output: Output from forward pass
N©rÂ   rB   )r¶   rz   rº   rÉ   rB   rÂ   s   &&&   r   Ú$all_gather_into_tensor_setup_contextrÐ   Ô  s   € ð %+Ñ!€E�zØ„NØ†Nr   z(_c10d_functional::all_gather_into_tensorc                ó8   € V ^8„  d   QhR\         P                  /# r±   r³   )r'   s   "r   r(   r(   é  s   € ÷ 1ñ 1´U·\±\ñ 1r   c                ó  € V P                   pV P                  pV P                  pVR8w  d   \        RV R24      h\        P
                  P                  P                  VP                  4       VV4      p\        V4      RRR3# )a´  
Backward for reduce_scatter_tensor: all_gather.

Forward reduces and scatters tensors to ranks, backward gathers gradients
from all ranks.

Args:
    ctx: Context object with group_name, group_size, and reduce_op
    grad_output: Gradient from downstream operations

Returns:
    Tuple of (grad_input, grad_reduce_op, grad_group_size, grad_group_name)
    grad_reduce_op, grad_group_size, grad_group_name are None (not differentiable)
rÀ   zCreduce_scatter_tensor backward only supports 'sum' reduction, got 'r¿   N)
rÂ   rB   rÃ   rÄ   r   r   r   r:   rÅ   r   )r¶   r²   rÂ   rB   rÃ   rº   s   &&    r   Úreduce_scatter_tensor_backwardrÓ   é  s‰   € ð —‘€JØ—‘€JØ—‘€Ið �EÔÜØQÐR[ÐQ\Ð\]Ð^ó
ð 	
ô
 �Y‰Y×'Ñ'×>Ñ>Ø×ÑÓ ØØó€Fô
 �vÓ  d¨DÐ0Ð0r   c                óR   € Vw  r4rVW`n         WPn        VP                  4       V n        R# )zÒ
Setup context for reduce_scatter_tensor backward.

Args:
    ctx: Context object to save state for backward
    inputs: Tuple of (input, reduce_op, group_size, group_name)
    output: Output from forward pass
N©rÂ   rB   r2   rÃ   )r¶   rz   rº   rÉ   rÃ   rB   rÂ   s   &&&    r   Ú#reduce_scatter_tensor_setup_contextrÖ     s&   € ð 06Ñ,€E�jØ„NØ„NØ—O‘OÓ%€C†Mr   z'_c10d_functional::reduce_scatter_tensorc                ó8   € V ^8„  d   QhR\         P                  /# r±   r³   )r'   s   "r   r(   r(   !  s   € ÷ 1ñ 1´·±ñ 1r   c                óÜ   € V P                   pV P                  pV P                  p\        P                  P
                  P                  VP                  4       VVV4      p\        V4      RRR3# )aÁ  
Backward for all_to_all_single: all_to_all with reversed split sizes.

Forward does all-to-all with specified split sizes, backward reverses them.

Args:
    ctx: Context object with group_name, output_split_sizes, and input_split_sizes
    grad_output: Gradient from downstream operations

Returns:
    Tuple of (grad_input, grad_output_split_sizes, grad_input_split_sizes, grad_group_name)
    All except grad_input are None (not differentiable)
N)	rÂ   r�   rž   r   r   r   r¬   rÅ   r   )r¶   r²   rÂ   r�   rž   rº   s   &&    r   Úall_to_all_single_backwardrÙ   !  sl   € ð —‘€JØ×/Ñ/ÐØ×-Ñ-Ðô �Y‰Y×'Ñ'×9Ñ9Ø×ÑÓ ØØØó	€Fô �vÓ  d¨DÐ0Ð0r   c                ó4   € Vw  r4rVW`n         W@n        WPn        R# )zÞ
Setup context for all_to_all_single backward.

Args:
    ctx: Context object to save state for backward
    inputs: Tuple of (input, output_split_sizes, input_split_sizes, group_name)
    output: Output from forward pass
N)rÂ   r�   rž   )r¶   rz   rº   rÉ   r�   rž   rÂ   s   &&&    r   Úall_to_all_single_setup_contextrÛ   =  s"   € ð @FÑ<€EÐ0Ø„NØ/ÔØ-Ör   z#_c10d_functional::all_to_all_singlez1_c10d_functional_autograd::all_gather_into_tensorz0_c10d_functional_autograd::reduce_scatter_tensorz,_c10d_functional_autograd::all_to_all_singlec                óN   € V ^8„  d   QhR\         \        P                  ,          /# ©r   Úgrad_outputs©r=   r   r#   )r'   s   "r   r(   r(   g  s   € ÷ =ñ =´T¼%¿,¹,Õ5Gñ =r   c                ó0  € V P                   pV P                  pVR8w  d   \        RV R24      h\        P                  P
                  P                  V Uu. uF  qDP                  4       NK  	  upVV4      p\        \        \        V4      4      RR3# u upi )a“  
Backward for all_reduce_coalesced: all_reduce each gradient.

Forward aggregates tensors, backward aggregates gradients.

Args:
    ctx: Context object with group_name and reduce_op
    grad_outputs: Gradients from downstream operations (one per input tensor)

Returns:
    Tuple of (grad_inputs..., grad_reduce_op, grad_group_name)
    grad_reduce_op and grad_group_name are None (not differentiable)
rÀ   zBall_reduce_coalesced backward only supports 'sum' reduction, got 'r¿   N)rÂ   rÃ   rÄ   r   r   r   ro   rÅ   r=   rp   r   )r¶   rÞ   rÂ   rÃ   r²   Úgrad_inputss   &&    r   Úall_reduce_coalesced_backwardrâ   g  s–   € ð —‘€JØ—‘€Ià�EÔÜØPÐQZÐP[Ð[\Ð]ó
ð 	
ô
 —)‘)×,Ñ,×AÑAÙ5AÓB±\ k×	Ñ	Ö	!±\ÑBØØó€Kô
 ””[ +Ó.Ó/°°tÐ<Ð<ùò	 	Cs   ÁBc                óF   € Vw  r4pWPn         VP                  4       V n        R# )zË
Setup context for all_reduce_coalesced backward.

Args:
    ctx: Context object to save state for backward
    inputs: Tuple of (tensor_list, reduce_op, group_name)
    output: Output from forward pass
NrÈ   )r¶   rz   rº   rq   rÃ   rÂ   s   &&&   r   Ú"all_reduce_coalesced_setup_contexträ   †  s!   € ð *0Ñ&€K˜JØ„NØ—O‘OÓ%€C†Mr   z&_c10d_functional::all_reduce_coalescedc                óN   € V ^8„  d   QhR\         \        P                  ,          /# rÝ   rß   )r'   s   "r   r(   r(   ›  s   € ÷ =ñ =ÄÄeÇlÁlÕASñ =r   c                ó  € V P                   pV P                  p\        P                  P                  P                  V Uu. uF  qDP                  4       NK  	  upRVV4      p\        \        \        V4      4      RR3# u upi )aÈ  
Backward for all_gather_into_tensor_coalesced: reduce_scatter each gradient.

Forward gathers tensors from all ranks, backward scatters gradients back
with sum reduction.

Args:
    ctx: Context object with group_name and group_size
    grad_outputs: Gradients from downstream operations (one per input tensor)

Returns:
    Tuple of (grad_inputs..., grad_group_size, grad_group_name)
    grad_group_size and grad_group_name are None (not differentiable)
rÀ   N)
rÂ   rB   r   r   r   rƒ   rÅ   r=   rp   r   )r¶   rÞ   rÂ   rB   r²   rá   s   &&    r   Ú)all_gather_into_tensor_coalesced_backwardrç   ›  su   € ð —‘€JØ—‘€Jô —)‘)×,Ñ,×LÑLÙ5AÓB±\ k×	Ñ	Ö	!±\ÑBØØØó	€Kô ””[ +Ó.Ó/°°tÐ<Ð<ùò 	Cs   Á A>c                ó(   € Vw  r4pWPn         W@n        R# )zØ
Setup context for all_gather_into_tensor_coalesced backward.

Args:
    ctx: Context object to save state for backward
    inputs: Tuple of (tensor_list, group_size, group_name)
    output: Output from forward pass
NrÏ   )r¶   rz   rº   rq   rB   rÂ   s   &&&   r   Ú.all_gather_into_tensor_coalesced_setup_contextré   ·  s   € ð +1Ñ'€K˜ZØ„NØ†Nr   z2_c10d_functional::all_gather_into_tensor_coalescedc                óN   € V ^8„  d   QhR\         \        P                  ,          /# rÝ   rß   )r'   s   "r   r(   r(   Ì  s   € ÷ Cñ CÄÄUÇ\Á\Õ@Rñ Cr   c                óJ  € V P                   pV P                  pV P                  pVR8w  d   \        RV R24      h\        P
                  P                  P                  V Uu. uF  qUP                  4       NK  	  upVV4      p\        \        \        V4      4      RRR3# u upi )aé  
Backward for reduce_scatter_tensor_coalesced: all_gather each gradient.

Forward reduces and scatters tensors to ranks, backward gathers gradients
from all ranks.

Args:
    ctx: Context object with group_name, group_size, and reduce_op
    grad_outputs: Gradients from downstream operations (one per input tensor)

Returns:
    Tuple of (grad_inputs..., grad_reduce_op, grad_group_size, grad_group_name)
    grad_reduce_op, grad_group_size, grad_group_name are None (not differentiable)
rÀ   zMreduce_scatter_tensor_coalesced backward only supports 'sum' reduction, got 'r¿   N)rÂ   rB   rÃ   rÄ   r   r   r   rv   rÅ   r=   rp   r   )r¶   rÞ   rÂ   rB   rÃ   r²   rá   s   &&     r   Ú(reduce_scatter_tensor_coalesced_backwardrì   Ì  s£   € ð —‘€JØ—‘€JØ—‘€Ið �EÔÜØ[Ð\eÐ[fÐfgÐhó
ð 	
ô
 —)‘)×,Ñ,×MÑMÙ5AÓB±\ k×	Ñ	Ö	!±\ÑBØØó€Kô
 ””[ +Ó.Ó/°°t¸TÐBÐBùò	 	Cs   Á"B c                óR   € Vw  r4rVW`n         WPn        VP                  4       V n        R# )zâ
Setup context for reduce_scatter_tensor_coalesced backward.

Args:
    ctx: Context object to save state for backward
    inputs: Tuple of (tensor_list, reduce_op, group_size, group_name)
    output: Output from forward pass
NrÕ   )r¶   rz   rº   rq   rÃ   rB   rÂ   s   &&&    r   Ú-reduce_scatter_tensor_coalesced_setup_contextrî   î  s&   € ð 6<Ñ2€K˜JØ„NØ„NØ—O‘OÓ%€C†Mr   z1_c10d_functional::reduce_scatter_tensor_coalescedc          
      ó’   € V ^8„  d   QhR\         P                  R\        \        ,          R\        R\
        R\         P                  /# )r   r   Úsrc_dstr    r!   r6   rŸ   )r'   s   "r   r(   r(     sM   € ÷ Vñ VÜ
�,‰,ðVä”#�YðVô ðVô 
ð	Vô
 ‡\�\ñVr   c                ón  € \        W#4      w  rEp\        P                  ! WEV4      p^ .V,          p^ .V,          p	\        V4       Fa  w  r«V
\        P
                  ! V4      8X  d   V P                  4       W›&   V\        P
                  ! V4      8X  g   KO  V P                  4       WŠ&   Kc  	  \        WW’V4      # )aþ  
Permutes the elements of the tensor according to the given source/destination pairs. `src_dst` should
be defined such that src_dst[m] == n means m sends to n.

Group can be one of:
    List[int]: ranks participating in the collective.
    List[List[int]]: 2D mesh of ranks taking part of this collective in MPMD.
    ProcessGroup: Will perform a collective using the ranks and tag of the PG.
    DeviceMesh: Do a SPMD collective over all ranks of the mesh
    (DeviceMesh, int): Do a MPMD collective over one
)Ú_expand_groupr8   Ú#_find_or_create_pg_by_ranks_and_tagr   ÚdistÚget_rankÚnumelr¬   )r   rð   r    r!   ÚtÚranksetrB   Úlocal_pgr�   rž   r   Údsts   &&&&        r   Úpermute_tensorrû     s£   € ô" +¨5Ó6Ñ€A�
Ü×7Ò7¸ÀJÓO€Hà˜˜zÕ)ÐØ˜˜jÕ(ÐÜ˜gÖ&‰ˆØ”$—-’- Ó)Ô)Ø%)§Z¡Z£\ÐÑ"Ø”$—-’- Ó)Ö)Ø&*§j¡j£lÐÓ#ñ	 'ô ˜TÐ7HÐQTÓUÐUr   c                   óÐ   a € ] tR tRt o RtRR.t]V 3R lR l4       tR tR t	]R	 4       t
RV 3R lR lltV 3R lR ltR tV 3R lR ltR t]RR l4       tR tV 3R ltRtV tR
# )r<   i#  a˜  
A Tensor wrapper subclass that is used to trigger a call to wait
prior to first use of the underlying tensor.
Use it inside functional collective pytorch wrappers like the following:
def functional_collective(self, group, tag):
    tag, rankset, group_size = _expand_group(group, tag)
    tensor = torch.ops.c10d_functional.{collective}(self, tag, rankset, group_size)
    return _maybe_wrap_tensor(tensor)
ÚelemÚ	completedc                ó4   <€ V ^8„  d   QhRS[ P                  /# )r   rý   r³   )r'   Ú__classdict__s   "€r   r(   Ú"AsyncCollectiveTensor.__annotate__4  s   ø€ ÷ ñ ™5Ÿ<™<ñ r   c                ó  € \         P                  P                  V VP                  4       VP	                  4       VP                  4       VP                  VP                  VP                  VP                  R 7      pWn
        RVn        V# ))ÚstridesÚstorage_offsetÚdtypeÚlayoutÚdeviceÚrequires_gradF)r   r#   Ú_make_wrapper_subclassrU   Ústrider  r  r  r  r  rý   rþ   )Úclsrý   Úrs   && r   Ú__new__ÚAsyncCollectiveTensor.__new__3  sm   € ä�L‰L×/Ñ/ØØ�I‰I‹KØ—K‘K“MØ×.Ñ.Ó0Ø—*‘*Ø—;‘;Ø—;‘;Ø×,Ñ,ð 0ó 	
ˆð ŒØˆŒØˆr   c                ó   € R .R3# )rý   Nr   ©r   s   &r   Ú__tensor_flatten__Ú(AsyncCollectiveTensor.__tensor_flatten__C  s   € Øˆx˜ˆ~Ðr   c                ó>   € V P                  4       P                  4       # r¢   )Útrigger_waitÚtolistr  s   &r   r  ÚAsyncCollectiveTensor.tolistF  s   € Ø× Ñ Ó"×)Ñ)Ó+Ð+r   c                óH   € Ve   \        R4      hV R,          p\        V4      # )Nz5meta must be None for AsyncCollectiveTensor unflattenrý   )rV   r<   )Úinner_tensorsÚmetaÚ
outer_sizeÚouter_striderý   s   &&&& r   Ú__tensor_unflatten__Ú*AsyncCollectiveTensor.__tensor_unflatten__I  s/   € àÒÜ ØGóð ð ˜VÕ$ˆÜ$ TÓ*Ð*r   Nc                ó4   <€ V ^8„  d   QhRS[ RS[R,          /# )r   Úexpected_metadataÚexpected_typeN)r   r�   )r'   r   s   "€r   r(   r  R  s!   ø€ ÷ #ñ #Ù!$ð#Ù59¸Dµ[ñ#r   c                óN   € V\         P                  Jd   R # V P                  4       # r¢   )r   r#   r  )r   r  r   s   &&&r   Ú#__coerce_same_metadata_as_tangent__Ú9AsyncCollectiveTensor.__coerce_same_metadata_as_tangent__R  s"   € ð ¤§¡Ó,Ùà× Ñ Ó"Ð"r   c                ó    <€ V ^8„  d   QhRS[ /# ©r   r6   )r&   )r'   r   s   "€r   r(   r  Z  s   ø€ ÷ ?ñ ?™#ñ ?r   c                ó*   € R V P                  4        R2# )zAsyncCollectiveTensor(rR   )r  r  s   &r   Ú__repr__ÚAsyncCollectiveTensor.__repr__Z  s   € Ø'¨×(9Ñ(9Ó(;Ð'<¸AÐ>Ð>r   c                óz   € V P                   '       g   \        V P                  4      pR V n         V# V P                  # ©T)rþ   r   rý   )r   Úouts   & r   r  Ú"AsyncCollectiveTensor.trigger_wait]  s/   € Ø�~�~ˆ~Ü˜dŸi™iÓ(ˆCØ!ˆDŒNØˆJà—9‘9Ðr   c                ó4   <€ V ^8„  d   QhRS[ P                  /# r%  r³   )r'   r   s   "€r   r(   r  e  s   ø€ ÷ &ñ &‘e—l‘lñ &r   c                ó,   € \        V P                  4      # r¢   )r   rý   r  s   &r   rA   ÚAsyncCollectiveTensor.waite  s   € Ü˜4Ÿ9™9Ó%Ð%r   c                ó   € V P                   # )zOThis method enables  _functional_collectives_impl to test if a tensor is an ACS)rý   r  s   &r   Ú_get_acs_underlying_tensorÚ0AsyncCollectiveTensor._get_acs_underlying_tensorh  s   € à�y‰yÐr   c                ó�  a€ V\         P                  P                  P                  P                  J d/   V! V^ ,          P
                  V^,          4      p\        V4      pV# \        V4      oR V3R llpR R lp\        \        Ws4      p	\        \        Wt4      p
V! V	/ V
B pS'       d   \        \         P                  W‹4      pV# )r   c                ó$   € V ^8„  d   QhR\         /# ©r   Úe©r<   )r'   s   "r   r(   Ú>AsyncCollectiveTensor.__torch_dispatch__.<locals>.__annotate__x  s   € ÷ 	ñ 	Ô+ñ 	r   c                 óL   <€ S'       g   V P                  4       # V P                  # r¢   )r  rý   )r6  Ú
is_view_ops   &€r   ÚunwrapÚ8AsyncCollectiveTensor.__torch_dispatch__.<locals>.unwrapx  s   ø€ çØ—~‘~Ó'Ð'Ø—6‘6ˆMr   c                ó8   € V ^8„  d   QhR\         P                  /# r5  r³   )r'   s   "r   r(   r8  ~  s   € ÷ 	ñ 	”E—L‘Lñ 	r   c                 ó^   € \        V \        4      '       d   \        R 4      h\        V 4      pV# )zICannot wrap an AsyncCollectiveTensor inside another AsyncCollectiveTensor)r;   r<   rV   )r6  rC   s   & r   ÚwrapÚ6AsyncCollectiveTensor.__torch_dispatch__.<locals>.wrap~  s1   € ä˜!Ô2×3Ò3Ü$Ø_óð ô (¨Ó*ˆCØˆJr   )
r   r   ÚatenÚviewÚdefaultrý   r<   rš   r   r#   )r  ÚfuncÚtypesÚargsÚkwargsrC   Úwrapper_resr;  r?  Úunwrapped_argsÚunwrapped_kwargsr+  r:  s   &&&&&       @r   Ú__torch_dispatch__Ú(AsyncCollectiveTensor.__torch_dispatch__l  s«   ø€ à”5—9‘9—>‘>×&Ñ&×.Ñ.Ó.ñ �t˜A•w—|‘| T¨!¥WÓ-ˆCÜ/°Ó4ˆKØÐä  Ó&ˆ
÷	ð 	õ	ô 'Ô'<¸fÓKˆÜ(Ô)>ÀÓOÐñ �NÐ7Ð&6Ñ7ˆ÷ Ü¤§¡¨dÓ8ˆCàˆ
r   c                ó>   € V P                  4       P                  4       # r¢   )rA   Únumpyr  s   &r   rN  ÚAsyncCollectiveTensor.numpy“  s   € Ø�y‰y‹{× Ñ Ó"Ð"r   c                óF   <€ V ^8„  d   Qh/ S[ P                  ;R&   S[;R&   # )r   rý   rþ   )r   r#   Úbool)r'   r   s   "€r   r(   r  #  s"   ø‡ ‚ ñ �,‰,Ññ ñ �Oò r   )rþ   r¢   ©r   N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__Ú	__slots__Ústaticmethodr  r  r  r  r"  r'  r  rA   r1  ÚclassmethodrK  rN  Ú__annotate_func__Ú__static_attributes__Ú__classdictcell__©r   s   @r   r<   r<   #  s�   ø‡ € ñð ˜Ð%€Ià÷ó ðòò,ð ñ+ó ð+÷#ò #÷?ð ?ò÷&ð &òð ó$ó ð$òL#÷a ƒ r   r<   c          	      ó~   € V ^8„  d   QhR\         R\        R\        \        \        \        ,          \        3,          /# ©r   r    r!   r6   )r%   r&   Útupler=   r$   )r'   s   "r   r(   r(   œ  s6   € ÷ L&ñ L&œð L&¬#ð L&´u¼SÄ$ÄsÅ)ÌSÐ=PÕ7Qñ L&r   c           	     ó  € \         '       d   R pR pMR pR p\        V \        4      '       d—   \        V ^ ,          \        4      '       de   V! V 4      p. pR
pV FP  pVP                  V4       VR
8w  d+   V\	        V4      8w  d   \        RV R\	        V4       24      h\	        V4      pKR  	  EM×V! V 4      p\	        V4      pEMÂ\        V \        P                  4      '       dD   \        P                  ! V 4      p\	        V4      pT;'       g    \        P                  ! V 4      pEM_\        V \        4      '       do   V P                  ^8w  d   \        R4      hV P                  4       p\        P                  ! V4      p\	        V4      pT;'       g    \        P                  ! V4      pMÛ\        V \        4      '       d»   \	        V 4      ^8X  d    \        V ^ ,          \        4      '       dƒ   \        V ^,          \         4      '       df   V ^ ,          p	V ^,          p
V	P                  V
4      p\        P                  ! V4      p\	        V4      pT;'       g    \        P                  ! V4      pM\        R4      h\        R	4      hWV3# )a%  
_expand_group desugars the different RANK_TYPES types into a canonical format that is traceable.

By having this be part of the explicit eager codepath, we avoid having to specialize behavior inside
torchdynamo and can still interoperate with processgroup objects or other untraceable forms.
c                 óN   € \        \        \        \        ,          ,          V 4      # r¢   ©r   r=   r$   ©Úxs   &r   Úcast_listlistintÚ'_expand_group.<locals>.cast_listlistint¨  s   € ÜœœT¤#�Y�¨Ó+Ð+r   c                 ó8   € \        \        \        ,          V 4      # r¢   rd  re  s   &r   Úcast_listintÚ#_expand_group.<locals>.cast_listint«  s   € ÜœœS�	 1Ó%Ð%r   c                 ó   € V # r¢   r   re  s   &r   rg  rh  ²  ó   € ØˆHr   c                 ó   € V # r¢   r   re  s   &r   rj  rk  µ  rm  r   z$group sizes must be identical found z and úJOnly 1D mesh is supported, pass in (DeviceMesh, int) together if mesh > 1Dz1Invalid tuple for group must be (DeviceMesh, int)z[Invalid type for group, must be one of List, Processgroup, DeviceMesh or (DeviceMesh, int).éÿÿÿÿ)r   r;   r=   Úextendr~   Ú
ValueErrorrô   ÚProcessGroupÚget_process_group_ranksr8   Ú_get_group_tagr	   ÚndimrV   Ú	get_groupra  r$   )r    r!   rg  rj  Únested_listrø   rB   ÚrsÚpgÚdmeshr}   s   &&         r   rò   rò   œ  s  € ÷ ƒ}ò	,ó	&ò	ò	ô �%œ×ÒÜ�e˜A•h¤×%Ò%Ù*¨5Ó1ˆKØˆGØˆJÛ!�Ø—‘˜rÔ"Ø Ô#¨
´c¸"³gÔ(=Ü$Ø>¸z¸lÈ%ÔPSÐTVÓPWÈyÐYóð ô ! ›W’
ó "ñ # 5Ó)ˆGÜ˜W›ŠJÜ	�Eœ4×,Ñ,×	-Ò	-Ü×.Ò.¨uÓ5ˆÜ˜“\ˆ
Ø×/Ð/”T×(Ò(¨Ó/ŠÜ	�Eœ:×	&Ò	&Ø�:‰:˜Œ?Ü Ø\óð ð �_‰_ÓˆÜ×.Ò.¨rÓ2ˆÜ˜“\ˆ
Ø×,Ð,”T×(Ò(¨Ó,‰Ü	�Eœ5×	!Ò	!ä�‹J˜!ŒOÜ˜5 �8¤Z×0Ò0Ü˜5 �8¤S×)Ò)à˜!•HˆEØ˜•(ˆCØ—‘ Ó%ˆBÜ×2Ò2°2Ó6ˆGÜ˜W›ˆJØ×0Ð0œ×,Ò,¨RÓ0‰CäÐPÓQÐQäØió
ð 	
ð ˜*Ð%Ð%r   c                óz   € V ^8„  d   QhR\         R\        R\        P                  \        P
                  ,          /# r`  )r%   r&   rô   rs  r8   Ú	GroupName)r'   s   "r   r(   r(   ë  s8   € ÷ 8Lñ 8LÜð8LÜð8Lä	×ÑœŸ™Õ'ñ8Lr   c                ó  € \        V \        P                  4      '       d   V # \        V \        4      '       d   \	        \
        P                  V 4      pV# \        V \        4      '       d„   V P                  ^8w  d   \        R4      h\        P                  P                  P                  '       d+   \        P                  P                  P!                  V ^ 4      # V P"                  ^ ,          # \        V \$        4      '       dó   \'        V 4      ^8X  d³   \        V ^ ,          \        4      '       d–   \        V ^,          \(        4      '       dy   V ^ ,          pV ^,          p\        P                  P                  P                  '       d*   \        P                  P                  P!                  W44      # VP"                  V,          # \+        R\-        V ^ ,          4      \-        V ^,          4      3 24      h\        V \.        4      '       d^   \1        4       '       g   \2        P4                  ! R\6        ^R7       \
        P8                  ! \	        \.        \(        ,          V 4      V4      # \+        R\-        V 4       RV  24      h)zA
Given group in RANK_TYPES, return a ProcessGroup or group name.
ro  z?Invalid tuple for group must be (DeviceMesh, int). Instead got z—The combination of ranks + tag as process group identifier has been deprecated. Please switch to using ProcessGroup, DeviceMesh, or group name instead.r   zUnsupported group type: z, )r;   rô   rs  r&   r   r8   r}  r	   rv  rV   r   r_   ÚconfigÚcompile_on_one_rankr   Ú_dtensorÚmesh_get_process_groupÚ_dim_group_namesra  r~   r$   rr  r�   r=   r   ra   rb   rc   Ú$_resolve_group_name_by_ranks_and_tag)r    r!   rÂ   r{  r}   s   &&   r   r*   r*   ë  së  € ô �%œ×*Ñ*×+Ò+ØˆÜ	�Eœ3×	Ò	ô œ$Ÿ.™.¨%Ó0ˆ
ØÐÜ	�Eœ:×	&Ò	&Ø�:‰:˜Œ?Ü Ø\óð ô �>‰>× Ñ ×4×4Ð4Ü—9‘9×%Ñ%×<Ñ<¸UÀAÓFÐFØ×%Ñ% aÕ(Ð(Ü	�Eœ5×	!Ò	!ä�‹J˜!ŒOÜ˜5 �8¤Z×0Ò0Ü˜5 �8¤S×)Ò)à˜!•HˆEØ˜•(ˆCÜ�~‰~×$Ñ$×8×8Ð8Ü—y‘y×)Ñ)×@Ñ@ÀÓLÐLØ×)Ñ)¨#Õ.Ð.äØQÔSWÐX]Ð^_ÕX`ÓSaÔcgÐhmÐnoÕhpÓcqÐRrÐQsÐtóð ô 
�Eœ4×	 Ò	 Ü'×)Ò)Ü�MŠMðIô Øõô ×8Ò8ä””c•˜EÓ"Øó
ð 	
ô Ð3´D¸³K°=ÀÀ5À'ÐJÓKÐKr   c                óP   € V ^8„  d   QhR\         R\        R\        P                  /# r`  )r%   r&   r8   r}  )r'   s   "r   r(   r(   &  s%   € ÷  ñ  œzð  ´ð  ¼T¿^¹^ñ  r   c                óˆ   € \        W4      p \        V \        4      '       d   \        P                  ! V 4      # V P
                  # )z3
Given group in RANK_TYPES, return the group name.
)r*   r;   r&   r8   r}  rÂ   )r    r!   s   &&r   Ú_resolve_group_namer‡  &  s6   € ô ˜5Ó&€EÜ�%œ×ÒÜ�~Š~˜eÓ$Ð$à×ÑÐr   z'_c10d_functional::_wrap_tensor_autogradz(Tensor input) -> Tensor)Úmutates_argsr˜   c                óX   € V ^8„  d   QhR\         P                  R\         P                  /# ©r   rÉ   r6   r³   )r'   s   "r   r(   r(   6  s"   € ÷ (ñ (¤§¡ð (´%·,±,ñ (r   c                ó   € \        V 4      # )aO  
Custom op that allows autograd to propagate
from a normal Tensor to an AsyncCollectiveTensor.

This is the low-level implementation. Users should call _maybe_wrap_tensor directly.

Args:
    input: Input tensor to wrap in AsyncCollectiveTensor

Returns:
    AsyncCollectiveTensor wrapping the input (or wait_tensor result if tracing)
r7  ©rÉ   s   &r   Ú_wrap_tensor_autogradr�  1  s   € ô$ ! Ó'Ð'r   c                óX   € V ^8„  d   QhR\         P                  R\         P                  /# rŠ  r³   )r'   s   "r   r(   r(   G  s"   € ÷ #ñ #ŒU�\‰\ð #œeŸl™lñ #r   c                ó.   € \         P                  ! V 4      # )z(
Meta kernel for _wrap_tensor_autograd.
©r   Ú
empty_likerŒ  s   &r   Ú_r’  F  s   € ô
 ×Ò˜EÓ"Ð"r   c                ó8   € V ^8„  d   QhR\         P                  /# r±   r³   )r'   s   "r   r(   r(   N  s   € ÷ ñ ´U·\±\ñ r   c                ó   € V# )a  
Backward for _wrap_tensor_autograd: identity (no-op).

The wrapping is just for async optimization, gradients flow through unchanged.

Args:
    ctx: Context object (unused)
    grad_output: Gradient from downstream operations

Returns:
    Gradient unchanged (identity)
r   rµ   s   &&r   Ú_wrap_tensor_autograd_backwardr•  N  s
   € ð Ðr   c                ó   € R# )zÂ
Setup context for _wrap_tensor_autograd backward.

Args:
    ctx: Context object to save state for backward (nothing to save)
    inputs: Tuple of (input,)
    output: Output from forward pass
Nr   r¹   s   &&&r   Ú#_wrap_tensor_autograd_setup_contextr—  ^  s   € ñ r   c                ó$   € V ^8„  d   QhR\         /# r%  ©rQ  )r'   s   "r   r(   r(   p  s   € ÷ (ñ (œñ (r   c                  óZ  € \        4       '       d   R # \        P                  P                  \        P                  P                  P
                  4      e   R # \        P                  P                  \        P                  P                  P                  4      '       d   R # \        4       RJ# )TN)
r   r   rŽ   Ú_get_dispatch_modeÚ_TorchDispatchModeKeyÚFAKEÚ&_dispatch_tls_is_dispatch_key_includedr‘   ÚPythonDispatcherr
   r   r   r   Ú_are_we_tracingr   p  ss   € Ü×!Ò!Ùä‡x�x×"Ñ"¤5§8¡8×#AÑ#A×#FÑ#FÓGÒSÙä‡x�x×6Ñ6Ü�‰×Ñ×-Ñ-÷ò ñ ÜÓ 4Ð'Ð'r   c                ó8   € V ^8„  d   QhR\         P                  /# r%  r³   )r'   s   "r   r(   r(   ~  s   € ÷ 'ñ '¤§¡ñ 'r   c                 óN   € \        4       '       d   \        V 4      # \        V 4      # r¢   )r   r   r�  r  s   &r   r-   r-   ~  s!   € Ü×ÒÜ˜4Ó Ð Ü  Ó&Ð&r   c                ó$   € V ^8„  d   QhR\         /# )r   Úvaluer™  )r'   s   "r   r(   r(   …  s   € ÷ #
ñ #
¼ñ #
r   c              #  óh  "  € \         P                  P                  P                  4       p \         P                  P                  P	                  V 4       Rx € \         P                  P                  P	                  V4       R#   \         P                  P                  P	                  T4       i ; i5i)aï  
Context manager to temporarily set whether inflight collectives are allowed as torch.compile graph inputs.
Common use case is when the collective is issued in eager (with `async_op=True`) but waited in compiled region:
```
def all_reduce_eager(x):
    y = x * x
    req = dist.all_reduce(y, op=dist.ReduceOp.SUM, async_op=True)
    return y


@torch.compile(fullgraph=True)
def all_reduce_wait_compiled(y):
    torch.ops.c10d_functional.wait_tensor(y)
    return y * y


x = torch.ones(1280, 1280, device="cuda") + self.rank
# the context manager ensures that `wait_tensor(y)` will wait on the correct work object
with allow_inflight_collective_as_graph_input_ctx():
    y = all_reduce_eager(x)
    z = all_reduce_wait_compiled(y)
```
With this context manager, when a collective is called, under the hood the work object of the collective
will be registered in the work registry, and the wait_tensor() in compiled region called on
the output tensor of the collective will wait on the correct work object.
N)r   rŽ   Ú_distributed_c10dÚ)_allow_inflight_collective_as_graph_inputÚ-_set_allow_inflight_collective_as_graph_input)r¤  Úpreviouss   & r   Ú,allow_inflight_collective_as_graph_input_ctxrª  „  sv   é € ô8 �x‰x×)Ñ)×SÑSÓU€Hð
Ü�‰×"Ñ"×PÑPÐQVÔWÛä�‰×"Ñ"×PÑPØö	
øŒ�‰×"Ñ"×PÑPØõ	
üs   ‚)B2¬-B Á+B2Â+B/Â/B2c                 óÈ   € \        V P                  4       4      p\        V4      ^ 8X  d   VP                  V4       MV^ ;;,          V,          uu&   V P	                  V4      pV# ©r   )r=   rU   r~   ÚappendÚ	new_empty)rÉ   rB   Úout_sizeÚ
out_tensors   &&  r   Ú_make_all_gather_out_tensorr±  «  sL   € Ü�E—J‘J“LÓ!€HÜ
ˆ8ƒ}˜ÔØ�‰˜
Õ#à���zÕ!‹Ø—‘ Ó*€JØÐr   c                 óB   € V  Uu. uF  p\        WC4      NK  	  up# u upi r¢   ©r±  )r   r!   rø   rB   r÷   s   &&&& r   Ú&_all_gather_into_tensor_coalesced_metar´  µ  s    € Ù@DÓEÁ¸1Ô'¨Ö6ÁÑEÐEùÒEs   …c                 ó.   € \         P                  ! V 4      # r¢   r�  ©r   rF  s   &*r   Ú_broadcast_metar·  º  ó   € Ü×Ò˜DÓ!Ð!r   c                 óN   € \         P                  ! V \         P                  R 7      # ))Úmemory_format)r   r‘  Úcontiguous_formatr¶  s   &*r   Ú_all_reduce_metar¼  ¾  s   € Ü×Ò˜D´×0GÑ0GÔHÐHr   c                 ó.   € \         P                  ! V 4      # r¢   r�  r¶  s   &*r   Ú_wait_tensor_metar¾  Â  r¸  r   c                 ó\   € \         P                  ! ^ V P                  V P                  R7      # )r   ©r  r  )r   Úemptyr  r  r¶  s   &*r   Ú_isend_metarÂ  Æ  s   € Ü�;Š;�q §
¡
°4·;±;Ô?Ð?r   c                 ó.   € \         P                  ! V 4      # r¢   r�  r¶  s   &*r   Ú_irecv_metarÄ  Ê  r¸  r   c           
      ó´   € \        W4       UUu. uF;  w  rVVR 8X  d   TM,\        P                  ! ^ VP                  VP                  R7      NK=  	  upp# u uppi )ÚirecvrÀ  )r€   r   rÁ  r  r  )Úop_listÚ	peer_listÚtag_listÚtensorsrÂ   Úopr÷   s   &&&&&  r   Ú_batch_p2p_ops_metarÌ  Î  sP   € ô ˜Ô*ôá*‰EˆBð �7Œ]‰¤§¢¨A°Q·W±WÀQÇXÁXÔ NÒNÙ*òð ùó s   �AAc                 ó   € \        W4      # r¢   r³  )Úshardr!   rø   rB   s   &&&&r   Ú_all_gather_into_tensor_metarÏ  Õ  ó   € Ü& uÓ9Ð9r   c                 ó€   € \        V P                  4       4      pV^ ;;,          V,          uu&   V P                  V4      # r¬  ©r=   rU   r®  )rÉ   rÃ   r!   rø   rB   r¯  s   &&&&& r   Ú_reduce_scatter_tensor_metarÓ  Ù  s/   € Ü�E—J‘J“LÓ!€HØˆQ‡K�JÕƒKØ�?‰?˜8Ó$Ð$r   c                 óX   € V  Uu. uF  p\         P                  ! V4      NK  	  up# u upi r¢   r�  )r   rF  r÷   s   &* r   Ú_all_reduce_coalesced_metarÕ  ß  s%   € Ù)-Ó.© AŒE×Ò˜QÖ©Ñ.Ð.ùÒ.s   …'c                 ó   € V # r¢   r   ©ÚinprF  s   &*r   Ú_all_reduce__metarÙ  ã  ó   € Ø€Jr   c                 ó   € V # r¢   r   r×  s   &*r   Ú_broadcast__metarÜ  ç  rÚ  r   c                 ó   € V # r¢   r   )rz   rF  s   &*r   Ú_all_reduce_coalesced__metarÞ  ë  s   € Ø€Mr   c                 óH   a€ V3R  lpV  Uu. uF
  qe! V4      NK  	  up# u upi )c                 ó†   <€ \        V P                  4       4      pV^ ;;,          S,          uu&   V P                  V4      pV# r¬  rÒ  )rÉ   r¯  r°  rB   s   &  €r   Úmk_out_tensorÚ<_reduce_scatter_tensor_coalesced_meta.<locals>.mk_out_tensorð  s5   ø€ Ü˜Ÿ
™
›Ó%ˆØ��˜
Õ"‹Ø—_‘_ XÓ.ˆ
ØÐr   r   )rz   r/   r!   rø   rB   rá  r÷   s   &&&&f  r   Ú%_reduce_scatter_tensor_coalesced_metarã  ï  s'   ø€ õñ '-Ó-¡f ˆM˜!Ö¡fÑ-Ð-ùÒ-s   Œc                 óü   € Vf    V P                  V P                  4       4      # V F  p\        P                  ! V^ 8¬  4       K  	  \	        V P                  4       4      p\        V4      V^ &   V P                  V4      # r¢   )r®  rU   r   Ú_checkr=   rÀ   )rÉ   r�   rž   rF  rG  Úsr¯  s   &&&*,  r   Ú_all_to_all_single_metarç  þ  sg   € ð Ò!Ø�‰˜uŸz™z›|Ó,Ð,ã#ˆAÜ�LŠL˜˜a™Ö ñ $ä˜Ÿ
™
›Ó%ˆÜÐ,Ó-ˆ�‰Ø�‰˜xÓ(Ð(r   c                ó   € \        W4      # r¢   r³  )rÉ   rB   rÂ   r+  s   &&&$r   Ú'_all_gather_into_tensor_out_native_metaré    rÐ  r   c                 ó   € \        W4      # r¢   r³  )rÉ   rB   rÂ   s   &&&r   Ú#_all_gather_into_tensor_native_metarë    rÐ  r   c                 óD   € V  Uu. uF  p\        W1V4      NK  	  up# u upi r¢   )rë  )rz   rB   rÂ   rÉ   s   &&& r   Ú-_all_gather_into_tensor_coalesced_native_metarí    s0   € ñ óáˆEô 	,¨E¸zÖJÙñð ùò ó   …c                 ó€   € \        V P                  4       4      pV^ ;;,          V,          uu&   V P                  V4      # r¬  rÒ  )rØ  rÃ   rB   rÂ   r>   s   &&&& r   Ú"_reduce_scatter_tensor_native_metarð    s/   € Ü�—‘“Ó€EØ	ˆ!‡H�ÕƒHØ�=‰=˜ÓÐr   c                ó€   € \        V P                  4       4      pV^ ;;,          V,          uu&   V P                  V4      # r¬  rÒ  )rØ  rÃ   rB   rÂ   r+  r>   s   &&&&$ r   Ú&_reduce_scatter_tensor_out_native_metarò     s1   € ô �—‘“Ó€EØ	ˆ!‡H�ÕƒHØ�=‰=˜ÓÐr   c           	      óD   € V  Uu. uF  p\        WAW#4      NK  	  up# u upi r¢   )rð  )rz   rÃ   rB   rÂ   rØ  s   &&&& r   Ú,_reduce_scatter_tensor_coalesced_native_metarô  (  s0   € ñ
 óáˆCô 	+¨3¸:ÖRÙñð ùò rî  r   ÚIMPLr1   ÚMetaÚall_reduce_ro   Úall_reduce_coalesced_r   ÚisendrÆ  Úbatch_p2p_opsÚall_gather_into_tensor_outr:   rv   rW   Úreduce_scatter_tensor_outrƒ   r¬   r+   Ú
broadcast_Ú_c10d_functional_autogradÚc10d_functionalÚDEFÚ(r’  )Útagsr’   c          
      ó|   € V ^8„  d   QhR\         P                  R\         P                  R\        R\        R\        /# )r   Úoutput_tensorÚinput_tensorÚasync_opr!   r5   )r   r#   rQ  r&   r$   )r'   s   "r   r(   r(   �  sI   € ÷ Xñ XÜ—<‘<ðXä—,‘,ðXô ð	Xô
 
ðXô ñXr   c                 óÄ   € V'       d   \        R 4      hT;'       g    \        P                  P                  pVf   \        R4      hV P	                  \        WW$4      4      # ©ú@Can't remap async version of inplace op to functional collectiveúgroup cannot be None)rV   rô   r    ÚWORLDÚcopy_rF   )r  r  r    r  r!   r5   s   &&&&&&r   Úall_gather_tensor_inplacer  �  sZ   € ÷ ÜØNó
ð 	
ð ×%Ð%”T—Z‘Z×%Ñ%€EØ‚}ÜÐ3Ó4Ð4à×ÑÔ0°È5ÓVÓWÐWr   rÀ   c                óˆ   € V ^8„  d   QhR\         P                  R\         P                  R\        R\        R\        R\        /# )r   rº   rÉ   rË  r  rN   r!   )r   r#   r&   rQ  r$   )r'   s   "r   r(   r(   ¤  sT   € ÷ Sñ SÜ�L‰LðSä�<‰<ðSô 	ðSô
 ðSô ðSô 
ñSr   c           	      óÆ   € V'       d   \        R 4      hT;'       g    \        P                  P                  pVf   \        R4      hV P	                  \        WWSV4      4      # r  )rV   rô   r    r  r  rX   )rº   rÉ   rË  r    r  rN   r!   s   &&&&&&&r   Úreduce_scatter_tensor_inplacer  ¤  sZ   € ÷ ÜØNó
ð 	
ð ×%Ð%”T—Z‘Z×%Ñ%€EØ‚}ÜÐ3Ó4Ð4à�<‰<Ô-¨e¸ÈSÓQÓRÐRr   rÁ   ÚproductÚminÚmaxÚbandÚborÚbxorc                ó\   € V ^8„  d   QhR\         P                  R\        R\        R\        /# )r   r   rË  r  r!   )r   r#   r&   rQ  )r'   s   "r   r(   r(   Å  s4   € ÷ <ñ <Ü�L‰Lð<äð<ô ð	<ô
 
ñ<r   c                 óÄ   € V'       d   \        R 4      hT;'       g    \        P                  P                  pVf   \        R4      hV P	                  \        WW$4      4      # r  )rV   rô   r    r  r  r1   )r   rË  r    r  r!   s   &&&&&r   Úall_reduce_inplacer  Å  sW   € ÷ ÜØNó
ð 	
ð ×%Ð%”T—Z‘Z×%Ñ%€EØ‚}ÜÐ3Ó4Ð4à�<‰<œ
 6¨uÓ:Ó;Ð;r   c                ód   € V ^8„  d   QhR\         P                  R\         P                  R\        /# )r   rº   rÉ   r!   )r   r#   r&   )r'   s   "r   r(   r(   Ø  s.   € ÷ ñ Ü�L‰Lðä�<‰<ðô 
ñr   c           	      óÊ   € V'       d   \        R 4      hT;'       g    \        P                  P                  pVf   \        R4      hV P	                  \        VVVVV4      4      # r  )rV   rô   r    r  r  r¬   )rº   rÉ   r�   rž   r    r  r!   s   &&&&&&&r   Úall_to_all_inplacer  Ø  si   € ÷ ÜØNó
ð 	
ð ×%Ð%”T—Z‘Z×%Ñ%€EØ‚}ÜÐ3Ó4Ð4à�<‰<ÜØØØØØó	
óð r   c                óz   € V ^8„  d   QhR\         \        P                  ,          R\        P                  R\        /# )r   rq   r   r!   )r=   r   r#   r&   )r'   s   "r   r(   r(   õ  s3   € ÷ "ñ "Ü”e—l‘lÕ#ð"ä�L‰Lð"ô
 
ñ"r   c                 ó”  a€ V'       d   \        R 4      hSP                  4       ^ 8w  dL   \        ;QJ d    V3R lV  4       F  '       d   K   RM	  RM! V3R lV  4       4      '       g   \        R4      hT;'       g    \        P                  P
                  pVf   \        R4      h\        S^ W$4      p. p^ pV  Fd  pVP                  4       ^ 8H  p	V	'       d   ^MVP                  ^ 4      p
V	'       d	   WW,          M	WWWz,            pVP                  V4       Wz,          pKf  	  \        W4       F  w  rÍVP                  V4       K  	  V # )r	  c              3   óh   <"  € T F'  qP                  ^ 4      SP                  ^ 4      8H  x € K)  	  R# 5i)r   N©rU   )r¦   r÷   r   s   & €r   r§   Ú%all_gather_inplace.<locals>.<genexpr>   s$   øé € Ð$VÉ+ÀQ§V¡V¨A£Y°&·+±+¸a³.Ö%@Ë+ùs   ƒ/2FTz7Remapping variable size all_gather is not yet supportedr
  )rV   r}   r«   rô   r    r  rF   rU   r­  r€   r  )rq   r   r    r  r!   rº   Úoutput_splitsÚoffsetr÷   Ú	is_scalarÚt_offsetr+  rú   r   s   &f&&&         r   Úall_gather_inplacer&  õ  s  ø€ ÷ ÜØNó
ð 	
ð ‡z�zƒ|�qÔ§£Ô$VÉ+Ó$V§§¢Ô$VÉ+Ó$V×!VÒ!VÜÐVÓWÐWà×%Ð%”T—Z‘Z×%Ñ%€EØ‚}ÜÐ3Ó4Ð4ä˜v q¨%Ó5€Fð €MØ€FÛˆØ—E‘E“G˜q‘Lˆ	ß!‘1 q§v¡v¨a£yˆç )ˆfŽn¨v¸vÕ?PÐ/QˆØ×Ñ˜SÔ!àÕŠñ ô ˜Ö3‰ˆØ�	‰	�#Žñ 4àÐr   c                óÀ   € V ^8„  d   QhR\         P                  R\        \         P                  ,          R\        R\        P
                  R,          R\        R\        /# )r   rº   Ú
input_listrË  r    Nr  r!   )r   r#   r=   r&   rô   rs  rQ  )r'   s   "r   r(   r(     sd   € ÷ Yñ YÜ�L‰LðYä”U—\‘\Õ"ðYô 	ðYô ×Ñ˜tÕ#ð	Yô
 ðYô 
ñYr   c           	      óJ  a € V'       d   \        R 4      h\        ;QJ d    V 3R lV 4       F  '       d   K   RM	  RM! V 3R lV 4       4      '       g   \        R4      hT;'       g    \        P                  P                  pVf   \        R4      hS P                  4       ^ 8X  dM   \        \        P                  ! V4      V^ W54      pS P                  VP                  S P                  4      4      # S P                  \        \        P                  ! V4      V^ W54      4      # )r	  c              3   ód   <"  € T F%  qP                  4       SP                  4       8H  x € K'  	  R # 5ir¢   r   )r¦   r÷   rº   s   & €r   r§   Ú)reduce_scatter_inplace.<locals>.<genexpr>&  s    øé € Ð=±*¨Q�v‰v‹x˜6Ÿ;™;›=Ö(³*ùs   ƒ-0FTzPreduce_scatter requires every input_list element to have the same size as outputr
  )rV   r«   rô   r    r  r}   rX   r   Ústackr  Úreshaper>   r‚   )rº   r(  rË  r    r  r!   Úresults   f&&&&& r   Úreduce_scatter_inplacer/    sÜ   ø€ ÷ ÜØNó
ð 	
÷ ‹3Ô=±*Ó=�3�3Š3Ô=±*Ó=×=Ò=ÜØ^ó
ð 	
ð ×%Ð%”T—Z‘Z×%Ñ%€EØ‚}ÜÐ3Ó4Ð4à‡z�zƒ|�qÔä&¤u§{¢{°:Ó'>ÀÀAÀuÓRˆØ�|‰|˜FŸN™N¨6¯<©<Ó8Ó9Ð9Ø�<‰<Ô-¬e¯iªi¸
Ó.CÀRÈÈEÓWÓXÐXr   c          
      ó˜   € V ^8„  d   QhR\         P                  R\        R,          R\        R\        P                  R,          R\        /# )r   r   rú   Nr!   r    Ú	group_dst©r   r#   r$   rô   rs  )r'   s   "r   r(   r(   6  sM   € ÷ &ñ &Ü�L‰Lð&ä	ˆt�ð&ô 
ð&ô ×Ñ˜tÕ#ð	&ô
 ñ&r   c                 ó~  € Vf   \         P                  P                  pVf   \        R4      hVR8w  d   Ve   \	        R4      hTpM&Ve   \
        P                  ! W14      pM\	        R4      h\        V4      p\        P                  P                  P                  WW&4      p \        4       '       d   V # \        V 4      # )Nr
  z@Cannot specify both 'dst' and 'group_dst' args as per eager implz(Must specify either 'dst' or 'group_dst'rp  )rô   r    r  rV   rr  r8   Úget_group_rankr‡  r   r   r   rù  r   r-   )r   rú   r!   r    r1  Ú	local_dstrÂ   s   &&&&&  r   Úisend_inplacer6  6  s¬   € ð ‚}Ü—
‘
× Ñ ˆØ‚}ÜÐ3Ó4Ð4Ø�B„ØŠ?ÜØRóð ð ‰	Ø	ŠÜ×'Ò'¨Ó3‰	äÐCÓDÐDä$ UÓ+€JÜ�Y‰Y×'Ñ'×-Ñ-¨fÀÓQ€FÜ×ÒØˆÜ˜fÓ%Ð%r   c          
      ó˜   € V ^8„  d   QhR\         P                  R\        R,          R\        R\        P                  R,          R\        /# )r   r   r   Nr!   r    Ú	group_srcr2  )r'   s   "r   r(   r(   S  sM   € ÷ &ñ &Ü�L‰Lð&ä	ˆt�ð&ô 
ð&ô ×Ñ˜tÕ#ð	&ô
 ñ&r   c                 óZ  € Vf   \         P                  P                  pVf   \        R4      hVR8w  d   Ve   \	        R4      hTpM&Ve   \
        P                  ! W14      pM\	        R4      h\        V4      p\        P                  P                  P                  WW&4      p \        V 4      # )Nr
  z@Cannot specify both 'src' and 'group_src' args as per eager implz(Must specify either 'src' or 'group_src'rp  )rô   r    r  rV   rr  r8   r4  r‡  r   r   r   rÆ  r-   )r   r   r!   r    r8  Ú	local_srcrÂ   s   &&&&&  r   Úirecv_inplacer;  S  sž   € ð ‚}Ü—
‘
× Ñ ˆØ‚}ÜÐ3Ó4Ð4Ø�B„ØŠ?ÜØRóð ð ‰	Ø	ŠÜ×'Ò'¨Ó3‰	äÐCÓDÐDÜ$ UÓ+€JÜ�Y‰Y×'Ñ'×-Ñ-¨fÀÓQ€FÜ˜fÓ%Ð%r   c          
      óÀ   € V ^8„  d   QhR\         \        ,          R\         \        ,          R\         \        ,          R\         \        P                  ,          R\
        /# )r   rÇ  rÈ  rÉ  rÊ  rÂ   )r=   r&   r$   r   r#   r%   )r'   s   "r   r(   r(   m  sO   € ÷ 2ñ 2Ü”#�Yð2ä”C�yð2ô ”3�ið2ô ”%—,‘,Õð	2ô
 ñ2r   c                 ó  € \         P                  ! 4       '       g   \        R 4      hVe   VR8X  d   \        P                  ! 4       p\        V4      p\        V\        4      '       d   TMVP                  p\        P                  P                  P                  WW#V4      p\        4       '       d2   \        W4       UUu. uF  w  rgVR8X  d   \        V4      MTNK  	  upp# \!        \#        \        V4      4      # u uppi )z%torch.distributed must be initializedÚ rÆ  )rô   Úis_initializedrV   r8   Ú_get_default_groupr*   r;   r&   rÂ   r   r   r   rú  r   r€   r-   r=   rp   )rÇ  rÈ  rÉ  rÊ  rÂ   ÚresolvedrË  r÷   s   &&&&&   r   Úbatch_p2p_ops_inplacerB  m  sÝ   € ô ×Ò× Ò ÜÐDÓEÐEØÒ˜Z¨2Ô-Ü×,Ò,Ó.ˆ
Ü˜jÓ)€HÜ'¨´#×6Ò6‘¸H×<OÑ<O€JÜ�i‰i×(Ñ(×6Ñ6Ø˜H¨zó€Gô ×Òô ˜WÔ.ô
á.‘�ð &(¨7¤]Ô˜qÔ!¸Ò9Ù.ò
ð 	
ô ”Ô&¨Ó0Ó1Ð1ùó	
s   Â?C;c                ó¬   € V ^8„  d   QhR\         P                  \        P                  ,          R\         P                  \        P                  ,          /# )r   r    r6   )rô   rs  r8   r}  )r'   s   "r   r(   r(   …  s:   € ÷  ñ  Ü×ÑœtŸ~™~Õ-ð ä	×ÑœŸ™Õ'ñ r   c                 ó¢   € \        V \        4      '       d   V # \        P                  P                  P
                  '       d   V # V P                  # r¢   )r;   r&   r   r_   r  r€  rÂ   )r    s   &r   r,   r,   …  s=   € ô �%œ×ÒØˆÜ	�‰×	Ñ	×	2×	2Ð	2Øˆà×ÑÐr   )Ú_all_gather_baseÚ_reduce_scatter_baseÚ
all_gatherr:   rF   r1   r¬   Úbatch_isend_irecvrÆ  rù  Úreduce_scatterrX   rW   c                  óR   € \        4       '       g   \        R 4      h\        V / VB  R# )z8_remapped_allgather should only be called during tracingN)r   rV   r  ©rF  rG  s   *,r   Ú_remapped_allgatherrL  ©  s$   € Ü×ÒÜÐWÓXÐXÜ˜tÐ. vÔ.r   c                  óR   € \        4       '       g   \        R 4      h\        V / VB  R# )z<_remapped_reducescatter should only be called during tracingN)r   rV   r  rK  s   *,r   Ú_remapped_reducescatterrN  ¯  s*   € Ü×ÒÜØJó
ð 	
ô " 4Ð2¨6Ô2r   c                  óR   € \        4       '       g   \        R 4      h\        V / VB  R# )z8_remapped_allreduce should only be called during tracingN)r   rV   r  rK  s   *,r   Ú_remapped_allreducerP  ·  s$   € Ü×ÒÜÐWÓXÐXÜ˜Ð' Ô'r   c                  óR   € \        4       '       g   \        R 4      h\        V / VB  R# )z@_remapped_all_to_all_single should only be called during tracingN)r   rV   r  rK  s   *,r   Ú_remapped_all_to_all_singlerR  ½  s*   € Ü×ÒÜØNó
ð 	
ô ˜Ð' Ô'r   c                  óR   € \        4       '       g   \        R 4      h\        V / VB  R# )z9_remapped_all_gather should only be called during tracingN)r   rV   r&  rK  s   *,r   Ú_remapped_all_gatherrT  Å  s*   € Ü×ÒÜØGó
ð 	
ô ˜Ð' Ô'r   c                  óR   € \        4       '       g   \        R 4      h\        V / VB  R# )z=_remapped_reduce_scatter should only be called during tracingN)r   rV   r/  rK  s   *,r   Ú_remapped_reduce_scatterrV  Í  s*   € Ü×ÒÜØKó
ð 	
ô ˜DÐ+ FÔ+r   c                  óN   € \        4       '       g   \        R 4      h\        V / VB # )z4_remapped_isend should only be called during tracing)r   rV   r6  rK  s   *,r   Ú_remapped_isendrX  Õ  ó'   € Ü×ÒÜÐSÓTÐTÜ˜$Ð) &Ñ)Ð)r   c                  óN   € \        4       '       g   \        R 4      h\        V / VB # )z4_remapped_irecv should only be called during tracing)r   rV   r;  rK  s   *,r   Ú_remapped_irecvr[  Û  rY  r   c                  óN   € \        4       '       g   \        R 4      h\        V / VB # )z<_remapped_batch_p2p_ops should only be called during tracing)r   rV   rB  rK  s   *,r   Ú_remapped_batch_p2p_opsr]  á  s-   € Ü×ÒÜØJó
ð 	
ô ! $Ð1¨&Ñ1Ð1r   c                ó8  € V ^8„  d   QhR\         R\        3,          R\        \        ,          R\        \        \        3,          R,          R\
        \         R\        3,          \
        \        R3,          \        \        \        3,          3,          R,          /# )r   rD  .rF  rG  Nr6   )r   r   r   Údictr&   ra  )r'   s   "r   r(   r(   ü  st   € ÷ "ñ "Ü
�3œ�8Õ
ð"ä
”3�-ð"ô ””c��N˜TÕ!ð"ô Œ8�Cœ�HÕœu¤S¨# X�´´S¼#°XµÐ>Õ?À$ÕFñ	"r   c                ó  € V \         9  d   R# ^ RIp\         V ,          p\        VP                  V 4      P                  ! T/ T;'       g    / B P
                  4      pV \        P                  P                  \        P                  P                  \        P                  P                  \        P                  P                  \        P                  P                  39   d   RV9   d   \        VR,          ,          VR&   VRV3# )aN  Redirect a legacy ``torch.distributed`` collective to its functional
equivalent, following Dynamo's CollectiveFunctionRewriteVariable.

Returns ``(mapped_func, (), kwargs)`` if ``func`` is a remappable collective,
else None. Shared by the make_fx compile_on_one_rank mode below and
non-strict export's _NonStrictTorchFunctionHandler.
NrË  r   )Útraceable_collective_remapsÚinspectr_  Ú	signatureÚbindr”   r   Údistributedr1   rI  rX   rW   rF  ÚREDUCE_OP_TO_STR)rD  rF  rG  rb  Úmapped_funcÚbounds   &&&   r   Ú_remap_traceable_collectiveri  ü  sÎ   € ð Ô.Ô.ÙÛä-¨dÕ3€KÜ�×"Ñ" 4Ó(×-Ò-¨tÐF¸¿¸À"ÑF×PÑPÓQ€EØÜ×Ñ×$Ñ$Ü×Ñ×(Ñ(Ü×Ñ×/Ñ/Ü×Ñ×/Ñ/Ü×Ñ×.Ñ.ðô ð �5Œ=Ü*¨5°­;Õ7ˆE�$‰KØ˜˜EÐ!Ð!r   c                   ó:   a € ] tR tRt o RtRV 3R lR lltRtV tR# )Ú!_LegacyToFunctionalCollectiveModei  aç  Redirect legacy ``torch.distributed`` collectives to functional collectives
while tracing, mirroring Dynamo and non-strict export.

Used by ``make_fx`` under ``compile_on_one_rank``: the in-place ``c10d.*`` ops
bind the ProcessGroup as a torchbind constant that cannot be serialized,
whereas the functional collectives take the group as an op argument, so the
group (e.g. a ``DeviceMesh.get_group()`` -> ``mesh_get_process_group`` output)
flows into the graph instead of being baked in.
Nc          
      ó˜   <€ V ^8„  d   QhRS[ RS[3,          RS[S[R3,          RS[S[R3,          RS[S[S[3,          R,          RS[/# )r   rD  .rE  rF  rG  Nr6   )r   r   ra  r�   r_  r&   )r'   r   s   "€r   r(   Ú._LegacyToFunctionalCollectiveMode.__annotate__%  sd   ø€ ÷ -ñ -á�s™C�xÕ ð-ñ ‘T˜3�YÕð-ñ ‘C˜�H�oð	-ñ
 ‘S™#�X• Õ%ð-ñ 
ñ-r   c                ó`   € \        WV4      pVe   Vw  rgpV! V/ VB # T! T/ T;'       g    / B # r¢   )ri  )	r   rD  rE  rF  rG  Úremappedrg  Úmapped_argsÚmapped_kwargss	   &&&&&    r   Ú__torch_function__Ú4_LegacyToFunctionalCollectiveMode.__torch_function__%  sF   € ô /¨t¸6ÓBˆØÒØ6>Ñ3ˆK mÙ Ð=¨}Ñ=Ð=Ù�TÐ,˜fŸl˜l¨Ñ,Ð,r   r   rR  )rS  rT  rU  rV  rW  rr  r\  r]  r^  s   @r   rk  rk    s   ø‡ € ñ÷-÷ -ð -r   rk  )r>  r   r*  )zObroadcast(Tensor self, int src, str tag, int[] ranks, int group_size) -> TensorzUall_reduce(Tensor self, str reduceOp, str tag, int[] ranks, int group_size) -> Tensorzcall_reduce_coalesced(Tensor[] self, str reduceOp, str tag, int[] ranks, int group_size) -> Tensor[]z"wait_tensor(Tensor self) -> Tensorz>isend(Tensor self, int dst, int tag, str group_name) -> Tensorz>irecv(Tensor self, int src, int tag, str group_name) -> Tensorzkbatch_p2p_ops(str[] op_list, int[] peer_list, int[] tag_list, Tensor[] tensors, str group_name) -> Tensor[]zTall_gather_into_tensor(Tensor shard, str tag, int[] ranks, int group_size) -> Tensorzball_gather_into_tensor_coalesced(Tensor[] input, str tag, int[] ranks, int group_size) -> Tensor[]zareduce_scatter_tensor(Tensor input, str reduceOp, str tag, int[] ranks, int group_size) -> Tensorzpreduce_scatter_tensor_coalesced(Tensor[] inputs, str reduceOp, str tag, int[] ranks, int group_size) -> Tensor[]zŠall_to_all_single(Tensor input, SymInt[]? output_split_sizes, SymInt[]? input_split_sizes, str tag, int[] ranks, int group_size) -> Tensor)NFr>  r   )rÀ   NFr   r>  )rÀ   NFr>  )NNNFr>  )NFr>  )Nr   Nrp  )ÇÚ
contextlibr?   Úsysra   Úcollections.abcr   r   Útypingr   r   r   r   Útorch.compiler.configÚtorch.distributedre  rô   Ú"torch.distributed.distributed_c10dÚdistributed_c10dr8   Útorch._utilsr   Útorch.distributed.device_meshr	   Ú"torch.fx.experimental.proxy_tensorr
   r>  r   Úfun_col_implÚtorch.utils._cxx_pytreer   ÚImportErrorÚtorch.utils._pytreeÚtorch.compilerr   r   Ú	Exceptionrb   r=   r$   rs  ra  r}  r%   r   r   r+   r1   rF   rK   rX   r\   rd   rg   rW   rl   ro   rw   r…   rv   rƒ   rš   r¬   r¯   r·   r»   ÚlibraryÚregister_autogradrÆ   rÊ   rÍ   rÐ   rÓ   rÖ   rÙ   rÛ   râ   rä   rç   ré   rì   rî   rû   r#   r<   rò   r*   r‡  Ú	custom_opr�  Úregister_faker’  r•  r—  r   r-   Úcontextmanagerrª  r±  r´  r·  r¼  r¾  rÂ  rÄ  rÌ  rÏ  rÓ  rÕ  rÙ  rÜ  rÞ  rã  rç  ré  rë  rí  rð  rò  rô  ÚLibraryÚlib_implÚimplÚlib_impl_autogradÚfxÚnodeÚhas_side_effectr   r   rC  rù  rÆ  rú  Ú
legacy_libÚlegacy_lib_implÚops_defsÚmodulesrS  Ú	my_moduleÚop_defÚindexÚop_nameÚgetattrÚbackend_implÚdefineÚTagÚpt2_compliant_tagr  r  ÚReduceOpÚSUMÚAVGÚPRODUCTÚMINÚMAXÚBANDÚBORÚBXORrf  r  r  r&  r/  r6  r;  rB  r,   rE  Úlegacy_all_gather_baserF  Úlegacy_reduce_scatter_baserG  Úlegacy_all_gatherr:   Úlegacy_allgatherÚlegacy_allgather_singleÚlegacy_allreduceÚlegacy_all_to_all_singlerH  Úlegacy_batch_p2p_opsÚlegacy_irecvÚlegacy_isendrI  Úlegacy_reduce_scatterÚlegacy_reducescatter_singleÚlegacy_reducescatterrL  rN  rP  rR  rT  rV  rX  r[  r]  ra  ri  Ú	overridesÚTorchFunctionModerk  r   r   r   Ú<module>r¶     st	  ðã Û Û 
Û ß .ß +Ñ +ã Û Ý  ß 1Ð 1Ý .Ý 4Ý =å :ð2Ý5ð
	ÝNðð#ðJð 	ˆ…IØ
ˆ4��9…oõà
×Ñõð õð Ð$ cÐ)Õ*õ	+ð
 ‡n�nõð õ .ðò::÷&÷ &÷0'÷T;÷('÷TJ÷8;÷ D÷ J÷"S÷"6÷86÷:-6÷f
9÷Vò&V÷ 2&÷jVõ&òð ‡�× Ñ Ø#ØØ+ð  ô õ+ò@
&ð ‡�× Ñ Ø"ØØ*ð  ô õ+ò8 ð ‡�× Ñ Ø.Ø#Ø6ð  ô õ1òD&ð ‡�× Ñ Ø-Ø"Ø5ð  ô õ1ò8.ð ‡�× Ñ Ø)ØØ1ð  ô ð ‡�× Ñ Ø7Ø#Ø6ð  ô ð ‡�× Ñ Ø6Ø"Ø5ð  ô ð ‡�× Ñ Ø2ØØ1ð  ô õ=ò>&ð ‡�× Ñ Ø,Ø!Ø4ð  ô õ=ò8 ð ‡�× Ñ Ø8Ø-Ø@ð  ô õCòD&ð ‡�× Ñ Ø7Ø,Ø?ð  ô ÷Vô>q#˜EŸL™Lô q#ðh÷
L&÷^8L÷v ð ‡�×ÑØ-ØØ%ð ó ô
(óð
(ð  ×$Ñ$ô#ó %ð#õò 	ð × 'Ñ 'Ø"Ø5ð (ô õ(õ'ð ×Ñö#
ó ð#
òLòFò
"òIò"ò@ò"òò:ò%ò/òòòò.ò
)ò:ò:òò ò òð �=‰=× Ñ Ð!3°VÓ<€Ø ‡�ˆlÐ,¨fÔ 5Ø ‡�ˆmÐ.°Ô 7Ø ‡�Ð$Ð&@À&Ô IØ ‡�Ð%Ð'BÀFÔ KØ ‡�ˆmÐ.°Ô 7Ø ‡�ˆg�{ FÔ +Ø ‡�ˆg�{ FÔ +Ø ‡�ˆoÐ2°FÔ ;à ‡�Ø Ð"IÈ6ôð 	‡�Ð&Ð(KÈVÔ TØ ‡�Ø&Ø1Ø
ôð
 	‡�Ð%Ð'IÈ6Ô RØ ‡�ØÐ!GÈôð 	‡�Ø%Ø0Ø
ôð
 	‡�Ð!Ð#:¸FÔ CØ ‡�ˆk˜?¨FÔ 3Ø ‡�ˆlÐ,¨fÔ 5ð
 —M‘M×)Ñ)Ð*EÀvÓNÐ Ø × Ñ ØÐAÀ6ôð × Ñ ØÐ?Àôð × Ñ Ð*Ð,CÀVÔ Lð ‡�‡�× Ñ ˜eŸi™i×8Ñ8×DÑD×LÒLÔ MØ ‡�‡�× Ñ ˜eŸi™i×8Ñ8×DÑDÔ EØ ‡�‡�× Ñ ˜eŸi™i×8Ñ8×>Ò>×FÒFÔ GØ ‡�‡�× Ñ ˜eŸi™i×8Ñ8×>Ò>Ô ?Ø ‡�‡�× Ñ ˜eŸi™i×8Ñ8×>Ò>×FÒFÔ GØ ‡�‡�× Ñ ˜eŸi™i×8Ñ8×>Ò>Ô ?Ø ‡�‡�× Ñ ˜eŸi™i×8Ñ8×FÒF×NÒNÔ OØ ‡�‡�× Ñ ˜eŸi™i×8Ñ8×FÒFÔ Gð
 �]‰]×"Ñ"Ð#4°eÓ<€
Ø—-‘-×'Ñ'Ð(9¸6ÓB€ò€ð �KŠK˜Õ!€	Û€FØ�Q˜Ÿš cÓ*Ð+€GÙ˜<¨1¨W¨I¨Ó7€LØ×Ò�f 5§9¢9×#>Ò#>ÐÔ?Ø×Ñ˜ ,Ð0KÖLñ	 ð÷X÷(Sð, 	‡M‚M×Ò�uØ‡M‚M×Ò�uØ‡M‚M×Ò˜9Ø‡M‚M×Ò�uØ‡M‚M×Ò�uØ‡M‚M×Ò˜Ø‡M‚M×Ò�uØ‡M‚M×Ò˜ð	Ð ÷<÷&÷:"÷JY÷8&÷:&õ42õ0 ÷÷ ÷ õ ò2/ò3ò(ò(ò(ò,ò*ò*ò2ð Ð)ØÐ0ØÐ1ØÐ!8ØÐ)ØÐ9ØÐ+ØÐ3ØÐ 7ØÐ/Ø�/Ø�/ØÐ1ðÐ õ""ô<-¨¯ª×(IÒ(Iö -øðI@ ô 2ß1Ð1ð2ûð ô Ø‡M‚MØnØõõ
ðús$   Áh Áh* èh'è&h'è*iéi