Ë
    S²jÆT  ã                  ó"  — U d Z ddlmZ ddlZddlZddlmZ ddlmZm	Z	m
Z
 ddlZddlZddlmZmZ e
rddlmZ ddlmZ d	d
lmZ d	dlmZmZmZmZmZ d	dlmZmZ da ej@                  «       Z! ejD                  «       Z#g a$de%d<    e&ejN                  dd„ «      Z( e«       a)dZ*de%d<   d@d„Z+ e+«       rCejN                  jX                  Z,ejN                  jZ                  Z.ejN                  j^                  Z0n ed«      Z,dAd„Z.dAd„Z0 ed	¬«      dBd„«       Z1d@d„Z2dCdDd„Z3d@d„Z4d„ Z5dEd „Z6dEd!„Z7dEd"„Z8 G d#„ d$«      Z9 G d%„ d«      Z: G d&„ d'e:«      Z;dFd(„Z<dGdHd)„Z= ed«      dGdId*„«       Z>	 dG	 	 	 dJd+„Z?dBd,„Z@dKd-„ZAdLd.„ZB G d/„ d0«      ZCdMd1„ZDdEd2„ZEdNd3„ZFdGdOd4„ZGdGdPd5„ZHdGdFd6„ZIdQd7„ZJdRd8„ZKdSd9„ZL	 dT	 	 	 	 	 dUd:„ZMdTdVd;„ZNd	d<lOmPZPmQZQmRZRmSZSmTZTmUZUmVZVmWZWmXZXmYZYmZZZm[Z[m\Z\m]Z]m^Z^m_Z_m`Z` d	d=lambZbmcZcmdZdmeZemfZfmgZgmhZhmiZimjZj  e	d>ekelelf   «      Zmg d?¢Zny)Wzó
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.
é    )ÚannotationsN)Ú	lru_cache)ÚAnyÚNewTypeÚTYPE_CHECKING)Ú_dummy_typeÚ_LazySeedTracker)ÚCallable)ÚDeviceé   )Ú_get_device_index)ÚgraphÚgraph_pool_handleÚis_current_stream_capturingÚmake_graphed_callablesÚXPUGraph)ÚEventÚStreamFz*list[tuple[Callable[[], None], list[str]]]Ú_queued_callsÚ_xpu_isInBadForkc                  ó   — y©NF© r   ó    úQ/var/www/html/ia-enhanced/venv/lib/python3.12/site-packages/torch/xpu/__init__.pyú<lambda>r   ,   s   � r   r   ztuple[torch._C.Generator]Údefault_generatorsc                 ó6   — t         j                  j                  S )z(Return true if compile with XPU support.)ÚtorchÚ_CÚ_has_xpur   r   r   Ú_is_compiledr"   1   s   € ä�8‰8×ÑÐr   Ú_XpuDevicePropertiesÚdevicec                ó   — t        d«      ‚©Nz(PyTorch was compiled without XPU support©ÚNotImplementedError©r$   s    r   Ú_exchange_devicer*   >   ó   € Ü!Ð"LÓMÐMr   c                ó   — t        d«      ‚r&   r'   r)   s    r   Ú_maybe_exchange_devicer-   A   r+   r   )Úmaxsizec                 óT   — t        «       syt        j                  j                  «       S )z*Return the number of XPU device available.r   )r"   r   r    Ú_xpu_getDeviceCountr   r   r   Údevice_countr1   E   s   € ô Œ>ØÜ�8‰8×'Ñ'Ó)Ð)r   c                 ó   — t        «       dkD  S )z7Return a bool indicating if XPU is currently available.r   )r1   r   r   r   Úis_availabler3   M   s   € ô ‹>˜AÑÐr   c                óp   — t        «       sy| xs( t        j                  j                  «       j                  S )zKReturn a bool indicating if the current XPU device supports dtype bfloat16.F)r3   r   ÚxpuÚget_device_propertiesÚhas_bfloat16_conversions)Úincluding_emulations    r   Úis_bf16_supportedr9   S   s.   € äŒ>Øàò 	FÜ�9‰9×*Ñ*Ó,×EÑEðr   c                 óh   — t        «       syt        j                  j                  «       j                  S )zGReturn a bool indicating if the current XPU device supports dtype tf32.F)r3   r   r5   r6   Ú'has_subgroup_matrix_multiply_accumulater   r   r   Úis_tf32_supportedr<   ]   s%   € äŒ>Øô
 �9‰9×*Ñ*Ó,×TÑTÐTr   c                 ó(   — t         xr t        «        S )z8Return whether PyTorch's XPU state has been initialized.)Ú_initializedÚ_is_in_bad_forkr   r   r   Úis_initializedr@   h   s   € äÒ1¤Ó 1Ð1Ð1r   c                óf  — t        «       r | «        y |j                  dd«      r)t        j                  | t	        j
                  «       «       y |j                  dd«      r)t        j                  | t	        j
                  «       «       y t        j                  | t	        j
                  «       f«       y )NÚseed_allFÚseed)	r@   ÚgetÚ_lazy_seed_trackerÚqueue_seed_allÚ	tracebackÚformat_stackÚ
