L i ddlZGddZy)Nc^eZdZdZd deddfdZddZddZddZdefd Z dd Z d dde fd Z y)EventaAWrapper 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``) enable_timingreturnNcLtjj||_y)N)torch_C_mps_acquireEvent_Event__eventId)selfrs U/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/torch/mps/event.py__init__zEvent.__init__s33MBcttjdr:|jdkDr*tjj |jyyy)N_mps_releaseEventr)hasattrrr r rr s r __del__z Event.__del__s; 5880 1dnnq6H HH & &t~~ 67I 1rcVtjj|jy)z(Records the event in the default stream.N)rr _mps_recordEventr rs r recordz Event.records !!$..1rcVtjj|jy)zJMakes all future work submitted to the default stream wait for this event.N)rr _mps_waitForEventr rs r waitz Event.waits ""4>>2rcTtjj|jS)zCReturns True if all work currently captured by event has completed.)rr _mps_queryEventr rs r queryz Event.querysxx''77rcVtjj|jy)zWaits until the completion of all work currently captured in this event. This prevents the CPU thread from proceeding until the event completes. N)rr _mps_synchronizeEventr rs r synchronizezEvent.synchronize#s &&t~~6r end_eventcjtjj|j|jS)z}Returns the time elapsed in milliseconds after the event was recorded and before the end_event was recorded. )rr _mps_elapsedTimeOfEventsr )r r!s r elapsed_timezEvent.elapsed_time)s%xx00ATATUUr)F)rN) __name__ __module__ __qualname____doc__boolrrrrrr floatr$rr rrsSCdCtC7 238t87 VgV%Vrr)rrr+rr r,s )V)Vr