ó
    "EñiT  ã                   ó  • % S r SSKrSSKrSSKJr  SSKJr  SSKJrJ	r	J
r
  SSKrSSKrSSKJrJr  SSKJr  SS	KJr  SS
KJrJrJrJrJr  SSKJrJr  Sq\R<                  " 5       r\R@                  " 5       r!/ q"\#\$\/ S4   \#\%   4      \&S'   \'" \RP                  SS 5      r)\" 5       q*Sr+\$\RP                  RX                     \&S'   S\-4S jr.\." 5       (       aC  \RP                  R^                  r/\RP                  R`                  r1\RP                  Rd                  r3O\" S5      r/S\4S\44S jr1S\4S\44S jr3\" SS9S\44S j5       r5S\-4S jr6SDS\-S\-4S jjr7S\-4S jr8S r9SES jr:SES  jr;SES! jr< " S" S#5      r= " S$ S5      r> " S% S&\>5      r?S\SS4S' jr@SFS\S\%4S( jjrA\" S5      SFS\S\B\%\4   4S) jj5       rC SFS\S\/4S* jjrDS\44S+ jrES\4\%-  \R|                  -  S\R|                  4S, jrFS\S-\S\-4S. jrG " S/ S05      rHS1\
S2   S\H4S3 jrISES4 jrJS1\SS4S5 jrKSFS\S\4S6 jjrLSFS7\4S\S\4S8 jjrMSFS\SS4S9 jjrNS\#\%   4S: jrOS\%4S; jrPS\R|                  S\RP                  RX                  4S< jrQ SGS=\4S\4\%-  \R|                  -  SS4S> jjrRSGS\4\%-  \R|                  -  S\44S? jjrSSS@KTJUrUJVrVJWrWJXrXJYrYJZrZJ[r[J\r\J]r]J^r^J_r_J`r`JaraJbrbJcrcJdrdJere  SSAKfJgrgJhrhJiriJjrjJkrkJlrlJmrmJnrnJoro  \	" SB\$\4\44   5      rp/ SCQrqg)Hzó
This package introduces support for the XPU backend, specifically tailored for
Intel GPU optimization.

This package is lazily initialized, so you can always import it, and use
:func:`is_available()` to determine if your system supports XPU.
é    N)ÚCallable)Ú	lru_cache)ÚAnyÚNewTypeÚOptional)Ú_dummy_typeÚ_LazySeedTracker)ÚDeviceé   )Ú_get_device_index)ÚgraphÚgraph_pool_handleÚis_current_stream_capturingÚmake_graphed_callablesÚXPUGraph)ÚEventÚStreamFÚ_queued_callsÚ_xpu_isInBadForkc                  ó   • g©NF© r   ó    ÚO/home/mande/repo/quber/.venv/lib/python3.13/site-packages/torch/xpu/__init__.pyÚ<lambda>r   &   s   € Àr   r   Údefault_generatorsÚreturnc                  ó6   • [         R                  R                  $ )z(Return true if compile with XPU support.)ÚtorchÚ_CÚ_has_xpur   r   r   Ú_is_compiledr"   +   s   € ä�8‰8×ÑÐr   Ú_XpuDevicePropertiesÚdevicec                 ó   • [        S5      e©Nz(PyTorch was compiled without XPU support©ÚNotImplementedError©r$   s    r   Ú_exchange_devicer*   8   ó   € Ü!Ð"LÓMÐMr   c                 ó   • [        S5      er&   r'   r)   s    r   Ú_maybe_exchange_devicer-   ;   r+   r   )Úmaxsizec                  ó^   • [        5       (       d  g[        R                  R                  5       $ )z*Return the number of XPU device available.r   )r"   r   r    Ú_xpu_getDeviceCountr   r   r   Údevice_countr1   ?   s!   € ô �>‰>ØÜ�8‰8×'Ñ'Ó)Ð)r   c                  ó   • [        5       S:„  $ )z7Return a bool indicating if XPU is currently available.r   )r1   r   r   r   Úis_availabler3   G   s   € ô ‹>˜AÑÐr   Úincluding_emulationc                 ó„   • [        5       (       d  gU =(       d(    [        R                  R                  5       R                  $ )zKReturn a bool indicating if the current XPU device supports dtype bfloat16.F)r3   r   ÚxpuÚget_device_propertiesÚhas_bfloat16_conversions)r4   s    r   Úis_bf16_supportedr9   M   s0   € ä�>‰>Øà÷ 	FÜ�9‰9×*Ñ*Ó,×EÑEðr   c                  ór   • [        5       (       d  g[        R                  R                  5       R                  $ )zGReturn a bool indicating if the current XPU device supports dtype tf32.F)r3   r   r6   r7   Ú'has_subgroup_matrix_multiply_accumulater   r   r   Úis_tf32_supportedr<   W   s'   € ä�>‰>Øô
 �9‰9×*Ñ*Ó,×TÑTÐTr   c                  ó:   • [         =(       a    [        5       (       + $ )z8Return whether PyTorch's XPU state has been initialized.)Ú_initializedÚ_is_in_bad_forkr   r   r   Úis_initializedr@   b   s   € ä×1¤Ó 1Ô1Ð1r   c                 óŠ  • [        5       (       a  U " 5         g UR                  SS5      (       a*  [        R                  U [        R
                  " 5       5        g UR                  SS5      (       a*  [        R                  U [        R
                  " 5       5        g [        R                  U [        R
                  " 5       45        g )NÚseed_allFÚseed)	r@   ÚgetÚ_lazy_seed_trackerÚqueue_seed_allÚ	tracebackÚformat_stackÚ
queue_seedr   Úappend)ÚcallableÚkwargss     r   Ú
_lazy_callrM   g   s„   € Ü×ÑÙ�
ð �:‰:�j %×(Ñ(Ü×-Ñ-¨h¼	×8NÒ8NÓ8PÕQØ�Z‰Z˜ ×&Ñ&Ü×)Ñ)¨(´I×4JÒ4JÓ4LÕMô × Ñ  (¬I×,BÒ,BÓ,DÐ!EÕFr   c                  ó   • [        5         g)zÇInitialize PyTorch's XPU state.
This is a Python API about lazy initialization that avoids initializing
XPU until the first time it is accessed. Does nothing if the XPU state is
already initialized.
N)Ú
_lazy_initr   r   r   ÚinitrP   u   s	   € ô …Lr   c            	      óÐ  • [        5       (       d  [        [        S5      (       a  g [           [        5       (       a
   S S S 5        g [	        5       (       a  [        S5      e[        5       (       d  [        S5      e[        R                  R                  5         S[        l        [        R                  S [        R                  5        5       5         [         H  u  p U " 5         M     ['        [        S5        SqS S S 5        g ! [          a1  nS[#        U5       SSR%                  U5       3n[!        U5      UeS nAff = f! ['        [        S5        f = f! , (       d  f       g = f)	NÚis_initializingzuCannot re-initialize XPU in forked subprocess. To use XPU with multiprocessing, you must use the 'spawn' start methodz#Torch not compiled with XPU enabledTc              3   ó6   #   • U  H  o(       d  M  Uv •  M     g 7f©Nr   )Ú.0Úcallss     r   Ú	<genexpr>Ú_lazy_init.<locals>.<genexpr>•   s   é € ÐXÒ0N uÓRWŸU™UÒ0Nùs   ‚
�	z5XPU call failed lazily at initialization with error: z'

XPU call was originally invoked at:

Ú )r@   ÚhasattrÚ_tlsÚ_initialization_lockr?   ÚRuntimeErrorr"   ÚAssertionErrorr   r    Ú	_xpu_initrR   r   ÚextendrE   Ú	get_callsÚ	ExceptionÚstrÚjoinÚdelattrr>   )Úqueued_callÚorig_tracebackÚeÚmsgs       r   rO   rO   ~   s=  € ä×Ñœ7¤4Ð):×;Ñ;ØÞ	ô ×ÑØ÷	 
Ð	ô ×ÑÜðIóð ô �~‰~Ü Ð!FÓGÐGä�‰×ÑÔð  $ŒÔä×ÑÑXÔ0B×0LÑ0LÔ0NÓXÔXð	-ß/<Ñ+�ð0Ù–Mñ 0=ô ”DÐ+Ô,Øˆ÷C 
Ð	øô2 !ó 0àOÔPSÐTUÓPVÈxð XBØBDÇ'Á'È.ÓBYÐAZð\ð ô $ C›.¨aÐ/ûð0ûô ”DÐ+Õ,ú÷A 
Õ	úsN   ¬EÁBEÃEÃDÃ%EÃ)EÄ
D?Ä,D:Ä:D?Ä?EÅEÅEÅ
E%c                   óB   • \ rS rSrS\SS4S jrS rS\S\S	\4S
 jrSr	g)Ú_DeviceGuardé¦   Úindexr   Nc                 ó   • Xl         SU l        g ©Néÿÿÿÿ©ÚidxÚprev_idx)Úselfrm   s     r   Ú__init__Ú_DeviceGuard.__init__§   s   € ØŒØˆ�r   c                 ó`   • [         R                  R                  U R                  5      U l        g rT   ©r   r6   r*   rr   rs   ©rt   s    r   Ú	__enter__Ú_DeviceGuard.__enter__«   ó   € ÜŸ	™	×2Ñ2°4·8±8Ó<ˆ�r   ÚtypeÚvaluerG   c                 ó`   • [         R                  R                  U R                  5      U l        gr   ©r   r6   r-   rs   rr   ©rt   r}   r~   rG   s       r   Ú__exit__Ú_DeviceGuard.__exit__®   ó   € Ü—9‘9×3Ñ3°D·M±MÓBˆŒØr   rq   )
Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Úintru   rz   r   r‚   Ú__static_attributes__r   r   r   rk   rk   ¦   s4   † ð˜cð  dô ò=ð˜Sð ¨ð ¸÷ r   rk   c                   óF   • \ rS rSrSrS \SS4S jrS rS\S\S	\4S
 jrSr	g)r$   é³   zÃContext-manager that changes the selected device.

Args:
    device (torch.device or int or str): device index to select. It's a no-op if
        this argument is a negative integer or ``None``.
r   Nc                 ó0   • [        USS9U l        SU l        g )NT©Úoptionalrp   )r   rr   rs   )rt   r$   s     r   ru   Údevice.__init__»   s   € Ü$ V°dÑ;ˆŒØˆ�r   c                 ó`   • [         R                  R                  U R                  5      U l        g rT   rx   ry   s    r   rz   Údevice.__enter__¿   r|   r   r}   r~   rG   c                 ó`   • [         R                  R                  U R                  5      U l        gr   r€   r�   s       r   r‚   Údevice.__exit__Â   r„   r   rq   )
r…   r†   r‡   rˆ   Ú__doc__r   ru   rz   r‚   rŠ   r   r   r   r$   r$   ³   s9   † ñð˜sð  tô ò=ð˜Sð ¨ð ¸÷ r   c                   ó0   ^ • \ rS rSrSrSU 4S jjrSrU =r$ )Ú	device_oféÇ   a	  Context-manager that changes the current device to that of given object.

You can use both tensors and storages as arguments. If a given object is
not allocated on a XPU, this is a no-op.

Args:
    obj (Tensor or Storage): object allocated on the selected device.
c                 ój   >• UR                   (       a  UR                  5       OSn[        TU ]  U5        g ro   )Úis_xpuÚ
get_deviceÚsuperru   )rt   Úobjrr   Ú	__class__s      €r   ru   Údevice_of.__init__Ñ   s$   ø€ Ø"%§*§*ˆc�n‰nÔ°"ˆÜ‰Ñ˜Õr   r   ©r   N)r…   r†   r‡   rˆ   r•   ru   rŠ   Ú__classcell__)rž   s   @r   r—   r—   Ç   s   ø† ñ÷õ r   r—   c                 óz   • [        5         [        U 5      n U S:¼  a   [        R                  R	                  U 5        gg)z˜Set the current device.

Args:
    device (torch.device or int or str): selected device. This function is a
        no-op if this argument is negative.
r   N)rO   r   r   r    Ú_xpu_setDevicer)   s    r   Ú
set_devicer¤   Ö   s1   € ô „LÜ˜vÓ&€FØ�ƒ{Ü�‰×Ñ Õ'ð r   c                 ó,   • [        U 5      R                  $ )am  Get the name of a device.

Args:
    device (torch.device or int or str, optional): device for which to
        return the name. This function is a no-op if this argument is a
        negative integer. It uses the current device, given by :func:`~torch.xpu.current_device`,
        if :attr:`device` is ``None`` (default).

Returns:
    str: the name of the device
)r7   Únamer)   s    r   Úget_device_namer§   ã   s   € ô ! Ó(×-Ñ-Ð-r   c           	      ó"  • [        U 5      n[        [        [        [        [        S5      [        [        [        4n[        U5       Vs0 s H:  nUR                  S5      (       a  M  [        [        X5      =oB5      (       d  M8  X4_M<     sn$ s  snf )a¬  Get the xpu capability of a device.

Args:
    device (torch.device or int or str, optional): device for which to
        return the device capability. This function is a no-op if this
        argument is a negative integer. It uses the current device, given by
        :func:`~torch.xpu.current_device`, if :attr:`device` is ``None``
        (default).

Returns:
    dict[str, Any]: the xpu capability dictionary of the device
NÚ__)r7   r‰   ÚfloatÚboolrc   r}   ÚlistÚtupleÚdictÚdirÚ
startswithÚ
isinstanceÚgetattr)r$   ÚpropsÚserializable_typesÚkeyr~   s        r   Úget_device_capabilityr¶   ò   s}   € ô " &Ó)€Eäœu¤d¬C´°d³¼TÄ5Ì$ÐOÐô �u”:óâˆCØ�~‰~˜d×#ó 	ô ¤¨Ó!4Ð4˜×Jó 	ˆŠ
Ùñð ùò s   ÁBÁ&BÂBc                 ó@   • [        5         [        U SS9n [        U 5      $ )a¢  Get the properties of a device. Returns _XpuDeviceProperties containing the following device properties:

- ``name`` (str): device name.
- ``platform_name`` (str): SYCL platform name.
- ``vendor`` (str): device vendor.
- ``device_id`` (int): device identifier (product ID).
- ``driver_version`` (str): driver version.
- ``version`` (str): runtime version.
- ``max_compute_units`` (int): number of parallel compute units.
- ``gpu_eu_count`` (int): number of EUs (Execution Unit).
- ``max_work_group_size``: (int): maximum number of work-items permitted in a work-group.
- ``max_num_sub_groups`` (int): maximum number of sub-groups supported in a work-group.
- ``sub_group_sizes``: (list[int]): a list of supported sub-group sizes.
- ``local_mem_size`` (int): device local memory capacity that can be allocated per work-group in bytes.
- ``has_fp16`` (bool): whether float16 dtype is supported.
- ``has_fp64`` (bool): whether float64 dtype is supported.
- ``has_atomic64`` (bool): whether 64-bit atomic operations are supported.
- ``has_bfloat16_conversions`` (bool): whether bfloat16 conversions are supported.
- ``has_subgroup_matrix_multiply_accumulate`` (bool): whether DPAS (Dot Product Accumulate Systolic) is supported.
- ``has_subgroup_matrix_multiply_accumulate_tensor_float32`` (bool): whether DPAS with tf32 inputs is supported.
- ``has_subgroup_2d_block_io`` (bool): whether 2D block I/O for efficient matrix multiplication is supported.
- ``total_memory`` (int): device global memory in bytes.
- ``gpu_subslice_count`` (int): number of subslice.
- ``architecture`` (int): device architecture identifier (experimental).
- ``type`` (str): device type, e.g. 'cpu', 'gpu', accelerator', 'host', 'unknown'.
- ``uuid`` (Any): device UUID (Universal Unique ID), 16 bytes.

Args:
    device (torch.device or int or str): device for which to return the
        properties of the device.

Returns:
    _XpuDeviceProperties: the properties of the device
TrŽ   )rO   r   Ú_get_device_propertiesr)   s    r   r7   r7     s!   € ôJ „LÜ˜v°Ñ5€FÜ! &Ó)Ð)r   c                  óR   • [        5         [        R                  R                  5       $ )z0Return the index of a currently selected device.)rO   r   r    Ú_xpu_getDevicer   r   r   Úcurrent_devicer»   5  s   € ä„LÜ�8‰8×"Ñ"Ó$Ð$r   c                 ó¸   • [        U [        5      (       a  [        R                  " U 5      n U $ [        U [        5      (       a  [        R                  " SU 5      n U $ )z€Return the torch.device type object from the passed in device.

Args:
    device (torch.device or int or str): selected device.
r6   )r±   rc   r   r$   r‰   r)   s    r   Ú_get_devicer½   ;  sJ   € ô �&œ#×ÑÜ—’˜fÓ%ˆð €Mô 
�FœC×	 Ñ	 Ü—’˜e VÓ,ˆØ€Mr   Úpeerc                 ó|   • [        5         [        U SS9n [        USS9n[        R                  R	                  X5      $ )a  Query whether a device can access a peer device's memory.

Args:
    device (torch.device or int or str): selected device.
    peer (torch.device or int or str): peer device to query access to.

Returns:
    bool: ``True`` if ``device`` can access ``peer``, ``False`` otherwise.
TrŽ   )rO   r   r   r    Ú_xpu_canDeviceAccessPeer)r$   r¾   s     r   Úcan_device_access_peerrÁ   H  s6   € ô „LÜ˜v°Ñ5€FÜ˜T¨DÑ1€DÜ�8‰8×,Ñ,¨VÓ:Ð:r   c                   ó^   • \ rS rSr% Sr\S   \S'   S\S   SS4S jrS	 rS
\	S\	S\	4S jr
Srg)ÚStreamContextiX  a   Context-manager that selects a given stream.

All XPU kernels queued within its context will be enqueued on a selected
stream.

Args:
    Stream (Stream): selected stream. This manager is a no-op if it's
        ``None``.
.. note:: Streams are per-device.
útorch.xpu.StreamÚ
cur_streamÚstreamr   Nc                 ó\   • Xl         [        S S5      U l        U R                  c  SU l        g g )NTrp   )rÆ   r   rr   )rt   rÆ   s     r   ru   ÚStreamContext.__init__f  s+   € ØŒÜ$ T¨4Ó0ˆŒØ�8‰8ÑØˆD�Hð r   c                 óÌ  • U R                   nUb  U R                  S:X  a  g [        R                  R	                  S 5      U l        U R
                  R                  UR                  :w  aL  [        UR                  5         [        R                  R	                  UR                  5      U l        S S S 5        [        R                  R                  U5        g ! , (       d  f       N.= fro   )	rÆ   rr   r   r6   Úcurrent_streamÚsrc_prev_streamr$   Údst_prev_streamÚ
set_stream)rt   rÅ   s     r   rz   ÚStreamContext.__enter__l  sœ   € Ø—[‘[ˆ
ØÑ §¡¨R£ØÜ$Ÿy™y×7Ñ7¸Ó=ˆÔð ×Ñ×&Ñ&¨*×*;Ñ*;Ó;Ü˜
×)Ñ)Õ*Ü',§y¡y×'?Ñ'?À
×@QÑ@QÓ'R�Ô$÷ +ä�	‰	×Ñ˜ZÕ(÷ +Õ*ús   Á>/CÃ
C#r}   r~   rG   c                 ó0  • U R                   nUb  U R                  S:X  a  g U R                  R                  UR                  :w  a)  [        R
                  R                  U R                  5        [        R
                  R                  U R                  5        g ro   )rÆ   rr   rË   r$   r   r6   rÍ   rÌ   )rt   r}   r~   rG   rÅ   s        r   r‚   ÚStreamContext.__exit__x  sj   € Ø—[‘[ˆ
ØÑ §¡¨R£Øð ×Ñ×&Ñ&¨*×*;Ñ*;Ó;Ü�I‰I× Ñ  ×!5Ñ!5Ô6Ü�	‰	×Ñ˜T×1Ñ1Õ2r   )rÌ   rr   rË   rÆ   )r…   r†   r‡   rˆ   r•   r   Ú__annotations__ru   rz   r   r‚   rŠ   r   r   r   rÃ   rÃ   X  sM   ‡ ñ	ð Ð+Ñ,Ó,ð˜xÐ(:Ñ;ð Àô ò
)ð3˜Sð 3¨ð 3¸÷ 3r   rÃ   rÆ   rÄ   c                 ó   • [        U 5      $ )z§Wrap around the Context-manager StreamContext that selects a given stream.

Arguments:
    stream (Stream): selected stream. This manager is a no-op if it's ``None``.
)rÃ   ©rÆ   s    r   rÆ   rÆ   ƒ  s   € ô ˜Ó Ð r   c                 óB   • [         R                  R                  U UUS9  g)zþset stream specified by the stream id, device index and device type

Args: stream_id (int): not visible to the user, used to assigned to the specific stream.
      device_index (int): selected device index.
      device_type (int): selected device type.
©Ú	stream_idÚdevice_indexÚdevice_typeN)r   r    Ú_xpu_setStreamrÕ   s      r   Ú_set_stream_by_idrÚ   Œ  s$   € ô 
‡H�H×ÑØØ!Øð ò r   c                 ór   • U c  g[        5         [        U R                  U R                  U R                  S9  g)a  Set the current stream. This is a wrapper API to set the stream.
    Usage of this function is discouraged in favor of the ``stream``
    context manager.

Args:
    stream (Stream): selected stream. This function is a no-op
        if this argument is ``None``.
NrÕ   )rO   rÚ   rÖ   r×   rØ   rÓ   s    r   rÍ   rÍ   š  s4   € ð �~ØÜ„LÜØ×"Ñ"Ø×(Ñ(Ø×&Ñ&ór   c                 óŒ   • [        5         [        R                  R                  [	        U SS95      n[        US   US   US   S9$ )a:  Return the currently selected :class:`Stream` for a given device.

Args:
    device (torch.device or int, optional): selected device. Returns
        the currently selected :class:`Stream` for the current device, given
        by :func:`~torch.xpu.current_device`, if :attr:`device` is ``None``
        (default).
TrŽ   r   r   é   rÕ   )rO   r   r    Ú_xpu_getCurrentStreamr   r   )r$   Ú
streamdatas     r   rÊ   rÊ   ­  sJ   € ô „LÜ—‘×/Ñ/Ü˜&¨4Ñ0ó€Jô Ø˜Q‘-¨j¸©mÈÐTUÉñð r   Údata_ptrc                 óŽ   • [        5         [        R                  R                  U [	        USS95      n[        US   US   US   S9$ )a  Return a :class:`Stream` from an external SYCL queue.

This function is used to wrap SYCL queue created in other libraries in order
to facilitate data exchange and multi-library interactions.

.. note:: This function doesn't manage the queue life-cycle, it is the user
   responsibility to keep the referenced queue alive while this returned stream is
   being used. The different SYCL queue pointers will result in distinct
   :class:`Stream` objects, even if the SYCL queues they dereference are equivalent.

Args:
    data_ptr(int): Integer representation of the `sycl::queue*` value passed externally.
    device(torch.device or int, optional): the device where the queue was originally created.
        It is the user responsibility to ensure the device is specified correctly.
TrŽ   r   r   rÝ   rÕ   )rO   r   r    Ú_xpu_getStreamFromExternalr   r   )rà   r$   rß   s      r   Úget_stream_from_externalrã   ¿  sM   € ô  „LÜ—‘×4Ñ4ØÔ# F°TÑ:ó€Jô Ø˜Q‘-¨j¸©mÈÐTUÉñð r   c                 óh   • [        5         [        U SS9n [        R                  R	                  U 5      $ )a  Wait for all kernels in all streams on a XPU device to complete.

Args:
    device (torch.device or int, optional): device for which to synchronize.
        It uses the current device, given by :func:`~torch.xpu.current_device`,
        if :attr:`device` is ``None`` (default).
TrŽ   )rO   r   r   r    Ú_xpu_synchronizer)   s    r   Úsynchronizeræ   Ø  s*   € ô „LÜ˜v°Ñ5€FÜ�8‰8×$Ñ$ VÓ,Ð,r   c                  óŠ   • [        5       (       d  / $ [        R                  R                  5       n U c  / $ U R	                  5       $ )z<Return list XPU architectures this library was compiled for.)r"   r   r    Ú_xpu_getArchFlagsÚsplit)Ú
arch_flagss    r   Úget_arch_listrë   å  s:   € ä�>‰>Øˆ	Ü—‘×+Ñ+Ó-€JØÑØˆ	Ø×ÑÓÐr   c                  ól   • [        5       n [        U 5      S:X  a  gSSR                  S U  5       5       3$ )zIReturn XPU AOT(ahead-of-time) build flags this library was compiled with.r   rY   z-device Ú,c              3   ó$   #   • U  H  ov •  M     g 7frT   r   )rU   Úarchs     r   rW   Ú$get_gencode_flags.<locals>.<genexpr>ô  s   é € Ð:²	¨œt²	ùs   ‚)rë   Úlenrd   )Ú	arch_lists    r   Úget_gencode_flagsró   ï  s5   € ä“€IÜ
ˆ9ƒ~˜ÓØØ�c—h‘hÑ:±	Ó:Ó:Ð;Ð<Ð<r   c                 ón   • U R                   nUc
  [        5       n[        R                  R                  U   $ )ziReturn the XPU Generator object for the given device.

Args:
    device (torch.device): selected device.
)rm   r»   r   r6   r   )r$   rr   s     r   Ú_get_generatorrõ   ÷  s/   € ð �,‰,€CØ
�{ÜÓˆÜ�9‰9×'Ñ'¨Ñ,Ð,r   Úoffsetc                 óF   ^ ^• [        U5      mSUU 4S jjn[        U5        g)a  Set the random number generator state offset of the specified GPU.

Args:
    offset (int): The desired offset
    device (torch.device or int, optional): The device to set the RNG state.
        Default: ``'xpu'`` (i.e., ``torch.device('xpu')``, the current XPU device).
Nc                  ó>   >• [        T5      n U R                  T5        g rT   )rõ   Ú
set_offset)Údefault_generatorÚfinal_devicerö   s    €€r   ÚcbÚ!_set_rng_state_offset.<locals>.cb  s   ø€ Ü*¨<Ó8ÐØ×$Ñ$ VÕ,r   r    )r½   rM   )rö   r$   rü   rû   s   `  @r   Ú_set_rng_state_offsetrþ     s"   ù€ ô ˜vÓ&€L÷-ð -ô ˆr…Nr   c                 ób   • [        5         [        U 5      n[        U5      nUR                  5       $ )a4  Return the random number generator state offset of the specified GPU.

Args:
    device (torch.device or int, optional): The device to return the RNG state offset of.
        Default: ``'xpu'`` (i.e., ``torch.device('xpu')``, the current XPU device).

.. warning::
    This function eagerly initializes XPU.
)rO   r½   rõ   Ú
get_offset)r$   rû   rú   s      r   Ú_get_rng_state_offsetr    s-   € ô „LÜ˜vÓ&€LÜ& |Ó4ÐØ×'Ñ'Ó)Ð)r   )Úchange_current_allocatorÚempty_cacheÚget_per_process_memory_fractionÚmax_memory_allocatedÚmax_memory_reservedÚmem_get_infoÚmemory_allocatedÚmemory_reservedÚmemory_snapshotÚmemory_statsÚmemory_stats_as_nested_dictÚMemPoolÚreset_accumulated_memory_statsÚreset_peak_memory_statsÚset_per_process_memory_fractionÚuse_mem_poolÚXPUPluggableAllocator)	Úget_rng_stateÚget_rng_state_allÚinitial_seedÚmanual_seedÚmanual_seed_allrC   rB   Úset_rng_stateÚset_rng_state_allÚ_POOL_HANDLE)9r   r   rÃ   r  r   rÁ   r  r»   rÊ   r   r$   r—   r1   r  rë   r¶   r§   r7   ró   r  r  r  rã   r   r   rP   r  r3   r9   r   r@   r<   r   r  r  r  r  r  r  r	  r
  r  r  r  r  r  r  rC   rB   r¤   r  r  r  rÍ   rÆ   Ústreamsræ   )Tr    rT   )r6   )rr•   Ú	threadingrG   Úcollections.abcr   Ú	functoolsr   Útypingr   r   r   r   Útorch._CÚtorch._utilsr   r	   Útorch.typesr
   Ú_utilsr   Úgraphsr   r   r   r   r   r  r   r   r>   Úlocalr[   ÚLockr\   r   r¬   r­   rc   rÑ   r²   r    r?   rE   r   Ú	Generatorr«   r"   r#   Ú_xpu_exchangeDevicer*   Ú_xpu_maybeExchangeDevicer-   r‰   r1   r3   r9   r<   r@   rM   rP   rO   rk   r$   r—   r¤   r§   r®   r¶   r7   r»   r½   rÁ   rÃ   rÆ   rÚ   rÍ   rÊ   rã   ræ   rë   ró   rõ   rþ   r  Úmemoryr  r  r  r  r  r  r  r	  r
  r  r  r  r  r  r  r  r  Úrandomr  r  r  r  r  rC   rB   r  r  r  Ú__all__r   r   r   Ú<module>r-     sÌ  ðòó Û Ý $Ý ß )Ñ )ã Û ß 6Ý å %÷õ ÷ #ð €Ø‡‚Ó€Ø —~’~Ó'Ð ð ð ˆtØ	ˆ(�2�t�8Ñ
