ó
    “~iG
  ã                   óž   • S SK Js  Js  Js  Jr  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S
.S j5       rg)é    N)ÚSwizzledSharedLayout)ÚbuiltinÚ_unwrap_if_constexpr)ÚMBarrierLayoutÚinitÚwaitÚarrivec                   ó0   ^ • \ rS rSrSrSU 4S jjrSrU =r$ )r   é   zq
Layout for mbarrier synchronization.

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     €Út/home/mande/repo/quber/.venv/lib/python3.13/site-packages/triton/experimental/gluon/language/amd/gfx1250/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   c                 óf   • [        U5      nUR                  R                  U R                  U5        g)a”  
Initialize an mbarrier with a specified count. An mbarrier consists of an init count, a pending count and a phase.
At initialization, the init count and pending count are initialized with the given 'count' and the phase is initialized to 0.

Args:
    mbarrier (shared_memory_descriptor): The barrier object to initialize.
    count (int): The initial count for the barrier. Must be a positive integer.
N)r   ÚbuilderÚcreate_lds_barrier_initÚhandle)ÚmbarrierÚcountÚ	_semantics      r   r   r      s(   € ô ! Ó'€EØ×Ñ×-Ñ-¨h¯o©o¸uÕEr   c                 ó†   • UR                  U5      nUR                  R                  U R                  UR                  5        g)aP  
Wait until the mbarrier's phase differs from the provided phase value.
This means that the given 'phase' has completed.

Args:
    mbarrier (shared_memory_descriptor): The barrier object to wait on.
    phase (int): The phase value to compare against. The wait completes when
    the barrier's phase becomes different from this value.
N)Ú	to_tensorr$   Úcreate_lds_barrier_waitr&   )r'   Úphaser)   s      r   r   r   "   s2   € ð ×Ñ Ó&€Eà×Ñ×-Ñ-¨h¯o©o¸u¿|¹|ÕLr   r   )r(   r)   c                ó®   • [        U5      nUR                  R                  U R                  U5      n[        R
                  " U[        R                  5      $ )a`  
Arrive at an mbarrier with a specified count. The operation requires a `count` attribute
of at least 1, and decreases the pending arrival count of the mbarrier by the specific count.
If the pending count reaches zero, the phase changes (is decremented in a wraparound manner) and the
pending count is reloaded with the init count value. Returns the mbarrier's phase prior to the "arrive" operation.

Args:
    mbarrier (shared_memory_descriptor): Barrier to be signalled.
    count (int): Count to arrive with. Defaults to 1.

Returns:
    prior phase (int): phase of mbarrier, prior to "arrive" operation.
)r   r$   Úcreate_lds_barrier_arriver&   ÚttglÚtensorÚint32)r'   r(   r)   r&   s       r   r	   r	   2   s?   € ô ! Ó'€EØ×Ñ×8Ñ8¸¿¹È%ÓP€FÜ�;Š;�vœtŸz™zÓ*Ð*r   r   )Ú(triton.experimental.gluon.language._coreÚexperimentalÚgluonÚlanguageÚ_corer0   Ú+triton.experimental.gluon.language._layoutsr   r   r   Ú__all__r   r   r   r	   r   r   r   Ú<module>r:      sj   ðß 7Ö 7Ý Lß Râ
6€ô	bÐ)ô 	bð 	ó
Fó 	ð
Fð 	óMó 	ðMð 	Ø¨4ô +ó 	ñ+r   