queue_seedr   Úappend)ÚcallableÚkwargss     r   Ú
_lazy_callrM   m   s{   € ÜÔÙ�
ð �:‰:�j %Ô(Ü×-Ñ-¨h¼	×8NÑ8NÓ8PÕQØ�Z‰Z˜ Ô&Ü×)Ñ)¨(´I×4JÑ4JÓ4LÕMô × Ñ  (¬I×,BÑ,BÓ,DÐ!EÕFr   c                 ó   — t        «        y)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   {   s	   € ô …Lr   c            	     ó’  — t        «       st        t        d«      ry t        5  t        «       r
	 d d d «       y t	        «       rt        d«      ‚t        «       st        d«      ‚t        j                  j                  «        dt        _        t        j                  d„ t        j                  «       D «       «       	 t        D ]  \  } }	  | «        Œ 	 t'        t        d«       dad d d «       y # t         $ r1}dt#        |«      › ddj%                  |«      › �}t!        |«      |‚d }~ww xY w# t'        t        d«       w xY w# 1 sw Y   y xY w)	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  ó&   K  — | ]	  }|sŒ|–— Œ y ­w©Nr   )Ú.0Úcallss     r   ú	<genexpr>z_lazy_init.<locals>.<genexpr>›   s   è ø€ ÒX uÒRWœUÑXù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   „   sA  € äÔœ7¤4Ð):Ô;ØÜ	ñ !ô ÔØ÷	!ð !ô ÔÜðIóð ô Œ~Ü Ð!FÓGÐGä�‰×ÑÔð  $ŒÔä×ÑÑXÔ0B×0LÑ0LÓ0NÔXÔXð	-Ü/<ò 0Ñ+�˜^ð0Ù•Mñ0ô ”DÐ+Ô,Øˆ÷C!ð !øô2 !ò 0àOÔPSÐTUÓPVÈxð XBØBDÇ'Á'È.ÓBYÐAZð\ð ô $ C›.¨aÐ/ûð0ûô ”DÐ+Õ,ú÷A!ð !úsM   ¢D=·BD=Â9D(ÃC+ÃD(ÃD=Ã+	D%Ã4,D Ä D%Ä%D(Ä(D:Ä:D=Ä=Ec                  ó"   — e Zd Zdd„Zd„ Zdd„Zy)Ú_DeviceGuardc                ó    — || _         d| _        y ©Néÿÿÿÿ)ÚidxÚprev_idx)ÚselfÚindexs     r   Ú__init__z_DeviceGuard.__init__­   s   € ØˆŒØˆ�r   c                ó`   — t         j                  j                  | j                  «      | _        y rT   ©r   r5   r*   rn   ro   ©rp   s    r   Ú	__enter__z_DeviceGuard.__enter__±   ó   € ÜŸ	™	×2Ñ2°4·8±8Ó<ˆ�r   c                ó`   — t         j                  j                  | j                  «      | _        yr   ©r   r5   r-   ro   rn   ©rp   ÚtypeÚvaluerG   s       r   Ú__exit__z_DeviceGuard.__exit__´   ó   € Ü—9‘9×3Ñ3°D·M±MÓBˆŒØr   N)rq   ÚintÚreturnÚNone©r{   r   r|   r   rG   r   )Ú__name__Ú
