
    [Th                        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!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     J/var/www/auris/envauris/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                      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   D   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   M       r   c                   L    \ rS rSrSrSS\SS4S jjrSS jrSS jrSS	 jr	S
r
g)r   W   z@
N.B. This class only exists to facilitate device-agnostic code
priorityr   Nc                     g Nr   )selfr2   s     r   __init__Stream.__init__\       r   c                     g r4   r   r5   r   s     r   wait_streamStream.wait_stream_   r8   r   c                     g r4   r   r5   s    r   record_eventStream.record_eventb   r8   r   c                     g r4   r   )r5   events     r   
wait_eventStream.wait_evente   r8   r   r   )r   N)__name__
__module____qualname____firstlineno____doc__intr6   r;   r?   rC   __static_attributes__r   r   r   r   r   W   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   i   r   c                     g)NTr   r>   s    r   queryEvent.queryj   s    r   Nc                     g r4   r   r:   s     r   recordEvent.recordm   r8   r   c                     g r4   r   r>   s    r   r   Event.synchronizep   r8   r   c                     g r4   r   r:   s     r   wait
Event.waits   r8   r   r   r4   rF   )
rG   rH   rI   rJ   boolrQ   rT   r   rY   rM   r   r   r   r   r   i   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   {   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 r4   )r   _default_cpu_streamprev_streamr:   s     r   r6   StreamContext.__init__   s    .r   c                 >    U R                   nUc  g [        U l        Uqg r4   )r   r]   rc   )r5   r`   s     r   	__enter__StreamContext.__enter__   s#    [[
 +$r   typevalue	tracebackr   Nc                 <    U R                   nUc  g U R                  qg r4   )r   rc   r]   )r5   rh   ri   rj   r`   s        r   __exit__StreamContext.__exit__   s!    [[
 **r   )rc   r   )rG   rH   rI   rJ   rK   r   r   __annotations__r6   rf   r   rl   rM   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      r/   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   r4   )$rK   
contextlibr   typingr   r   r   r    r	   _devicer   __all__strrL   	_device_tr[   r   r    r"   r%   r'   r*   r,   r   r   r   r   rb   r]   r   r   r   r   r   r   r   r   r   <module>r{      s/  
 . ' '     '3T)*	.D .
0d 0
54 5
5D 52 2
2 2
%4 %
d 	 T  $  h %	9 	 	+* +>!6 !4 !c y T  r   