Ë
    ŒÓ^jf
  ã                   ó˜   — d dl mc mc mc mZ d dlmZ d dl mZm	Z	 g d¢Z
 G d„ de«      Zedd„«       Zedd„«       Zed	dd
œd„«       Zy)é    N)ÚSwizzledSharedLayout)ÚbuiltinÚ_unwrap_if_constexpr)ÚMBarrierLayoutÚinitÚwaitÚarrivec                   ó$   ‡ — e Zd ZdZdˆ fd„	Zˆ xZS )r   z�
    Layout for mbarrier synchronization.

    Args:
        cga_layout (List[List[int]]): CGA layout bases. Defaults to [].
    c                 ó8   •— t         ‰| �  ddddg|xs g ¬«       y )Né   r   )ÚvecÚ	per_phaseÚ	max_phaseÚorderÚ
cga_layout)ÚsuperÚ__init__)Úselfr   Ú	__class__s     €ú‚/var/www/ramen.bs-engineer-server.com/venv/lib/python3.12/site-packages/triton/experimental/gluon/language/amd/gfx1250/mbarrier.pyr   zMBarrierLayout.__init__   s$   ø€ Ü‰Ñ˜Q¨!°qÀÀÐPZÒP`Ð^`ÐÕaó    ©N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   Ú__classcell__)r   s   @r   r   r      s   ø„ ñ÷bñ br   r   c                 óf   — t        |«      }|j                  j                  | j                  |«       y)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                 ó†   — |j                  |«      }|j                  j                  | j                  |j                  «       y)al  
    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                ó¬   — t        |«      }|j                  j                  | j                  |«      }t	        j
                  |t        j                  «      S )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 parity (0 for even, 1 for odd) 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Ú_corer+   Ú+triton.experimental.gluon.language._layoutsr   r   r   Ú__all__r   r   r   r	   © r   r   ú<module>r6      sj   ðß 7Ö 7Ý Lß Râ
6€ô	bÐ)ô 	bð 	ò
Fó 	ð
Fð 	òMó 	ðMð 	Ø¨4ó +ó 	ñ+r   