__module__Ú__qualname__rr   rv   r}   r   r   r   rj   rj   ¬   s   „ óò=ôr   rj   c                  ó&   — e Zd ZdZdd„Zd„ Zdd„Zy)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``.
    c                ó6   — t        |d¬«      | _        d| _        y )NT©Úoptionalrm   )r   rn   ro   )rp   r$   s     r   rr   zdevice.__init__Á   s   € Ü$ V°dÔ;ˆŒØˆ�r   c                ó`   — t         j                  j                  | j                  «      | _        y rT   rt   ru   s    r   rv   zdevice.__enter__Å   rw   r   c                ó`   — t         j                  j                  | j                  «      | _        yr   ry   rz   s       r   r}   zdevice.__exit__È   r~   r   N)r$   r   r€   r�   r‚   )rƒ   r„   r…   Ú__doc__rr   rv   r}   r   r   r   r$   r$   ¹   s   „ ñóò=ôr   c                  ó$   ‡ — e Zd ZdZdˆ fd„Zˆ xZS )Ú	device_ofa  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                   r|j                  «       nd}t        ‰| �  |«       y rl   )Úis_xpuÚ
get_deviceÚsuperrr   )rp   Úobjrn   Ú	__class__s      €r   rr   zdevice_of.__init__×   s$   ø€ Ø"%§*¢*ˆc�n‰nÔ°"ˆÜ‰Ñ˜Õr   ©r€   r�   )rƒ   r„   r…   rŒ   rr   Ú__classcell__)r”   s   @r   rŽ   rŽ   Í   s   ø„ ñ÷ñ r   rŽ   c                óx   — t        «        t        | «      } | dk\  r t        j                  j	                  | «       yy)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                ó,   — t        | «      j                  S )a�  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
    )r6   Únamer)   s    r   Úget_device_namerœ   é   s   € ô ! Ó(×-Ñ-Ð-r   c           	     ó  — t        | «      }t        t        t        t        t        d«      t        t        t        f}t        |«      D �ci c].  }|j                  d«      st        t        ||«      x}|«      r||“Œ0 c}S c c}w )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Ú__)r6   r   ÚfloatÚboolrb   r{   ÚlistÚtupleÚdictÚdirÚ
startswithÚ
isinstanceÚgetattr)r$   ÚpropsÚserializable_typesÚkeyr|   s        r   Úget_device_capabilityr«   ø   sv   € ô " &Ó)€Eäœu¤d¬C´°d³¼TÄ5Ì$ÐOÐô �u“:öàØ�~‰~˜dÔ#Ü¤¨°Ó!4Ð4˜Ð7IÔJð 	ˆU‰
òð ùò s   Á3A>c                óF   — t        «        t        | d¬«      } t        | «      S )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.
    - ``memory_clock_rate`` (int) maximum clock rate of device's global memory in MHz.
    - ``memory_bus_width`` (int) maximum bus width between device and memory in bits.
    - ``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   r6   r6     s!   € ôN „LÜ˜v°Ô5€FÜ! &Ó)Ð)r   c                 óR   — t        «        t        j                  j                  «       S )z0Return the index of a currently selected device.)rO   r   r    Ú_xpu_getDevicer   r   r   Úcurrent_devicer°   =  s   € ä„LÜ�8‰8×"Ñ"Ó$Ð$r   c                ó    — t        | t        «      rt        j                  | «      } | S t        | t        «      rt        j                  d| «      } | S )zŒReturn the torch.device type object from the passed in device.

    Args:
        device (torch.device or int or str): selected device.
    r5   )r¦   rb   r   r$   r   r)   s    r   Ú_get_devicer²   C  sD   € ô �&œ#ÔÜ—‘˜fÓ%ˆð €Mô 
