+
    åûj¥  ã                   ó~   a € R	 t0 t R t^ RIt^ RIHt ^RIHt Rs] ^ k Rs	] ^k Rs
] ^k R R ltR R ltR R ltR# )
au  
Manages process groups for distributed compilation in TorchDynamo.

This module handles the initialization and management of process groups used for
distributed compilation. Key features:

- Lazy initialization of compilation process groups
- Only creates groups when distributed mode is enabled and available
- Integrates with compiler_collectives configuration setting
- Provides a single global process group for compilation coordination

The process group is created only when needed and if the distributed environment
is properly initialized, making it safe to import and use this module even in
non-distributed scenarios.
N)Úconfigc                óF   € V ^8„  d   QhR\         P                  R,          /# ©é   ÚreturnN©ÚdistÚProcessGroup)Úformats   "ÚUC:\Ai_Coding\apps\studio\ComfyUI\.venv\Lib\site-packages\torch\_dynamo\distributed.pyÚ__annotate__r      s   € ÷ ñ œ×)Ñ)¨DÕ0ñ ó    c                  óR  € \         P                  '       d‘   \        P                  ! 4       '       dv   \        P                  ! 4       '       d[   \
        fM   \        P                  P                  RR7      p V \        P                  P                  8X  d   \        R4      hV s\
        # R # )NÚpt2_compile_pg©Úpg_tagz-Compiler process group must include all ranks)r   Úenable_compiler_collectivesr   Úis_availableÚis_initializedÚ_COMPILE_PGÚdistributed_c10dÚ_new_group_with_tagÚGroupMemberÚNON_GROUP_MEMBERÚAssertionError)Ú
compile_pgs    r   Úget_compile_pgr      sƒ   € ä×*×*Ð*Ü×Ò×ÒÜ×Ò×!Ò!ô ÒÜ×.Ñ.×BÑBØ'ð Có ˆJð œT×-Ñ-×>Ñ>Ô>Ü$Ð%TÓUÐUØ$ˆKÜÐár   c                óF   € V ^8„  d   QhR\         P                  R,          /# r   r   )r
   s   "r   r   r   1   s   € ÷ 
ñ 
”d×'Ñ'¨$Õ.ñ 
r   c                  ó&  € \         P                  ! 4       '       dv   \         P                  ! 4       '       d[   \        fM   \         P                  P                  RR7      p V \         P                  P                  8X  d   \        R4      hV s\        # R # )NÚpt2_guard_pgr   z*Guard process group must include all ranks)	r   r   r   Ú	_GUARD_PGr   r   r   r   r   )Úguard_pgs    r   Úget_guard_pgr"   1   sl   € Ü×Ò×Òœt×2Ò2×4Ò4äÒÜ×,Ñ,×@Ñ@ÈÐ@ÓWˆHØœ4×+Ñ+×<Ñ<Ô<Ü$Ð%QÓRÐRØ ˆIÜÐár   c                óF   € V ^8„  d   QhR\         P                  R,          /# r   r   )r
   s   "r   r   r   @   s   € ÷ *ñ *œT×.Ñ.°Õ5ñ *r   c                 ód  € \         P                  ! 4       '       Ed   \         P                  ! 4       '       dù   \        fë   \         P                  ! 4       '       g   \        R4      h\         P                  P                  4       p \         P                  P                  V 4      pV P                  \        P                  ! V4      4      p\         P                  P                  RVP                  P                  RR7      pV\         P                  P                   8X  d   \#        R4      hVs\        # R# )a  
Process group for collectives issued from inside the compiler itself, e.g. the
partitioner's cross rank decision sync.

These must not share a process group with the model's runtime collectives: ranks
reach a given compile at different times, so a rank that has already resumed
execution can otherwise match one of its runtime ops against another rank's
compile time op. We thus require gloo as the backend. Gloo keeps the traffic off
the accelerator as well, so a compile time collective can't interleave with
an in flight NCCL op.
Na  Compile time cross rank synchronization requires the gloo backend, which this build of PyTorch does not have. Either build with gloo, or turn off torch._functorch.config._sync_decision_cross_ranks and torch._functorch.config._sync_cache_decision_cross_ranks.ÚglooÚpt2_compile_sync_pg)ÚbackendÚtimeoutr   z1Compile sync process group must include all ranks)r   r   r   Ú_COMPILE_SYNC_PGÚis_gloo_availableÚRuntimeErrorr   Ú_get_default_groupÚ_get_object_coll_deviceÚ_get_backendÚtorchÚdevicer   ÚoptionsÚ_timeoutr   r   r   )Ú
default_pgÚcoll_deviceÚdefault_backendÚcompile_sync_pgs       r   Úget_compile_sync_pgr7   @   sø   € ô ×Ò×Óœt×2Ò2×4Ò4äÒ#Ü×)Ò)×+Ò+ô #ðPóð ô ×.Ñ.×AÑAÓCˆJÜ×/Ñ/×GÑGÈ
ÓSˆKØ(×5Ñ5´e·l²lÀ;Ó6OÓPˆOÜ"×3Ñ3×GÑGØØ'×/Ñ/×8Ñ8Ø,ð Hó ˆOð
 ¤$×"2Ñ"2×"CÑ"CÔCÜ$ØGóð ð  /ÐÜÐár   c                óö   € V ^8„  d   Qh/ ^ \         9   d   \        P                  R,          ;R&   ^\         9   d   \        P                  R,          ;R&   ^\         9   d   \        P                  R,          ;R&   # )r   Nr   r    r)   )Ú__conditional_annotations__r   r	   )r
   s   "r   r   r      sc   € ÷ ñ ÷, -Ò ,ŒT×Ñ Õ%Ñ ,ñ-÷. +Ò *Œ4×Ñ˜tÕ#Ñ *ñ/÷0 2Ò 1”$×#Ñ# dÕ*Ñ 1ò1r   )r9   Ú__doc__r/   Útorch.distributedÚdistributedr   Ú r   r   r    r)   r   r"   r7   r   )r9   s   @r   Ú<module>r>      s@   øðöó  Ý  å ð )-€Ó ,Ø&*€	Ó *Ø-1Ð Ó 1õõ*
÷*r   