§
    Î§g“  ã                   ó(   — d dl Z  G d„ d¦  «        ZdS )é    Nc                   ó>   — e Zd ZdZdd„Zd„ Zd„ Zd„ Zd„ Zd„ Z	d	„ Z
d
S )ÚEventaA  Wrapper around an MPS event.

    MPS events are synchronization markers that can be used to monitor the
    device's progress, to accurately measure timing, and to synchronize MPS streams.

    Args:
        enable_timing (bool, optional): indicates if the event should measure time
            (default: ``False``)
    Fc                 óN   — t           j                             |¦  «        | _        d S )N)ÚtorchÚ_CÚ_mps_acquireEventÚ_Event__eventId)ÚselfÚenable_timings     úK/var/www/html/ai-engine/env/lib/python3.11/site-packages/torch/mps/event.pyÚ__init__zEvent.__init__   s   € Ýœ×3Ò3°MÑBÔBˆŒˆˆó    c                 ó    — t          t          j        d¦  «        r1| j        dk    r(t          j                             | j        ¦  «         d S d S d S )NÚ_mps_releaseEventr   )Úhasattrr   r   r	   r   ©r
   s    r   Ú__del__zEvent.__del__   sQ   € å•5”8Ð0Ñ1Ô1ð 	7°d´nÀqÒ6HÐ6HÝŒH×&Ò& t¤~Ñ6Ô6Ð6Ð6Ð6ð	7ð 	7Ð6HÐ6Hr   c                 óN   — t           j                             | j        ¦  «         dS )z(Records the event in the default stream.N)r   r   Ú_mps_recordEventr	   r   s    r   ÚrecordzEvent.record   s    € åŒ×!Ò! $¤.Ñ1Ô1Ð1Ð1Ð1r   c                 óN   — t           j                             | j        ¦  «         dS )zJMakes all future work submitted to the default stream wait for this event.N)r   r   Ú_mps_waitForEventr	   r   s    r   Úwaitz
Event.wait   s    € åŒ×"Ò" 4¤>Ñ2Ô2Ð2Ð2Ð2r   c                 óJ   — t           j                             | j        ¦  «        S )zCReturns True if all work currently captured by event has completed.)r   r   Ú_mps_queryEventr	   r   s    r   ÚqueryzEvent.query    s   € åŒx×'Ò'¨¬Ñ7Ô7Ð7r   c                 óN   — t           j                             | j        ¦  «         dS )z¡Waits until the completion of all work currently captured in this event.
        This prevents the CPU thread from proceeding until the event completes.
        N)r   r   Ú_mps_synchronizeEventr	   r   s    r   ÚsynchronizezEvent.synchronize$   s"   € õ 	Œ×&Ò& t¤~Ñ6Ô6Ð6Ð6Ð6r   c                 óV   — t           j                             | j        |j        ¦  «        S )z}Returns the time elapsed in milliseconds after the event was
        recorded and before the end_event was recorded.
        )r   r   Ú_mps_elapsedTimeOfEventsr	   )r
   Ú	end_events     r   Úelapsed_timezEvent.elapsed_time*   s!   € õ Œx×0Ò0°´ÀÔATÑUÔUÐUr   N)F)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r   r   r   r#   © r   r   r   r      s•   € € € € € ðð ðCð Cð Cð Cð7ð 7ð 7ð
2ð 2ð 2ð3ð 3ð 3ð8ð 8ð 8ð7ð 7ð 7ðVð Vð Vð Vð Vr   r   )r   r   r(   r   r   ú<module>r)      sJ   ðà €€€ð)Vð )Vð )Vð )Vð )Vñ )Vô )Vð )Vð )Vð )Vr   