ó
    ªêbi—	  ã                   ó”   • S SK Jr  S SKJrJr  / SQr " S S\5      r\SS j5       r\SS j5       r\SS
 j5       r	\S	SS.S j5       r
g)é    )ÚSwizzledSharedLayout)ÚbuiltinÚ_unwrap_if_constexpr)ÚarriveÚinitÚ
invalidateÚMBarrierLayoutÚwaitc                   ó0   ^ • \ rS rSrSrSU 4S jjrSrU =r$ )r	   é   z“
Layout for mbarrier synchronization in Ampere and later architectures.

Args:
    cga_layout (List[List[int]]): CTA layout bases. Defaults to [].
c                 ó<   >• [         TU ]  SSSS/U=(       d    / S9  g )Né   r   )ÚvecÚ	per_phaseÚ	max_phaseÚorderÚ
cga_layout)ÚsuperÚ__init__)Úselfr   Ú	__class__s     €Ús/home/james-whalen/.local/lib/python3.13/site-packages/triton/experimental/gluon/language/nvidia/ampere/mbarrier.pyr   ÚMBarrierLayout.__init__   s$   ø€ Ü‰Ñ˜Q¨!°qÀÀÐPZ×P`Ð^`ÐÒaó    © ©N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   Ú__static_attributes__Ú__classcell__)r   s   @r   r	   r	      s   ø† ñ÷bõ br   r	   Nc                 óf   • [        U5      nUR                  R                  U R                  U5        g)z¶
Initialize an mbarrier with a specified count.

Args:
    mbarrier (shared_memory_descriptor): The barrier object to initialize.
    count (int): The initial count for the barrier.
N)r   ÚbuilderÚcreate_mbarrier_initÚhandle)ÚmbarrierÚcountÚ	_semantics      r   r   r      s(   € ô ! Ó'€EØ×Ñ×*Ñ*¨8¯?©?¸EÕBr   c                 óN   • UR                   R                  U R                  5        g)z€
Invalidate an mbarrier, resetting its state.

Args:
    mbarrier (shared_memory_descriptor): The barrier object to invalidate.
N)r%   Úcreate_mbarrier_invalr'   )r(   r*   s     r   r   r       s   € ð ×Ñ×+Ñ+¨H¯O©OÕ<r   Tc                 ó   • UR                  U5      nUR                  U5      nU Vs/ s H  oUR                  PM     nnUR                  R                  U R                  UR                  UR                  U5        gs  snf )a±  
Wait until the mbarrier object completes its current phase.

Args:
    mbarrier (shared_memory_descriptor): The barrier object to wait on.
    phase (int): The phase index to wait for.
    pred (bool): Predicate. Operation is skipped if predicate is False. Defaults to True.
    deps (Sequence[shared_memory_descriptor]): Dependent allocations barrier is waiting on. Used to track liveness of dependent allocations. Defaults to ().
N)Ú	to_tensorr'   r%   Úcreate_mbarrier_wait)r(   ÚphaseÚpredÚdepsr*   Úxs         r   r
   r
   +   sf   € ð ×Ñ Ó&€EØ×Ñ˜tÓ$€DÙ"Ó#šd˜HŒH™d€DÐ#Ø×Ñ×*Ñ*¨8¯?©?¸E¿L¹LÈ$Ï+É+ÐW[Õ\ùò $s   §A;)r1   r*   c                óŠ   • SnUR                  U5      nUR                  R                  U R                  X1R                  5        g)zô
Arrive on an mbarrier, signaling that a thread has reached the barrier.

Args:
    mbarrier (shared_memory_descriptor): The barrier object to arrive on.
    pred (bool): Predicate. Operation is skipped if predicate is False. Defaults to True.
r   N)r.   r%   Úcreate_mbarrier_arriver'   )r(   r1   r*   r)   s       r   r   r   <   s7   € ð €EØ×Ñ˜tÓ$€DØ×Ñ×,Ñ,¨X¯_©_¸eÇ[Á[ÕQr   r   )Tr   N)Ú+triton.experimental.gluon.language._layoutsr   Ú(triton.experimental.gluon.language._corer   r   Ú__all__r	   r   r   r
   r   r   r   r   Ú<module>r9      sz   ðÝ Lß Râ
D€ô	bÐ)ô 	bð 	ó	Có 	ð	Cð 	ó=ó 	ð=ð 	ó]ó 	ð]ð  	Ø!¨Tô 
Ró 	ñ
Rr   