Ë
    g^(h  ã                   ón  — d Z ddlmZ ddlmZmZmZ ddlZddlm	Z
 ddlmZ g d	¢Zee
eedf   Zd
efd„Zd
efd„Zd
efd„Zd
efd„Zd
efd„Zd
efd„Zd
efd„Zd
efd„Zd!ded
dfd„Z G d„ d«      Z G d„ d«      Z e«       Zead!ded
efd„Z G d„ de«      Zded
efd„Z d
efd„Z!ded
dfd„Z"d
efd „Z#y)"zj
This package implements abstractions found in ``torch.cuda``
to facilitate writing device-agnostic code.
é    )ÚAbstractContextManager)ÚAnyÚOptionalÚUnionNé   ©Údeviceé   )Úamp)
Úis_availableÚsynchronizeÚcurrent_deviceÚcurrent_streamÚstreamÚ
set_deviceÚdevice_countÚStreamÚStreamContextÚEventÚreturnc                  óR   — t         j                  j                  j                  «       S )z/Returns a bool indicating if CPU supports AVX2.)ÚtorchÚ_CÚ_cpuÚ_is_avx2_supported© ó    úP/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/torch/cpu/__init__.pyr   r       s   € ä�8‰8�=‰=×+Ñ+Ó-Ð-r   c                  óR   — t         j                  j                  j                  «       S )z1Returns a bool indicating if CPU supports AVX512.)r   r   r   Ú_is_avx512_supportedr   r   r   r    r    %   s   € ä�8‰8�=‰=×-Ñ-Ó/Ð/r   c                  óR   — t         j                  j                  j                  «       S )z6Returns a bool indicating if CPU supports AVX512_BF16.)r   r   r   Ú_is_avx512_bf16_supportedr   r   r   r"   r"   *   s   € ä�8‰8�=‰=×2Ñ2Ó4Ð4r   c                  óR   — t         j                  j                  j                  «       S )z/Returns a bool indicating if CPU supports VNNI.)r   r   r   Ú_is_avx512_vnni_supportedr   r   r   Ú_is_vnni_supportedr%   /   s   € ô �8‰8�=‰=×2Ñ2Ó4Ð4r   c                  óR   — t         j                  j                  j                  «       S )z3Returns a bool indicating if CPU supports AMX_TILE.)r   r   r   Ú_is_amx_tile_supportedr   r   r   r'   r'   5   ó   € ä�8‰8�=‰=×/Ñ/Ó1Ð1r   c                  óR   — t         j                  j                  j                  «       S )z3Returns a bool indicating if CPU supports AMX FP16.)r   r   r   Ú_is_amx_fp16_supportedr   r   r   r*   r*   :   r(   r   c                  óR   — t         j                  j                  j                  «       S )zInitializes AMX instructions.)r   r   r   Ú	_init_amxr   r   r   r,   r,   ?   s   € ä�8‰8�=‰=×"Ñ"Ó$Ð$r   c                   ó   — y)z…Returns a bool indicating if CPU is currently available.

    N.B. This function only exists to facilitate device-agnostic code

    Tr   r   r   r   r   r   D   s   € ð r   r	   c                  ó   — y)zñWaits for all kernels in all streams on the CPU device to complete.

    Args:
        device (torch.device or int, optional): ignored, there's only one CPU device.

    N.B. This function only exists to facilitate device-agnostic code.
    Nr   r   s    r   r   r   M   ó   � r   c                   ó:   — e Zd ZdZd	deddfd„Zd
d„Zd
d„Zd
d„Zy)r   zH
    N.B. This class only exists to facilitate device-agnostic code
    Úpriorityr   Nc                  ó   — y ©Nr   )Úselfr1   s     r   Ú__init__zStream.__init__\   ó   € Ør   c                  ó   — y r3   r   ©r4   r   s     r   Úwait_streamzStream.wait_stream_   r6   r   c                  ó   — y r3   r   ©r4   s    r   Úrecord_eventzStream.record_eventb   r6   r   c                  ó   — y r3   r   )r4   Úevents     r   Ú