˜d 3™iÐ
'Ñ(ñó ñ ˜%Ÿ(™(Ð$6¹ÓF€Ù%Ó'Ð Ø02Ð �E˜%Ÿ(™(×,Ñ,Ñ-Ó 2ð�dô ñ
 ‡>�>Ø Ÿ8™8×8Ñ8ÐØ—x‘x×3Ñ3ÐØ"ŸX™X×>Ñ>Ññ 'Ð'=Ó>ÐðN ð N¨ô NðN sð N¨sô Nñ �1Ñð*�có *ó ð*ð�dô ñ¨4ð ¸4õ ðU˜4ô Uò2ô
Gôô%÷P
ñ 
÷ñ ô(�ô ð
(�vð 
( $ô 
(ñ.˜Fð .¨cõ .ñ ˆ4ƒñ &ð °D¸¸c¸±Nô ó ðð2 ñ'*Øð'*àõ'*ðT%˜ô %ð
˜˜c™	 E§L¡LÑ0ð 
°U·\±\ô 
ð; 6ð ;°ð ;¸Dô ;÷ (3ñ (3ðV!�8Ð.Ñ/ð !°Mô !ôð�vð  $ô ñ&˜6ð ¨Võ ñ$ sð °Fð Àfõ ñ2
-˜ð 
-¨$õ 
-ð�t˜C‘yô ð=˜3ô =ð	-˜5Ÿ<™<ð 	-¨E¯H©H×,>Ñ,>ô 	-ð 5:ñØðØ˜s™ U§\¡\Ñ1ðà	õñ&* #¨¡)¨e¯l©lÑ":ð *Àsõ *÷"÷ ÷ ÷ õ ÷&
÷ 
õ 
ñ �~ u¨S°#¨X¡Ó7€ò:�r   