
    IЦiJ                        S r SSKJr  SSKJrJrJr  SSKrSSKJ	r
  SSKJr  / S	Qr\\
\\S4   rS
\4S jrS
\4S jrS
\4S jrS
\4S jrS
\4S jrS
\4S jrS
\4S jrS
\4S jrS
\4S jrS"S\S
S4S jjr " S S5      r " S S5      r\" 5       r\qS"S\S
\4S jjr " S S\5      r S\S
\4S jr!S
\4S jr"S\S
S4S  jr#S
\4S! jr$g)#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    [         R                  R                  R                  5       $ )z/Returns a bool indicating if CPU supports AVX2.)torch_C_cpu_is_avx2_supported     Q/var/www/html/ai-image-ml/venv/lib/python3.13/site-packages/torch/cpu/__init__.pyr   r       s    88==++--r   c                  R    [         R                  R                  R                  5       $ )z1Returns a bool indicating if CPU supports AVX512.)r   r   r   _is_avx512_supportedr   r   r   r    r    %   s    88==--//r   c                  R    [         R                  R                  R                  5       $ )z6Returns a bool indicating if CPU supports AVX512_BF16.)r   r   r   _is_avx512_bf16_supportedr   r   r   r"   r"   *   s    88==2244r   c                  R    [         R                  R                  R                  5       $ )z/Returns a bool indicating if CPU supports VNNI.)r   r   r   _is_avx512_vnni_supportedr   r   r   _is_vnni_supportedr%   /   s     88==2244r   c                  R    [         R                  R                  R                  5       $ )z3Returns a bool indicating if CPU supports AMX_TILE.)r   r   r   _is_amx_tile_supportedr   r   r   r'   r'   5       88==//11r   c                  R    [         R                  R                  R                  5       $ )z3Returns a bool indicating if CPU supports AMX FP16.)r   r   r   _is_amx_fp16_supportedr   r   r   r*   r*   :   r(   r   c                  R    [         R                  R                  R                  5       $ )zInitializes AMX instructions.)r   r   r   	_init_amxr   r   r   r,   r,   ?   s    88==""$$r   c                  R    [         R                  R                  R                  5       $ )z2Returns a bool indicating if CPU supports Arm SVE.)r   r   r   _is_arm_sve_supportedr   r   r   r.   r.   D   s    88==..00r   c                      g)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   I   s     r   r	   c                     g)zWaits 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   R       r   c                   8    \ rS rSrSrS	S\SS4S jjrS
S jrSrg)r   \   z@
N.B. This class only exists to facilitate device-agnostic code
priorityr   Nc                     g Nr   )selfr4   s     r   __init__Stream.__init__a       r   c                     g r6   r   r7   r   s     r   wait_streamStream.wait_streamd   r:   r   r   )r   N)	__name__
__module____qualname____firstlineno____doc__intr8   r=   __static_attributes__r   r   r   r   r   \   s     d r   r   c                   H    \ rS rSrS\4S jrS	S
S jjrS
S jrS	S
S jjrSr	g)r   h   r   c                     g)NTr   r7   s    r   queryEvent.queryi   s    r   Nc                     g r6   r   r<   s     r   recordEvent.recordl   r:   r   c                     g r6   r   rK   s    r   r   Event.synchronizeo   r:   r   c                     g r6   r   r<   s     r   wait
Event.waitr   r:   r   r   r6   r@   )
rA   rB   rC   rD   boolrL   rO   r   rT   rG   r   r   r   r   r   h   s"    t  r   r   c                     [         $ )zReturns 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   z   s
     r   c                   P    \ rS rSr% Sr\\   \S'   S rS r	S\
S\
S\
S	S
4S jrSrg
)r      znContext-manager that selects a given stream.

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


cur_streamc                 &    Xl         [        U l        g r6   )r   _default_cpu_streamprev_streamr<   s     r   r8   StreamContext.__init__   s    .r   c                 >    U R                   nUc  g [        U l        Uqg r6   )r   rX   r^   )r7   r[   s     r   	__enter__StreamContext.__enter__   s#    [[
 +$r   typevalue	tracebackr   Nc                 <    U R                   nUc  g U R                  qg r6   )r   r^   rX   )r7   rc   rd   re   r[   s        r   __exit__StreamContext.__exit__   s!    [[
 **r   )r^   r   )rA   rB   rC   rD   rE   r   r   __annotations__r8   ra   r   rg   rG   r   r   r   r   r      s?       /%+S + + + +r   r   r   c                     [        U 5      $ )zWrapper 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                      g)zxReturns 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                     g)zrSets 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      r1   r   c                      g)zqReturns 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   r6   )%rE   
contextlibr   typingr   r   r   r    r	   _devicer   __all__strrF   	_device_trV   r   r    r"   r%   r'   r*   r,   r.   r   r   r   r   r]   rX   r   r   r   r   r   r   r   r   r   <module>rv      s;  
 . ' '     '3T)*	.D .
0d 0
54 5
5D 52 2
2 2
%4 %
1t 1
d 	 T 	 	  h %	9 	 	+* +>!6 !4 !c y T  r   