wait_eventzStream.wait_evente   r6   r   )éÿÿÿÿ©r   N)	Ú__name__Ú
__module__Ú__qualname__Ú__doc__Úintr5   r9   r<   r?   r   r   r   r   r   W   s)   „ ññ ð ¨dó óóôr   r   c                   ó4   — e Zd Zdefd„Zddd„Zdd„Zddd„Zy)	r   r   c                  ó   — y)NTr   r;   s    r   ÚqueryzEvent.queryj   s   € Ør   Nc                  ó   — y r3   r   r8   s     r   ÚrecordzEvent.recordm   r6   r   c                  ó   — y r3   r   r;   s    r   r   zEvent.synchronizep   r6   r   c                  ó   — y r3   r   r8   s     r   Úwaitz
Event.waits   r6   r   r3   rA   )rB   rC   rD   ÚboolrI   rK   r   rN   r   r   r   r   r   i   s   „ ð�tó ôóõr   r   c                 ó   — t         S )zÓReturns the currently selected :class:`Stream` for a given device.

    Args:
        device (torch.device or int, optional): Ignored.

    N.B. This function only exists to facilitate device-agnostic code

    )Ú_current_streamr   s    r   r   r   {   s
   € ô Ðr   c                   óF   — e Zd ZU dZee   ed<   d„ Zd„ Zde	de	de	dd	fd
„Z
y	)r   zvContext-manager that selects a given stream.

    N.B. This class only exists to facilitate device-agnostic code

    Ú
cur_streamc                 ó(   — || _         t        | _        y r3   )r   Ú_default_cpu_streamÚprev_streamr8   s     r   r5   zStreamContext.__init__�   s   € ØˆŒÜ.ˆÕr   c                 ó<   — | j                   }|€y t        | _        |ay r3   )r   rQ   rV   )r4   rS   s     r   Ú	__enter__zStreamContext.__enter__”   s#   € Ø—[‘[ˆ
ØÐØô +ˆÔØ$‰r   ÚtypeÚvalueÚ	tracebackr   Nc                 ó:   — | j                   }|€y | j                  ay r3   )r   rV   rQ   )r4   rY   rZ   r[   rS   s        r   Ú__exit__zStreamContext.__exit__�   s!   € Ø—[‘[ˆ
ØÐØð ×*Ñ*‰r   )rB   rC   rD   rE   r   r   Ú__annotations__r5   rX   r   r]   r   r   r   r   r   ‡   s?   … ñð ˜Ñ Ó ò/ò%ð+˜Sð +¨ð +¸ð +Àô +r   r   r   c                 ó   — t        | «      S )z�Wrapper around the Context-manager StreamContext that
    selects a given stream.

    N.B. This function only exists to facilitate device-agnostic code
    )r   )r   s    r   r   r   ¦   s   € ô ˜Ó Ð r   c                   ó   — y)z€Returns number of CPU devices (not cores). Always 1.

    N.B. This function only exists to facilitate device-agnostic code
    r
   r   r   r   r   r   r   ¯   s   € ð
 r   c                  ó   — y)zzSets the current device, in CPU we do nothing.

    N.B. This function only exists to facilitate device-agnostic code
    Nr   r   s    r   r   r   ·   r/   r   c                   ó   — y)zyReturns current device for cpu. Always 'cpu'.

    N.B. This function only exists to facilitate device-agnostic code
    Úcpur   r   r   r   r   r   ¾   s   € ð
 r   r3   )$rE   Ú
contextlibr   Útypingr   r   r   r   Ú r	   Ú_devicer   Ú__all__ÚstrrF   Ú	_device_trO   r   r    r"   r%   r'   r*   r,   r   r   r   r   rU   rQ   r   r   r   r   r   r   r   r   r   ú<module>rk      s/  ðñõ
 .ß 'Ñ 'ã å  Ý ò€ð �'˜3  TÐ)Ñ*€	ð.˜Dó .ð
0˜dó 0ð
5 4ó 5ð
5˜Dó 5ð2 ó 2ð
2 ó 2ð
%�4ó %ð
�dó ñ˜	ð ¨Tó ÷ñ ÷$ñ ñ “hÐ Ø%€ñ	˜9ð 	°ó 	ô+Ð*ô +ð>!�6ð !Ð4ó !ð�có ð�yð  Tó ð˜ô r   