
    9i                        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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\R,                  R.                  S
S4S jjr " S S5      r " S S5      r\" 5       r\qS"S\R,                  R.                  S
\4S jjr " S S\5      rS\S
\4S jrS
\ 4S jr!S\R,                  R.                  S
S4S jr"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is_initialized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     R/var/www/html/land-doc-ocr/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(   4       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+   9   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   C   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   L       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   V   z@
N.B. This class only exists to facilitate device-agnostic code
priorityr   Nc                     g Nr   )selfr3   s     r   __init__Stream.__init__[       r   c                     g r5   r   r6   r   s     r   wait_streamStream.wait_stream^   r9   r   c                     g r5   r   r6   s    r   record_eventStream.record_eventa   r9   r   c                     g r5   r   )r6   events     r   
wait_eventStream.wait_eventd   r9   r   r   )r   N)__name__
__module____qualname____firstlineno____doc__intr7   r<   r@   rD   __static_attributes__r   r   r   r   r   V   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   r?   s    r   queryEvent.queryi   s    r   Nc                     g r5   r   r;   s     r   recordEvent.recordl   r9   r   c                     g r5   r   r?   s    r   r   Event.synchronizeo   r9   r   c                     g r5   r   r;   s     r   wait
Event.waitr   r9   r   r   r5   rG   )
rH   rI   rJ   rK   boolrR   rU   r   rZ   rN   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 r5   )r   _default_cpu_streamprev_streamr;   s     r   r7   StreamContext.__init__   s    .r   c                 >    U R                   nUc  g [        U l        Uqg r5   )r   r^   rd   )r6   ra   s     r   	__enter__StreamContext.__enter__   s#    [[
 +$r   typevalue	tracebackr   Nc                 <    U R                   nUc  g U R                  qg r5   )r   rd   r^   )r6   ri   rj   rk   ra   s        r   __exit__StreamContext.__exit__   s!    [[
 **r   )rd   r   )rH   rI   rJ   rK   rL   r   r   __annotations__r7   rg   r   rm   rN   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      r0   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   c                      g)zxReturns True if the CPU is initialized. Always True.

N.B. This function only exists to facilitate device-agnostic code
Tr   r   r   r   r   r      s    
 r   r5   )&rL   
contextlibr   typingr   r   r   r    r	   _devicer   __all__r\   r   r!   r#   r&   r(   r+   r-   r   typesDevicer   r   r   rc   r^   r   r   r   rM   r   r   strr   r   r   r   r   <module>r~      sD  
 . ' '    .D .
0d 0
54 5
5D 52 2
2 2
%4 %
d ** d  $  h %	5;;-- 	 	+* +>!6 !4 !c u{{)) d   r   