�FœCÔ	 Ü—‘˜e VÓ,ˆØ€Mr   c                óŠ   — t        «        t        | d¬«      } t        |d¬«      }t        j                  j	                  | |«      S )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$   Úpeers     r   Úcan_device_access_peerr¶   P  s8   € ô „LÜ˜v°Ô5€FÜ˜T¨DÔ1€DÜ�8‰8×,Ñ,¨V°TÓ:Ð:r   c                  ó2   — e Zd ZU dZded<   dd„Zd„ Zd	d„Zy)
ÚStreamContexta  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 | NoneÚ
cur_streamc                ó\   — || _         t        d d«      | _        | j                  €d| _        y y )NTrm   )Ústreamr   rn   )rp   r¼   s     r   rr   zStreamContext.__init__n  s-   € ØˆŒÜ$ T¨4Ó0ˆŒØ�8‰8ÐØˆD�Hð r   c                ó¼  — | j                   }|�| j                  dk(  ry t        j                  j	                  d «      | _        | j
                  j                  |j                  k7  rLt        |j                  «      5  t        j                  j	                  |j                  «      | _        d d d «       t        j                  j                  |«       y # 1 sw Y   Œ)xY wrl   )	r¼   rn   r   r5   Úcurrent_streamÚsrc_prev_streamr$   Údst_prev_streamÚ
set_stream)rp   rº   s     r   rv   zStreamContext.__enter__t  s§   € Ø—[‘[ˆ
ØÐ §¡¨R¢ØÜ$Ÿy™y×7Ñ7¸Ó=ˆÔð ×Ñ×&Ñ&¨*×*;Ñ*;Ò;Ü˜
×)Ñ)Ó*ñ SÜ',§y¡y×'?Ñ'?À
×@QÑ@QÓ'R�Ô$÷Sä�	‰	×Ñ˜ZÕ(÷Sð Sús   Á;/CÃCc                ó*  — | j                   }|�| j                  dk(  ry | j                  j                  |j                  k7  r)t        j
                  j                  | j                  «       t        j
                  j                  | j                  «       y rl   )r¼   rn   r¿   r$   r   r5   rÁ   rÀ   )rp   r{   r|   rG   rº   s        r   r}   zStreamContext.__exit__€  sj   € Ø—[‘[ˆ
ØÐ §¡¨R¢Øð ×Ñ×&Ñ&¨*×*;Ñ*;Ò;Ü�I‰I× Ñ  ×!5Ñ!5Ô6Ü�	‰	×Ñ˜T×1Ñ1Õ2r   N)r¼   r¹   r€   r�   r‚   )rƒ   r„   r…   rŒ   Ú__annotations__rr   rv   r}   r   r   r   r¸   r¸   `  s   … ñ	ð (Ó'óò
)ô3r   r¸   c                ó   — t        | «      S )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                óH   — t         j                  j                  | ||¬«       y)a  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                óv   — | €yt        «        t        | j                  | j                  | j                  ¬«       y)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                ó˜   — t        «        t        j                  j                  t	        | d¬«      «      }t        |d   |d   |d   ¬«      S )aR  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   c                óš   — t        «        t        j                  j                  | t	        |d¬«      «      }t        |d   |d   |d   ¬«      S )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   )Údata_ptrr$   rÑ   s      r   Úget_stream_from_externalrÕ   Ç  sM   € ô  „LÜ—‘×4Ñ4ØÔ# F°TÔ:ó€Jô Ø˜Q‘-¨j¸©mÈÐTUÉôð r   c                ón   — t        «        t        | d¬«      } t        j                  j	                  | «      S )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                 ó~   — t        «       sg S t        j                  j                  «       } | €g S | j	                  «       S )z<Return list XPU architectures this library was compiled for.)r"   r   r    Ú_xpu_getArchFlagsÚsplit)Ú
arch_flagss    r   Úget_arch_listrÝ   í  s8   € äŒ>Øˆ	Ü—‘×+Ñ+Ó-€JØÐØˆ	Ø×ÑÓÐr   c                 ój   — t        «       } t        | «      dk(  ryddj                  d„ | D «       «      › �S )zIReturn XPU AOT(ahead-of-time) build flags this library was compiled with.r   rX   z-device ú,c              3  ó    K  — | ]  }|–— Œ y ­wrT   r   )rU   Úarchs     r   rW   z$get_gencode_flags.<locals>.<genexpr>ü  s   è ø€ Ò:¨œtÑ:ùs   ‚)rÝ   Úlenrc   )Ú	arch_lists    r   Úget_gencode_flagsrä   ÷  s5   € ä“€IÜ
ˆ9ƒ~˜ÒØØ�c—h‘hÑ:°	Ô:Ó:Ð;Ð<Ð<r   c                ól   — | j                   }|€
t        «       }t        j                  j                  |   S )zuReturn the XPU Generator object for the given device.

    Args:
        device (torch.device): selected device.
    )rq   r°   r   r5   r   )r$   rn   s     r   Ú_get_generatorræ   ÿ  s/   € ð �,‰,€CØ
€{ÜÓˆÜ�9‰9×'Ñ'¨Ñ,Ð,r   c                óB   ‡ ‡— t        |«      Šdˆˆ fd„}t        |«       y)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).
    c                 ó>   •— t        ‰«      } | j                  ‰«       y rT   )ræ   Ú
set_offset)Údefault_generatorÚfinal_deviceÚoffsets    €€r   Úcbz!_set_rng_state_offset.<locals>.cb  s   ø€ Ü*¨<Ó8ÐØ×$Ñ$ VÕ,r   Nr•   )r²   rM   )rì   r$   rí   rë   s   `  @r   Ú_set_rng_state_offsetrî     s   ù€ ô ˜vÓ&€Lö-ô ˆr…Nr   c                ób   — t        «        t        | «      }t        |«      }|j                  «       S )aL  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œ   r6   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Ø   )r€   r    )r$   r   r€   r   )r€   r   )T)r8   r    r€   r    r•   )r$   r   r€   r�   rT   )r$   r   r€   rb   )r$   r   r€   zdict[str, Any])r$   r   r€   r#   )r$   úint | str | torch.devicer€   útorch.device)r$   r   rµ   r   r€   r    )r¼   r¹   r€   r¸   )r¼   r   r€   r�   )r$   r   r€   r   )rÔ   r   r$   r   r€   r   )r€   z	list[str])r€   rb   )r$   r  r€   ztorch._C.Generator)r5   )rì   r   r$   r  r€   r�   )r$   r  r€   r   )orŒ   Ú
__future__r   Ú	threadingrG   Ú	functoolsr   Útypingr   r   r   r   Útorch._CÚtorch._utilsr   r	   Úcollections.abcr
   Útorch.typesr   Ú_utilsr   Úgraphsr   r   r   r   r   r  r   r   r>   ÚlocalrZ   ÚLockr[   r   rÃ   r§   r    r?   rE   r   r"   r#   Ú_xpu_exchangeDevicer*   Ú_xpu_maybeExchangeDevicer-   r1   r3   r9   r<   r@   rM   rP   rO   rj   r$   rŽ   r™   rœ   r«   r6   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¢   r   r
  Ú__all__r   r   r   ú<module>r     sK  ðòõ #ã Û Ý ß .Ñ .ã Û ß 6ñ Ý(å"å %÷õ ÷ #ð €Ø€y‡�Ó€Ø%�y—~‘~Ó'Ð ð ð ð ó ñ ˜%Ÿ(™(Ð$6¹ÓF€Ù%Ó'Ð Ø02Ð Ð-Ó 2óñ
 „>Ø Ÿ8™8×8Ñ8ÐØ—x‘x×3Ñ3ÐØ"ŸX™X×>Ñ>Ññ 'Ð'=Ó>ÐóNóNñ �1Ôò*ó ð*óôóUò2ó
Góó%÷P
ñ 
÷ñ ô(�ô ó
(ô.ñ ˆ4ƒóó ðð2 ð)*Øð)*àó)*óX%ó
ó;÷ (3ñ (3óV!óóô&ô$ô2
-óó=ó	-ð 5:ðØðØ1ðà	óô&*÷"÷ ÷ ÷ õ ÷&
÷ 
õ 
ñ �~ u¨S°#¨X¡Ó7€ò:�r   