+
    ˜°³jùÓ  ã                  óD  a € 0 t $ R t^ RIHt ^ RIt^ RIt^ RIt^ RIt^ RIt^ RI	H
t
HtHtHtHtHt ^ RIHt ^ RIHtHtHt ^ RIt^ RIt^ RIHtHt ]'       d   ^ RIHt ^ RIHt ^R	IH t  ^R
I!H"t"H#t#H$t$H%t%H&t& ^RI'H(t(H)t) Rs*]PV                  ! 4       t,]PZ                  ! 4       t.. s/R]0R&   ]1! ]Pd                  RR 4      t3]! 4       s4RÁt5R]0R&   Rs6R]0R&   ]Pn                   ! R R4      4       t8. s9R]0R&   ^–t:R R lt;];! 4       '       dD   ]Pd                  Px                  t<]Pd                  Pz                  t>]Pd                  P~                  t@M]! R4      t<R R lt>R R lt@RÂR  R! lltAR" R# ltBR$ R% ltCR& R' ltDR( R) ltER* R+ ltFRÃR, R- lltGR. R/ ltHR0 tIR1 R2 ltJR3 R4 ltKR5 R6 ltL ! R7 R84      tM ! R9 R:4      tN ! R; R<]N4      tOR= R> ltPRÄR? R@ lltQ]! R4      RÄRA RB ll4       tRRÄRC RD lltSRE RF ltTRG RH ltURI RJ ltV ! RK RL4      tWRM RN ltXRO RP ltYRQ RR ltZRÄRS RT llt[RÄRU RV llt\RÄRW RX llt]RY RZ lt^R[ R\ lt_R] R^ lt`R_ R` ltaRÅRa Rb lltbRÅRc Rd lltcRe tdRf Rg lteRh Ri ltfRj Rk ltgRÄRl Rm llthRÄRn Ro lltiRÄRp Rq lltjRÄRr Rs lltkRÄRt Ru lltlRÄRv Rw lltmRÄRx Ry lltnRÄRz R{ lltoRÄR| R} lltpRÄR~ R lltqRÄR€ R� lltr^R‚IsHtttHutuHvtvHwtwHxtxHytyHztzH{t{H|t|H}t}H~t~HtH€t€H�t�H‚t‚HƒtƒH„t„H…t… ^RƒI†H‡t‡HˆtˆH‰t‰HŠtŠH‹t‹HŒtŒH�t�HŽtŽH�t� ]! R„]�]‘]‘3,          4      t’. R…NR†NRLNR‡NRˆNR‰NRŠNR‹NRŒNR�NRNR:NR<NRŽNR�NR�NR‘NR’NR“NR”NR•NR–NR—NR˜NR™NRšNR›NRœNR�NRžNRŸNR NR¡NR¢NR£NR¤NR¥NR¦NR§NR¨NR©NRªNR«NR¬NR­NR®NR¯NR°NR±NR²NR³NR´NRµNR¶NR·NR¸NR¹NRºNR»NR¼NR½NR¾NR¿NRÀNt“R# )Æzó
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)ÚbyrefÚc_doubleÚc_uint32Úc_void_pÚcastÚpointer)Ú	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                 ó   € R # ©F© r   ó    ÚS/home/luca/screen-checking/.venv/lib/python3.14/site-packages/torch/xpu/__init__.pyÚ<lambda>r    0   s   € Ár   ztuple[torch._C.Generator]Údefault_generatorsú
int | NoneÚ_cached_device_countc                  ó„   € ] tR t^6t$ R]R&   RtR]R&   RtR]R&   RtR	]R
&   RtR	]R&   Rt	R	]R&   Rt
R	]R&   RtR	]R&   RtR# )Ú_ZesDeviceInfor   Údevice_handleNr"   Úsubdevice_idFÚboolÚis_integratedzc_void_p | NoneÚtemperature_handleÚfrequency_handleÚpower_handleÚengine_handleÚmemory_handler   )Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__annotations__r'   r)   r*   r+   r,   r-   r.   Ú__static_attributes__r   r   r   r%   r%   6   sP   ‡ àÓØ#€L�*Ó#Ø€M�4ÓØ*.Ð˜Ó.Ø(,Ð�oÓ,Ø$(€L�/Ó(Ø%)€M�?Ó)Ø%)€M�?×)r   r%   zlist[_ZesDeviceInfo]Ú_cached_zes_device_infosc               ó   € V ^8„  d   QhRR/# ©é   Úreturnr(   r   )Úformats   "r   Ú__annotate__r;   G   s   € ÷ ñ �dñ r   c                 ó6   € \         P                  P                  # )z(Return true if compile with XPU support.)ÚtorchÚ_CÚ_has_xpur   r   r   Ú_is_compiledr@   G   s   € ä�8‰8×ÑÐr   Ú_XpuDevicePropertiesc               ó    € V ^8„  d   QhRRRR/# ©r8   ÚdeviceÚintr9   r   )r:   s   "r   r;   r;   T   s   € ÷ Nñ N ð N¨ñ Nr   c                ó   € \        R 4      h©z(PyTorch was compiled without XPU support©ÚNotImplementedError©rD   s   &r   Ú_exchange_devicerK   T   ó   € Ü!Ð"LÓMÐMr   c               ó    € V ^8„  d   QhRRRR/# rC   r   )r:   s   "r   r;   r;   W   s   € ÷ Nñ N sð N¨sñ Nr   c                ó   € \        R 4      hrG   rH   rJ   s   &r   Ú_maybe_exchange_devicerO   W   rL   r   c               ó   € V ^8„  d   QhRR/# )r8   r9   ú	list[int]r   )r:   s   "r   r;   r;   [   s   € ÷ "ñ "¨Iñ "r   c                óh  € \         P                  ! R4      pVf   \        \        ^€4      4      # . pVP	                  R4       F?  p \        VP                  4       4      pT^ 8¼  g   K&  YB9  g   K.  TP                  T4       KA  	  V#   \         d     T '       d   \        RT R24      Rh. u u # i ; i)a  Parse ``ZE_AFFINITY_MASK`` and return visible device ordinals.

Returns a list of non-negative device ordinals specified by the mask.
When the mask is unset, returns ``[0, 1, ..., 127]`` (the maximum range
for ``int8_t`` device indices).  Returns an empty list for unsupported
COMPOSITE-style masks (e.g. ``"0.0,0.1"``).

Args:
    strict (bool): If ``True``, raises ``ValueError`` on unsupported mask
        formats (e.g. COMPOSITE-style ``"0.0,0.1"``).  If ``False``
        (default), returns an empty list instead.
ÚZE_AFFINITY_MASKNÚ,z&Unsupported ZE_AFFINITY_MASK format: 'z='. Expected a comma-separated list of integers, e.g. '0,1,2'.)	ÚosÚgetenvÚlistÚrangeÚsplitrE   ÚstripÚ
ValueErrorÚappend)ÚstrictÚvarÚvisible_devicesÚelemÚxs   &    r   Ú_parse_visible_devicesrb   [   s³   € ô �)Š)Ð&Ó
'€CØ
‚{ô ”E˜#“JÓÐà!#€OØ—	‘	˜#–ˆð
	Ü�D—J‘J“LÓ!ˆAð �Ž6�aÖ.Ø×"Ñ" 1Ö%ñ ð Ðøô ô 	÷ Ü Ø<¸S¸EÐA~Ðóàðð ŒIð	ús   ÁBÂB1ÂB1Â0B1c               ó    € V ^8„  d   QhRRRR/# ©r8   Úvisible_maskrQ   r9   rE   r   )r:   s   "r   r;   r;   €   s   € ÷ v ñ v ¨ð v °sñ v r   c           
     ó–  a€  ^ RI oR T3R llpT! SP                  ^ 4      R4      '       d   R# \        ^ 4      pT! SP	                  \        T4      R4      R4      '       d   R# TP                  ^ 8X  d   ^ # SP                  TP                  ,          ! 4       pT! SP	                  \        T4      T4      R4      '       d   R# \        ^ 4      pT! SP                  T^ ,          \        T4      R4      R4      '       d   R# SP                  TP                  ,          ! 4       pT! SP                  T^ ,          \        T4      T4      R4      '       d   R# ^p\        P                  ! R	4      R
8g  p\        P                  4        \        T 4      p^ p	^ p
^ pT EFQ  pSP                  4       pSP                   Tn        SP%                  4       pSP&                  Tn        \)        \+        T4      \,        4      Tn        T! SP1                  T\        T4      4      R4      '       d   Ru # \3        TP4                  T,          4      pT'       * ;'       d    TP6                  ^ 8„  ;'       d    TpT'       d   TP6                  M^p\9        T4       FX  pY˜9   dG   \        P;                  \=        TT'       d   TMRTR7      4       T'       d   T
^,          p
M	T^,          pT	^,          p	KZ  	  EKT  	  T'       d3   T
'       d+   \         Uu. uF  pTP>                  '       d   K  TNK  	  upsT;'       g    T
#   \         d    Ru # i ; iu upi )ao  Enumerate visible XPU devices via Level Zero Sysman and cache their info.

Enumerates devices from the first Level Zero Sysman driver and counts those
whose logical index appears in *visible_mask*.  Only devices listed in
the visible mask participate in counting.
The populated ``_cached_zes_device_infos`` list is indexed by PyTorch
device ordinal.

Discrete GPUs (dGPUs) take priority: if any visible dGPU is found, only
dGPUs are counted; integrated GPUs (iGPUs) are counted only when no
visible dGPU exists.

For tiled dGPUs (``numSubdevices > 0``), the counting depends on
``ZE_FLAT_DEVICE_HIERARCHY``:

- **FLAT / COMBINED** (default): each sub-device is exposed as a
  separate top-level device and counted individually.
- **COMPOSITE**: sub-devices are hidden; the whole physical device
  counts as one.

Returns the visible device count, or a negative value on failure.
Nc               ó$   € V ^8„  d   QhRRRRRR/# )r8   ÚrcrE   ÚmsgÚstrr9   r(   r   )r:   s   "r   r;   Ú,_enum_zes_device_infos.<locals>.__annotate__ž   s!   € ÷ -ñ -˜Cð - cð -¨dñ -r   c                ót   <€ V SP                   8w  d   \        P                  ! V^R7       V SP                   8g  # )zQReturn True if the call failed (rc != ZE_RESULT_SUCCESS) after issuing a warning.)Ú
stacklevel)ÚZE_RESULT_SUCCESSÚwarningsÚwarn©rh   ri   Úpyzess   &&€r   Ú_zes_check_warnÚ/_enum_zes_device_infos.<locals>._zes_check_warnž   s0   ø€ à�×(Ñ(Ô(Ü�MŠM˜#¨!Õ,Ø�U×,Ñ,Ñ,Ð,r   z"Can't initialize Level Zero Sysmanz(Can't get Level Zero Sysman driver countz*Can't get Level Zero Sysman driver handlesz(Can't get Level Zero Sysman device countz*Can't get Level Zero Sysman device handlesÚZE_FLAT_DEVICE_HIERARCHYÚ	COMPOSITEz-Can't get Level Zero Sysman device properties)r&   r'   r)   éÿÿÿÿ) rr   Ú	ExceptionÚzesInitr   ÚzesDriverGetr   ÚvalueÚzes_driver_handle_tÚzesDeviceGetÚzes_device_handle_trU   rV   r5   ÚclearÚsetÚzes_device_properties_tÚ$ZES_STRUCTURE_TYPE_DEVICE_PROPERTIESÚstypeÚzes_device_ext_properties_tÚ(ZES_STRUCTURE_TYPE_DEVICE_EXT_PROPERTIESr   r   r   ÚpNextÚzesDeviceGetPropertiesr(   ÚflagsÚnumSubdevicesrX   r\   r%   r)   )re   rs   Údriver_countÚdriversÚdevice_countÚdevicesÚ#ZES_DEVICE_PROPERTY_FLAG_INTEGRATEDÚexpose_subdevicesÚvisibleÚlogical_indexÚnum_igpuÚnum_dgpurD   ÚpropsÚ	ext_propsr)   ÚtiledÚ	num_slotsÚslotÚinforr   s   &                   @r   Ú_enum_zes_device_infosrš   €   sÿ  ø€ ð.Û÷-ð -ñ �u—}‘} QÓ'Ð)M×NÒNØˆ	ä˜A“;€LÙØ×Ñœ5 Ó.°Ó5Ø2÷ò ð ˆ	Ø×Ñ˜QÔÙà×(Ñ(¨<×+=Ñ+=Ö=Ó@€GÙØ×Ñœ5 Ó.°Ó8Ø4÷ò ð ˆ	ä˜A“;€LÙØ×Ñ˜7 1�:¤u¨\Ó':¸DÓAØ2÷ò ð ˆ	à×(Ñ(¨<×+=Ñ+=Ö=Ó@€GÙØ×Ñ˜7 1�:¤u¨\Ó':¸GÓDØ4÷ò ð ˆ	ð +1Ð'ÜŸ	š	Ð"<Ó=ÀÑLÐä×"Ñ"Ô$Ü�,Ó€GØ€MØ€HØ€HäˆØ×-Ñ-Ó/ˆØ×@Ñ@ˆŒØ×5Ñ5Ó7ˆ	Ø×HÑHˆ	ŒÜœ7 9Ó-¬xÓ8ˆŒÙØ×(Ñ(¨´°u³Ó>Ø;÷
ò 
ð ŠIä˜YŸ_™_Ð/RÕRÓSˆð "Ô!×SÐS e×&9Ñ&9¸AÑ&=×SÐSÐBSˆß+0�E×'Ò'°aˆ	ä˜)Ö$ˆDØÔ'Ü(×/Ñ/Ü"Ø&,ß-2¡T¸Ø&3ôô÷ !Ø •M‘Hà •M�HØ˜QÕŠMô %ñ' ÷F —Hå5ó$
Ù5�T¸T×=OÕ=O�DˆDÑ5ñ$
Ð ð ×Ð�xÐøô{ ô ØŠ	ðüòt$
s   ƒL3 ÌMÌMÌ3MÍMc               ó    € V ^8„  d   QhRRRR/# rd   r   )r:   s   "r   r;   r;   ù   s   € ÷ 0ñ 0¨	ð 0°cñ 0r   c                ó   € \        V 4      # )zRReturn the visible XPU device count via Level Zero Sysman, or negative on failure.)rš   )re   s   &r   Ú_raw_device_count_zesr�   ù   s   € ä! ,Ó/Ð/r   c               ó   € V ^8„  d   QhRR/# ©r8   r9   rE   r   )r:   s   "r   r;   r;   þ   s   € ÷ 2ñ 2˜3ñ 2r   c                 ó@   € \        4       p V '       g   R# \        V 4      # )z;Return the number of visible XPU devices, or -1 on failure.rw   )rb   r�   )r_   s    r   Ú_device_count_zesr¡   þ   s   € ä,Ó.€OßØˆ	Ü  Ó1Ð1r   c               ó   € V ^8„  d   QhRR/# rŸ   r   )r:   s   "r   r;   r;     s   € ÷ ñ �cñ r   c                 óF  € \        4       '       g   ^ # \        e   \        # \        '       g   \        \        R4      '       d    \
        P                  P                  4       p M1\        4       pV^ 8  d   \
        P                  P                  4       MTp \        '       d   V sV # )zÀ
Return the number of XPU device available.

.. note:: This API will NOT poison fork if Level Zero Sysman discovery succeeds.
    See :ref:`multiprocessing-poison-fork-note` for more details.
Úis_initializing)	r@   r#   Ú_initializedÚhasattrÚ_tlsr=   r>   Ú_xpu_getDeviceCountr¡   )ÚcountÚ	zes_counts     r   rŒ   rŒ     sr   € ô �>Š>ÙäÒ'Ü#Ð#ßƒ|”wœtÐ%6×7Ò7Ü—‘×,Ñ,Ó.‰ä%Ó'ˆ	Ø2;¸a´-”—‘×,Ñ,Ô.ÀYˆ÷ ƒ|Ø$ÐØ€Lr   c               ó   € V ^8„  d   QhRR/# r7   r   )r:   s   "r   r;   r;     s   € ÷ ñ �dñ r   c                 ó   € \        4       ^ 8„  # )z7Return a bool indicating if XPU is currently available.)rŒ   r   r   r   Úis_availabler­     s   € ô ‹>˜AÑÐr   c               ó    € V ^8„  d   QhRRRR/# )r8   Úincluding_emulationr(   r9   r   )r:   s   "r   r;   r;   %  s   € ÷ ñ ¨4ð ¸4ñ r   c                óŠ   € \        4       '       g   R# T ;'       g)    \        P                  P                  4       P                  # )zKReturn a bool indicating if the current XPU device supports dtype bfloat16.F)r­   r=   ÚxpuÚget_device_propertiesÚhas_bfloat16_conversions)r¯   s   &r   Úis_bf16_supportedr´   %  s6   € ä�>Š>Ùà÷ 	Fð 	FÜ�9‰9×*Ñ*Ó,×EÑEðr   c               ó   € V ^8„  d   QhRR/# r7   r   )r:   s   "r   r;   r;   /  s   € ÷ Uñ U˜4ñ Ur   c                 óv   € \        4       '       g   R# \        P                  P                  4       P                  # )zGReturn a bool indicating if the current XPU device supports dtype tf32.F)r­   r=   r±   r²   Ú'has_subgroup_matrix_multiply_accumulater   r   r   Úis_tf32_supportedr¸   /  s'   € ä�>Š>Ùô
 �9‰9×*Ñ*Ó,×TÑTÐTr   c                 ó<   € \         ;'       d    \        4       '       * # )z8Return whether PyTorch's XPU state has been initialized.)r¥   Ú_is_in_bad_forkr   r   r   Úis_initializedr»   :  s   € ä×1Ð1¤Ó 1Ô1Ð1r   c               ó   € V ^8„  d   QhRR/# ©r8   r9   ÚNoner   )r:   s   "r   r;   r;   ?  s   € ÷ Kñ K dñ Kr   c                óè  € \         ;_uu_ 4        \        4       '       d	   V ! 4        M®VP                  R R4      '       d+   \        P	                  V \
        P                  ! 4       4       MlVP                  RR4      '       d+   \        P                  V \
        P                  ! 4       4       M*\        P                  V \
        P                  ! 4       34       RRR4       R#   + '       g   i     R# ; i)Úseed_allFÚseedN)
Ú_initialization_lockr»   ÚgetÚ_lazy_seed_trackerÚqueue_seed_allÚ	tracebackÚformat_stackÚ
queue_seedr   r\   )ÚcallableÚkwargss   &,r   Ú
_lazy_callrË   ?  s™   € ß	Ö	Ü×ÒÙ�Jð �z‰z˜* e×,Ò,Ü"×1Ñ1°(¼I×<RÒ<RÓ<TÕUØ—‘˜F E×*Ò*Ü"×-Ñ-¨h¼	×8NÒ8NÓ8PÕQô ×$Ñ$ h´	×0FÒ0FÓ0HÐ%IÔJ÷ 
×	×	Ò	ús   �0C Á AC ÂAC Ã C1	c               ó   € V ^8„  d   QhRR/# r½   r   )r:   s   "r   r;   r;   N  s   € ÷ ñ ˆdñ r   c                 ó   € \        4        R# )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   ÚinitrÏ   N  s	   € ô †Lr   c               ó   € V ^8„  d   QhRR/# r½   r   )r:   s   "r   r;   r;   W  s   € ÷ %ñ %�Dñ %r   c            
     óø  € \        4       '       g   \        \        R 4      '       d   R# \        ;_uu_ 4        \        4       '       d    RRR4       R# \	        4       '       d   \        R4      h\        4       '       g   \        R4      h\        P                  P                  4        R\        n        \        P                  R \        P                  4        4       4        \         F  w  r V ! 4        K  	  \'        \        R 4       RsRRR4       R#   \          d2   pR\#        T4       RRP%                  T4       2p\!        T4      ThRp?ii ; i  \'        \        R 4       i ; i  + '       g   i     R# ; i)	r¤   NzuCannot 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  ó8   "  € T F  q'       g   K  Vx € K  	  R # 5i©Nr   )Ú.0Úcallss   & r   Ú	<genexpr>Ú_lazy_init.<locals>.<genexpr>n  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»   r¦   r§   rÂ   rº   ÚRuntimeErrorr@   ÚAssertionErrorr=   r>   Ú	_xpu_initr¤   r   ÚextendrÄ   Ú	get_callsrx   rj   ÚjoinÚdelattrr¥   )Úqueued_callÚorig_tracebackÚeri   s       r   rÎ   rÎ   W  sC  € ä×Òœ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Ã4EÃ8E(ÄE	Ä,E	ÅE	ÅEÅE%Å%E(Å(E9	c                  ó4   € ] tR tRtR R ltR tR R ltRtR# )	Ú_DeviceGuardi  c               ó    € V ^8„  d   QhRRRR/# )r8   ÚindexrE   r9   r¾   r   )r:   s   "r   r;   Ú_DeviceGuard.__annotate__€  s   € ÷ ñ ˜cð  dñ r   c                	ó    € Wn         RV n        R# ©é   Nrw   ©ÚidxÚprev_idx)Úselfræ   s   &&r   Ú__init__Ú_DeviceGuard.__init__€  s   € ØŒØˆŽr   c                	ób   € \         P                  P                  V P                  4      V n        R # rÓ   ©r=   r±   rK   rì   rí   ©rî   s   &r   Ú	__enter__Ú_DeviceGuard.__enter__„  ó   € ÜŸ	™	×2Ñ2°4·8±8Ó<ˆŽr   c               ó$   € V ^8„  d   QhRRRRRR/# ©r8   Útyper
   r{   rÆ   r   )r:   s   "r   r;   rç   ‡  ó!   € ÷ ñ ˜Sð ¨ð ¸ñ r   c                	ób   € \         P                  P                  V P                  4      V n        R # r   ©r=   r±   rO   rí   rì   ©rî   rù   r{   rÆ   s   &&&&r   Ú__exit__Ú_DeviceGuard.__exit__‡  ó   € Ü—9‘9×3Ñ3°D·M±MÓBˆŒÙr   rë   N)r/   r0   r1   r2   rï   rô   rþ   r4   r   r   r   rä   rä     s   † õò=÷ñ r   rä   c                  ó8   € ] tR tRtRtR R ltR tR R ltRtR	# )
rD   iŒ  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               ó    € V ^8„  d   QhRRRR/# )r8   rD   r
   r9   r¾   r   )r:   s   "r   r;   Údevice.__annotate__”  s   € ÷ ñ ˜sð  tñ r   c                	ó8   € \        VR R7      V n        RV n        R# )T©ÚoptionalNrw   )r   rì   rí   )rî   rD   s   &&r   rï   Údevice.__init__”  s   € Ü$ V°dÔ;ˆŒØˆŽr   c                	ób   € \         P                  P                  V P                  4      V n        R # rÓ   rò   ró   s   &r   rô   Údevice.__enter__˜  rö   r   c               ó$   € V ^8„  d   QhRRRRRR/# rø   r   )r:   s   "r   r;   r  ›  rú   r   c                	ób   € \         P                  P                  V P                  4      V n        R # r   rü   rý   s   &&&&r   rþ   Údevice.__exit__›  r   r   rë   N)	r/   r0   r1   r2   Ú__doc__rï   rô   rþ   r4   r   r   r   rD   rD   Œ  s   † ñõò=÷ñ r   rD   c                  ó2   a € ] tR tRtRtR V 3R lltRtV ;t# )Ú	device_ofi   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               ó   € V ^8„  d   QhRR/# r½   r   )r:   s   "r   r;   Údevice_of.__annotate__ª  s   € ÷ ñ ˜tñ r   c                	ón   <€ VP                   '       d   VP                  4       MRp\        SV `  V4       R# ré   )Úis_xpuÚ
get_deviceÚsuperrï   )rî   Úobjrì   Ú	__class__s   && €r   rï   Údevice_of.__init__ª  s&   ø€ Ø"%§*§* *ˆc�n‰nÔ°"ˆÜ‰Ñ˜Ör   r   )r/   r0   r1   r2   r  rï   r4   Ú__classcell__)r  s   @r   r  r     s   ø† ñ÷ö r   r  c               ó    € V ^8„  d   QhRRRR/# ©r8   rD   r   r9   r¾   r   )r:   s   "r   r;   r;   ¯  s   € ÷ 
(ñ 
(�vð 
( $ñ 
(r   c                ó€   € \        4        \        V 4      p V ^ 8¼  d"   \        P                  P	                  V 4       R# R# )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.
N)rÎ   r   r=   r>   Ú_xpu_setDevicerJ   s   &r   Ú
set_devicer  ¯  s1   € ô „LÜ˜vÓ&€FØ�„{Ü�‰×Ñ Ö'ñ r   c               ó    € V ^8„  d   QhRRRR/# )r8   rD   r   r9   rj   r   )r:   s   "r   r;   r;   ¼  s   € ÷ .ñ .˜Fð .¨cñ .r   c                ó,   € \        V 4      P                  # )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
)r²   ÚnamerJ   s   &r   Úget_device_namer"  ¼  s   € ô ! Ó(×-Ñ-Ð-r   c               ó    € V ^8„  d   QhRRRR/# )r8   rD   r   r9   zdict[str, Any]r   )r:   s   "r   r;   r;   Ì  s   € ÷ ñ  &ð °Nñ r   c           	     ó$  € \        V 4      p\        \        \        \        \        R4      \        \        \        3p\        V4       Uu/ uF<  pVP                  R4      '       d   K  \        \        W4      ;qB4      '       g   K:  W4bK>  	  up# u upi )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Ú__)r²   rE   Úfloatr(   rj   rù   rW   ÚtupleÚdictÚdirÚ
startswithÚ
isinstanceÚgetattr)rD   r”   Ú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               ó    € V ^8„  d   QhRRRR/# )r8   rD   r   r9   rA   r   )r:   s   "r   r;   r;   ä  s   € ÷ +*ñ +*Øð+*àñ+*r   c                óF   € \        4        \        V RR7      p \        V 4      # )a3	  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.
- ``last_level_cache_size`` (int): size in bytes of the device's last-level memory cache, shared across all Xe Cores (analogous to CUDA ``L2_cache_size``).
- ``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.
- ``is_integrated_gpu`` (bool): whether the device is an integrated GPU (iGPU).
- ``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  )rÎ   r   Ú_get_device_propertiesrJ   s   &r   r²   r²   ä  s!   € ôR „LÜ˜v°Ô5€FÜ! &Ó)Ð)r   c               ó   € V ^8„  d   QhRR/# rŸ   r   )r:   s   "r   r;   r;     s   € ÷ %ñ %˜ñ %r   c                 óR   € \        4        \        P                  P                  4       # )z0Return the index of a currently selected device.)rÎ   r=   r>   Ú_xpu_getDevicer   r   r   Úcurrent_devicer6    s   € ä„LÜ�8‰8×"Ñ"Ó$Ð$r   c               ó    € V ^8„  d   QhRRRR/# )r8   rD   úint | str | torch.devicer9   útorch.devicer   )r:   s   "r   r;   r;     s   € ÷ 
ñ 
Ð0ð 
°\ñ 
r   c                ó¼   € \        V \        4      '       d   \        P                  ! V 4      p V # \        V \        4      '       d   \        P                  ! RV 4      p V # )z€Return the torch.device type object from the passed in device.

Args:
    device (torch.device or int or str): selected device.
r±   )r+  rj   r=   rD   rE   rJ   s   &r   Ú_get_devicer;    sJ   € ô �&œ#×ÒÜ—’˜fÓ%ˆð €Mô 
�FœC×	 Ò	 Ü—’˜e VÓ,ˆØ€Mr   c               ó$   € V ^8„  d   QhRRRRRR/# )r8   rD   r   Úpeerr9   r(   r   )r:   s   "r   r;   r;   %  s!   € ÷ ;ñ ; 6ð ;°ð ;¸Dñ ;r   c                óˆ   € \        4        \        V RR7      p \        VRR7      p\        P                  P	                  W4      # )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  )rÎ   r   r=   r>   Ú_xpu_canDeviceAccessPeer)rD   r=  s   &&r   Úcan_device_access_peerr@  %  s6   € ô „LÜ˜v°Ô5€FÜ˜T¨DÔ1€DÜ�8‰8×,Ñ,¨VÓ:Ð:r   c                  óD   € ] tR tRt$ RtR]R&   R R ltR tR R	 ltR
t	R# )ÚStreamContexti5  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 | NoneÚ
cur_streamc               ó    € V ^8„  d   QhRRRR/# )r8   ÚstreamrC  r9   r¾   r   )r:   s   "r   r;   ÚStreamContext.__annotate__C  s   € ÷ ñ Ð6ð ¸4ñ r   c                	ób   € Wn         \        R R4      V n        V P                  f
   RV n        R # R # )NTrw   )rF  r   rì   )rî   rF  s   &&r   rï   ÚStreamContext.__init__C  s+   € ØŒÜ$ T¨4Ó0ˆŒØ�8‰8ÒØˆDŽHñ r   c                	óê  € V P                   pVe   V P                  R8X  d   R # \        P                  P	                  R 4      V n        V P
                  P                  VP                  8w  dU   \        VP                  4      ;_uu_ 4        \        P                  P	                  VP                  4      V n        R R R 4       \        P                  P                  V4       R #   + '       g   i     L1; i©Nrw   )	rF  rì   r=   r±   Úcurrent_streamÚsrc_prev_streamrD   Údst_prev_streamÚ
set_stream)rî   rD  s   & r   rô   ÚStreamContext.__enter__I  sŸ   € Ø—[‘[ˆ
ØÒ §¡¨R¤ÙÜ$Ÿy™y×7Ñ7¸Ó=ˆÔð ×Ñ×&Ñ&¨*×*;Ñ*;Ô;Ü˜
×)Ñ)×*Õ*Ü',§y¡y×'?Ñ'?À
×@QÑ@QÓ'R�Ô$÷ +ä�	‰	×Ñ˜ZÖ(÷ +×*ús   Â
/C"Ã"C2	c               ó$   € V ^8„  d   QhRRRRRR/# rø   r   )r:   s   "r   r;   rG  U  s!   € ÷ 3ñ 3˜Sð 3¨ð 3¸ñ 3r   c                	ó:  € V P                   pVe   V P                  R8X  d   R # V P                  P                  VP                  8w  d*   \        P
                  P                  V P                  4       \        P
                  P                  V P                  4       R # rK  )rF  rì   rM  rD   r=   r±   rO  rN  )rî   rù   r{   rÆ   rD  s   &&&& r   rþ   ÚStreamContext.__exit__U  sj   € Ø—[‘[ˆ
ØÒ §¡¨R¤Ùð ×Ñ×&Ñ&¨*×*;Ñ*;Ô;Ü�I‰I× Ñ  ×!5Ñ!5Ô6Ü�	‰	×Ñ˜T×1Ñ1Ö2r   )rN  rì   rM  rF  N)
r/   r0   r1   r2   r  r3   rï   rô   rþ   r4   r   r   r   rB  rB  5  s#   ‡ ñ	ð (Ó'õò
)÷3ñ 3r   rB  c               ó    € V ^8„  d   QhRRRR/# )r8   rF  rC  r9   rB  r   )r:   s   "r   r;   r;   `  s   € ÷ !ñ !Ð*ð !¨}ñ !r   c                ó   € \        V 4      # )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``.
)rB  ©rF  s   &r   rF  rF  `  s   € ô ˜Ó Ð r   c               ó   € V ^8„  d   QhRR/# r½   r   )r:   s   "r   r;   r;   i  s   € ÷ ñ ¸tñ r   c                óJ   € \         P                  P                  V VVR7       R# )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_setStreamrY  s   &&&r   Ú_set_stream_by_idr^  i  s$   € ô 
‡H�H×ÑØØ!Øð ö r   c               ó    € V ^8„  d   QhRRRR/# )r8   rF  r   r9   r¾   r   )r:   s   "r   r;   r;   w  s   € ÷ ñ �vð  $ñ r   c                ó~   € V f   R# \        4        \        V P                  V P                  V P                  R7       R# )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``.
NrY  )rÎ   r^  rZ  r[  r\  rV  s   &r   rO  rO  w  s4   € ð ‚~ÙÜ„LÜØ×"Ñ"Ø×(Ñ(Ø×&Ñ&÷r   c               ó    € V ^8„  d   QhRRRR/# )r8   rD   r   r9   r   r   )r:   s   "r   r;   r;   Š  s   € ÷ ñ ˜6ð ¨Vñ r   c                ó°   € \        4        \        P                  P                  \	        V RR7      4      p\        V^ ,          V^,          V^,          R7      # )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  rY  )rÎ   r=   r>   Ú_xpu_getCurrentStreamr   r   )rD   Ú
streamdatas   & r   rL  rL  Š  sJ   € ô „LÜ—‘×/Ñ/Ü˜&¨4Ô0ó€Jô Ø˜Q•-¨j¸­mÈÐTUÍôð r   c               ó$   € V ^8„  d   QhRRRRRR/# )r8   Údata_ptrrE   rD   r   r9   r   r   )r:   s   "r   r;   r;   œ  s!   € ÷ ñ  sð °Fð Àfñ r   c                ó²   € \        4        \        P                  P                  V \	        VRR7      4      p\        V^ ,          V^,          V^,          R7      # )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  rY  )rÎ   r=   r>   Ú_xpu_getStreamFromExternalr   r   )rf  rD   rd  s   && r   Úget_stream_from_externalri  œ  sM   € ô  „LÜ—‘×4Ñ4ØÔ# F°TÔ:ó€Jô Ø˜Q•-¨j¸­mÈÐTUÍôð r   c               ó    € V ^8„  d   QhRRRR/# r  r   )r:   s   "r   r;   r;   µ  s   € ÷ 
-ñ 
-˜ð 
-¨$ñ 
-r   c                ón   € \        4        \        V RR7      p \        P                  P	                  V 4      # )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  )rÎ   r   r=   r>   Ú_xpu_synchronizerJ   s   &r   Úsynchronizerm  µ  s*   € ô „LÜ˜v°Ô5€FÜ�8‰8×$Ñ$ VÓ,Ð,r   c               ó    € V ^8„  d   QhRRRR/# )r8   ÚcyclesrE   r9   r¾   r   )r:   s   "r   r;   r;   Â  s   € ÷ 	 ñ 	 �3ð 	 ˜4ñ 	 r   c                óD   € \         P                  P                  V 4       R# )a  Spin the current XPU device for the given number of device clock cycles.

The kernel is enqueued on the current stream and returns immediately on the
host; the device-side spin runs asynchronously.

Args:
    cycles (int): number of device clock cycles to spin.
N)r=   r>   Ú
_xpu_sleep)ro  s   &r   Ú_sleeprr  Â  s   € ô 
‡H�H×Ñ˜Ör   c               ó   € V ^8„  d   QhRR/# )r8   r9   z	list[str]r   )r:   s   "r   r;   r;   Î  s   € ÷ ñ �yñ r   c                 óŽ   € \        4       '       g   . # \        P                  P                  4       p V f   . # V P	                  4       # )z<Return list XPU architectures this library was compiled for.)r@   r=   r>   Ú_xpu_getArchFlagsrY   )Ú
arch_flagss    r   Úget_arch_listrw  Î  s:   € ä�>Š>Øˆ	Ü—‘×+Ñ+Ó-€JØÒØˆ	Ø×ÑÓÐr   c               ó   € V ^8„  d   QhRR/# )r8   r9   rj   r   )r:   s   "r   r;   r;   Ø  s   € ÷ =ñ =˜3ñ =r   c                 óp   € \        4       p \        V 4      ^ 8X  d   R# RRP                  R V  4       4       2# )zIReturn XPU AOT(ahead-of-time) build flags this library was compiled with.rØ   z-device rT   c              3  ó$   "  € T F  qx € K  	  R # 5irÓ   r   )rÔ   Úarchs   & r   rÖ   Ú$get_gencode_flags.<locals>.<genexpr>Ý  s   é € Ð:±	¨œt³	ùs   ‚)rw  ÚlenrÞ   )Ú	arch_lists    r   Úget_gencode_flagsr  Ø  s5   € ä“€IÜ
ˆ9ƒ~˜ÔÙØ�c—h‘hÑ:±	Ó:Ó:Ð;Ð<Ð<r   c               ó    € V ^8„  d   QhRRRR/# )r8   rD   r9  r9   ztorch._C.Generatorr   )r:   s   "r   r;   r;   à  s   € ÷ 	-ñ 	-˜<ð 	-Ð,>ñ 	-r   c                óx   € V P                   pVf   \        4       p\        P                  P                  V,          # )ziReturn the XPU Generator object for the given device.

Args:
    device (torch.device): selected device.
)ræ   r6  r=   r±   r!   )rD   rì   s   & r   Ú_get_generatorr‚  à  s/   € ð �,‰,€CØ
‚{ÜÓˆÜ�9‰9×'Ñ'¨Õ,Ð,r   c               ó$   € V ^8„  d   QhRRRRRR/# )r8   ÚoffsetrE   rD   r8  r9   r¾   r   )r:   s   "r   r;   r;   ì  s$   € ÷ ñ ØðØ1ðà	ñr   c                óJ   a a€ \        V4      oR VV 3R llp\        V4       R# )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               ó   € V ^8„  d   QhRR/# r½   r   )r:   s   "r   r;   Ú+_set_rng_state_offset.<locals>.__annotate__ø  s   € ÷ -ñ -�ñ -r   c                 ó@   <€ \        S4      p V P                  S4       R # rÓ   )r‚  Ú
set_offset)Údefault_generatorÚfinal_devicer„  s    €€r   ÚcbÚ!_set_rng_state_offset.<locals>.cbø  s   ø€ Ü*¨<Ó8ÐØ×$Ñ$ VÖ,r   N)r;  rË   )r„  rD   rŒ  r‹  s   f& @r   Ú_set_rng_state_offsetrŽ  ì  s"   ù€ ô ˜vÓ&€L÷-ñ -ô ˆr†Nr   c               ó    € V ^8„  d   QhRRRR/# )r8   rD   r8  r9   rE   r   )r:   s   "r   r;   r;   ÿ  s   € ÷ *ñ *Ð":ð *Àsñ *r   c                ób   € \        4        \        V 4      p\        V4      pVP                  4       # )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.
)rÎ   r;  r‚  Ú
get_offset)rD   r‹  rŠ  s   &  r   Ú_get_rng_state_offsetr’  ÿ  s-   € ô „LÜ˜vÓ&€LÜ& |Ó4ÐØ×'Ñ'Ó)Ð)r   c                 óz   €  ^ RI p V #   \         d    \        R4      Rh\         d   p\        R4      ThRp?ii ; i)znReturn the imported pyzes module; raise ImportError if missing, RuntimeError if the GPU driver is unavailable.Nz7pyzes is required; install it with 'pip install pyzes'.zZFailed to import pyzes. Ensure the GPU driver is installed with Level Zero Sysman support.)rr   ÚImportErrorrx   rÙ   )rr   Úerrs     r   Ú_import_pyzesr–    sS   € ð	Ûð €Løô ô ÜØEó
àð	ô ô ÜØhó
àð	ûðús   ‚ ˆ:¨:©5µ:c               ó   € V ^8„  d   QhRR/# )r8   r9   ztuple[int, ...]r   )r:   s   "r   r;   r;     s   € ÷ 8ñ 8˜Oñ 8r   c                 ój   € ^ RI Hp  \        \        \        V ! R4      P                  R4      4      4      # )z§
Return the version of the pyzes package as a tuple of integers (major, minor, patch).
Always ensure that the pyzes package is installed before calling this function.
©Úversionrr   Ú.)Úimportlib.metadatarš  r'  ÚmaprE   rY   r™  s    r   Ú_get_pyzes_versionrž    s)   € õ
 +ä””S™' 'Ó*×0Ñ0°Ó5Ó6Ó7Ð7r   c               ó$   € V ^8„  d   QhRRRRRR/# )r8   rh   rE   ri   rj   r9   r¾   r   )r:   s   "r   r;   r;   (  s!   € ÷ /ñ /�3ð /˜Sð / Tñ /r   c                óP   € ^ RI pWP                  8w  d   \        V RV  R24      hR# )zRRaise RuntimeError if the Level Zero Sysman call failed (rc != ZE_RESULT_SUCCESS).Nz (rc=Ú))rr   rn   rÙ   rq   s   && r   Ú
_zes_checkr¢  (  s.   € ãà	×$Ñ$Ô$Ü˜c˜U %¨ t¨1Ð-Ó.Ð.ñ %r   c               ó   € V ^8„  d   QhRR/# )r8   rD   rE   r   )r:   s   "r   r;   r;   0  s   € ÷ 

ñ 

 Sñ 

r   c                ó¶   € \         '       g&   \        \        RR7      4      ^ 8  d   \        R4      h\	        \         4      pW8¼  d   \        RV  RV R24      hR# )zLEnsure the ZES device info cache is populated and validate the device index.T)r]   z2Failed to enumerate devices via Level Zero Sysman.zThe device zD is out of range for Level Zero Sysman. It must be in the range [0, ú).N)r5   rš   rb   rÙ   r}  )rD   Útotal_devicess   & r   Ú_zes_ensure_device_infosr§  0  s`   € ç#Ó#Ü!Ô"8ÀÔ"EÓFÈÔJÜÐSÓTÐTäÔ0Ó1€MØÔÜØ˜&˜Ð!eÐfsÐetÐtvÐwó
ð 	
ñ r   c               ó    € V ^8„  d   QhRRRR/# ©r8   rD   r   r9   r   r   )r:   s   "r   r;   r;   =  s   € ÷ @ñ @¨ð @¸(ñ @r   c           	     ó‚  € \        4       p\        V RR7      p \        V 4       \        V ,          pVP                  e   VP                  # VP
                  pVP                  p\        ^ 4      p\        VP                  V\        V4      R4      R4       VP                  ^ 8X  d   \        R4      hVP                  VP                  ,          ! 4       p\        VP                  V\        V4      V4      R4       RpV F«  pVP                  4       p	VP                  V	n        \        VP#                  V\        V	4      4      R4       V	P$                  VP&                  8w  d   Kf  Ve,   V	P(                  '       d   V	P*                  V8X  d   Tp MK“  K•  V	P(                  '       d   K©  Tp M	  Vf   \        R4      hWrn        V# )	a¼  Return the Level Zero Sysman GPU temperature sensor handle for the specified device.

The result is cached in ``_ZesDeviceInfo.temperature_handle`` so that
repeated calls skip sensor enumeration.  ``_cached_zes_device_infos``
is lazily populated on the first call.

Args:
    device (torch.device, str or int, optional): target device. Uses the
        current device, given by :func:`~torch.xpu.current_device`,
        if ``None`` (default).
Tr  Nz5Can't get Level Zero Sysman temperature sensor count.z/No Level Zero Sysman temperature sensors found.z7Can't get Level Zero Sysman temperature sensor handles.z3Can't get Level Zero Sysman temperature properties.z2No Level Zero Sysman GPU temperature handle found.)r–  r   r§  r5   r*   r&   r'   r   r¢  ÚzesDeviceEnumTemperatureSensorsr   r{   rÙ   Úzes_temp_handle_tÚzes_temp_properties_tÚ"ZES_STRUCTURE_TYPE_TEMP_PROPERTIESrƒ   ÚzesTemperatureGetPropertiesrù   ÚZES_TEMP_SENSORS_GPUÚonSubdeviceÚsubdeviceId)
rD   rr   r™   r&   r'   Ú
temp_countÚtemp_handlesr*   Útemp_handleÚ
temp_propss
   &         r   Ú_get_zes_temperature_handler·  =  s¯  € ô ‹O€Eä˜v°Ô5€FÜ˜VÔ$ä# FÕ+€DØ×ÑÒ*Ø×&Ñ&Ð&à×&Ñ&€MØ×$Ñ$€Lô
 ˜!“€JÜØ×-Ñ-¨m¼UÀ:Ó=NÐPTÓUØ?ôð ×Ñ˜1ÔÜÐLÓMÐMØ×+Ñ+¨j×.>Ñ.>Ö>ÓA€LÜØ×-Ñ-Øœ5 Ó,¨ló	
ð 	Bô	ð ÐÛ#ˆØ×0Ñ0Ó2ˆ
Ø ×CÑCˆ
ÔÜØ×-Ñ-¨k¼5ÀÓ;LÓMØAô	
ð �?‰?˜e×8Ñ8Ô8ÙØÒ#Ø×%×%Ð%¨*×*@Ñ*@ÀLÔ*PØ%0Ð"Ùñ +QÑ%ð ×)×)Ò)Ø%0Ð"Ùñ! $ð$ Ò!ÜÐOÓPÐPØ0ÔØÐr   c               ó    € V ^8„  d   QhRRRR/# ©r8   rD   r   r9   r&  r   )r:   s   "r   r;   r;   €  s   € ÷ ñ ˜ð ¨%ñ r   c                óø   € \        V 4      p^ RIp\        R4      pVP                  V\	        V4      4      pWBP
                  8X  d   \        R4      hWBP                  8w  d   \        RV R24      hVP                  # )aO  Return the GPU temperature in degrees Celsius.

Args:
    device (torch.device, str or int, optional): selected device. Uses the
        current device, given by :func:`~torch.xpu.current_device`,
        if ``None`` (default).

.. note:: This API may require elevated privileges (e.g. ``sudo``) to access GPU temperature information.
Ng        z\GPU temperature querying is not available. Try running with elevated privileges (e.g. sudo).z0Can't get Level Zero Sysman GPU temperature (rc=r¥  )	r·  rr   r   ÚzesTemperatureGetStater   ÚZE_RESULT_ERROR_NOT_AVAILABLErÙ   rn   r{   )rD   r*   rr   Útemprh   s   &    r   Útemperaturer¾  €  s|   € ô 5°VÓ<Ðãä�C‹=€DØ	×	%Ñ	%Ð&8¼%À»+Ó	F€BØ	×0Ñ0Ô0ÜØjó
ð 	
ð 
×$Ñ$Ô$ÜÐMÈbÈTÐQSÐTÓUÐUØ�:‰:Ðr   c               ó    € V ^8„  d   QhRRRR/# r©  r   )r:   s   "r   r;   r;   ™  s   € ÷ Cñ C fð C¸ñ Cr   c           	     óÂ  € \        4       p\        V RR7      p \        V 4       \        V ,          pVP                  e   VP                  # VP
                  pVP                  p\        ^ 4      p\        VP                  V\        V4      R4      R4       VP                  ^ 8X  d   \        R4      hVP                  VP                  ,          ! 4       p\        VP                  V\        V4      V4      R4       \        4       R	8  d   V^ ,          pWrn        V# RpV F«  pVP                  4       p	VP                   V	n        \        VP%                  V\        V	4      4      R4       V	P&                  VP(                  8w  d   Kf  Ve,   V	P*                  '       d   V	P,                  V8X  d   Tp MK“  K•  V	P*                  '       d   K©  Tp M	  Vf   \        R4      hWrn        V# )
a¸  Return the Level Zero Sysman GPU frequency domain handle for the specified device.

The result is cached in ``_ZesDeviceInfo.frequency_handle`` so that
repeated calls skip domain enumeration.  ``_cached_zes_device_infos``
is lazily populated on the first call.

Args:
    device (torch.device, str or int, optional): target device. Uses the
        current device, given by :func:`~torch.xpu.current_device`,
        if ``None`` (default).
Tr  Nz4Can't get Level Zero Sysman frequency domains count.z-No Level Zero Sysman frequency domains found.z5Can't get Level Zero Sysman frequency domain handles.z1Can't get Level Zero Sysman frequency properties.z0No Level Zero Sysman GPU frequency handle found.©é    rê   r8   )r–  r   r§  r5   r+   r&   r'   r   r¢  ÚzesDeviceEnumFrequencyDomainsr   r{   rÙ   Úzes_freq_handle_trž  Úzes_freq_properties_tÚ"ZES_STRUCTURE_TYPE_FREQ_PROPERTIESrƒ   ÚzesFrequencyGetPropertiesrù   ÚZES_FREQ_DOMAIN_GPUr±  r²  )
rD   rr   r™   r&   r'   Ú
freq_countÚfreq_handlesr+   Úfreq_handleÚ
freq_propss
   &         r   Ú_get_zes_frequency_handlerÍ  ™  sÏ  € ô ‹O€Eä˜v°Ô5€FÜ˜VÔ$ä# FÕ+€DØ×ÑÒ(Ø×$Ñ$Ð$à×&Ñ&€MØ×$Ñ$€Lô ˜!“€JÜØ×+Ñ+¨M¼5ÀÓ;LÈdÓSØ>ôð ×Ñ˜1ÔÜÐJÓKÐKØ×+Ñ+¨j×.>Ñ.>Ö>ÓA€LÜØ×+Ñ+Øœ5 Ó,¨ló	
ð 	@ô	ô Ó˜iÔ'Ø'¨�?ÐØ 0ÔØÐàÐÛ#ˆØ×0Ñ0Ó2ˆ
Ø ×CÑCˆ
ÔÜØ×+Ñ+¨K¼¸zÓ9JÓKØ?ô	
ð �?‰?˜e×7Ñ7Ô7ÙØÒ#Ø×%×%Ð%¨*×*@Ñ*@ÀLÔ*PØ#.Ð Ùñ +QÑ%ð ×)×)Ò)Ø#.Ð Ùñ! $ð$ ÒÜÐMÓNÐNØ,ÔØÐr   c               ó    € V ^8„  d   QhRRRR/# r¹  r   )r:   s   "r   r;   r;   ß  s   € ÷ ñ �vð ¨ñ r   c                óÌ   € \        V 4      p^ RIpVP                  4       pVP                  V\	        V4      4      pWBP
                  8w  d   \        RV R24      hVP                  # )z×Return the GPU clock rate in MHz.

Args:
    device (torch.device, str or int, optional): selected device. Uses the
        current device, given by :func:`~torch.xpu.current_device`,
        if ``None`` (default).
Nz/Can't get Level Zero Sysman GPU clock rate (rc=r¥  )rÍ  rr   Úzes_freq_state_tÚzesFrequencyGetStater   rn   rÙ   Úactual)rD   r+   rr   Ú
freq_staterh   s   &    r   Ú
clock_raterÔ  ß  sf   € ô 1°Ó8Ðãà×'Ñ'Ó)€JØ	×	#Ñ	#Ð$4´e¸JÓ6GÓ	H€BØ	×$Ñ$Ô$ÜÐLÈRÈDÐPRÐSÓTÐTØ×ÑÐr   c               ó    € V ^8„  d   QhRRRR/# r©  r   )r:   s   "r   r;   r;   ò  s   € ÷ Kñ K &ð K°Hñ Kr   c           	     óÒ  € \        4       p\        V RR7      p \        V 4       \        V ,          pVP                  e   VP                  # VP
                  pVP                  p\        ^ 4      p\        VP                  V\        V4      R4      R4       VP                  ^ 8X  d   \        R4      hVP                  VP                  ,          ! 4       p\        VP                  V\        V4      V4      R4       \        4       R	8  d   V^ ,          pWrn        V# RpV EF2  pVP                  4       p	VP                   V	n        VP%                  4       p
VP&                  V
n        \)        \+        V
4      \,        4      V	n        \        VP1                  V\        V	4      4      R4       V
P2                  VP4                  VP6                  39  d   K²  VeI   V	P8                  '       d5   V	P:                  V8X  d"   TpV
P2                  VP4                  8X  d    M?Kú  Kü  Kþ  V	P8                  '       d   EK  TpV
P2                  VP4                  8X  g   EK3   M	  Vf   \        R4      hWrn        V# )
a°  Return the Level Zero Sysman GPU power domain handle for the specified device.

The result is cached in ``_ZesDeviceInfo.power_handle`` so that
repeated calls skip domain enumeration.  ``_cached_zes_device_infos``
is lazily populated on the first call.

Args:
    device (torch.device, str or int, optional): target device. Uses the
        current device, given by :func:`~torch.xpu.current_device`,
        if ``None`` (default).
Tr  Nz0Can't get Level Zero Sysman power domains count.z)No Level Zero Sysman power domains found.z1Can't get Level Zero Sysman power domain handles.z-Can't get Level Zero Sysman power properties.z,No Level Zero Sysman GPU power handle found.rÁ  )r–  r   r§  r5   r,   r&   r'   r   r¢  ÚzesDeviceEnumPowerDomainsr   r{   rÙ   Úzes_pwr_handle_trž  Úzes_power_properties_tÚ#ZES_STRUCTURE_TYPE_POWER_PROPERTIESrƒ   Úzes_power_ext_properties_tÚ'ZES_STRUCTURE_TYPE_POWER_EXT_PROPERTIESr   r   r   r†   ÚzesPowerGetPropertiesÚdomainÚZES_POWER_DOMAIN_CARDÚZES_POWER_DOMAIN_PACKAGEr±  r²  )rD   rr   r™   r&   r'   Úpower_countÚpower_handlesr,   Ú
pwr_handleÚ	pwr_propsÚext_pwr_propss   &          r   Ú_get_zes_power_handleræ  ò  s<  € ô ‹O€Eä˜v°Ô5€FÜ˜VÔ$ä# FÕ+€DØ×ÑÒ$Ø× Ñ Ð à×&Ñ&€MØ×$Ñ$€Lô ˜1“+€KÜØ×'Ñ'¨´u¸[Ó7IÈ4ÓPØ:ôð ×Ñ˜AÔÜÐFÓGÐGØ×+Ñ+¨k×.?Ñ.?Ö?ÓB€MÜØ×'Ñ'Øœ5 Ó-¨}ó	
ð 	<ô	ô Ó˜iÔ'Ø$ QÕ'ˆØ(ÔØÐà€LÜ#ˆ
Ø×0Ñ0Ó2ˆ	Ø×CÑCˆ	ŒØ×8Ñ8Ó:ˆØ#×KÑKˆÔÜœw }Ó5´xÓ@ˆ	ŒÜØ×'Ñ'¨
´E¸)Ó4DÓEØ;ô	
ð ×ÑØ×'Ñ'Ø×*Ñ*ð(
ô 
ñ ØÒ#Ø×$×$Ð$¨×)>Ñ)>À,Ô)NØ)�Ø ×'Ñ'¨5×+FÑ+FÔFÙñ Gñ *OÑ$ð
 ×(×(Ó(Ø)�Ø ×'Ñ'¨5×+FÑ+F×FÙñ1 $ð4 ÒÜÐIÓJÐJØ$ÔØÐr   c               ó    € V ^8„  d   QhRRRR/# r¹  r   )r:   s   "r   r;   r;   @  s   € ÷ ,<ñ ,<�vð ,<¨ñ ,<r   c                ó  € \        V 4      p^ RIpVP                  4       pVP                  V\	        V4      4      pWBP
                  8X  d   \        R4      hWBP                  8w  d   \        RV R24      h^ RIpVP                  \        R,          4       VP                  4       p\        VP                  V\	        V4      4      R4       VP                  VP                  ,
          pVP                  VP                  ,
          V,          # )a  Return the GPU card power draw in watts.

The value is computed by dividing the energy delta by the time delta between
two energy-counter reads separated by a 100ms sampling interval.

Args:
    device (torch.device, str or int, optional): selected device. Uses the
        current device, given by :func:`~torch.xpu.current_device`,
        if ``None`` (default).

.. note:: This function blocks for approximately 100ms per call due to the
    sampling interval required to compute an accurate power reading.

.. note:: This API may require elevated privileges (e.g. ``sudo``) to access GPU power information.

.. note:: On Intel Xe2 and newer GPUs, card-level power is reported directly. On older GPUs,
    package-level power is used as a fallback and may not reflect the full card power draw.
Nz[GPU power draw querying is not available. Try running with elevated privileges (e.g. sudo).z/Can't get Level Zero Sysman GPU power draw (rc=r¥  ç     @�@z5Can't get Level Zero Sysman GPU power energy counter.)ræ  rr   Úzes_power_energy_counter_tÚzesPowerGetEnergyCounterr   r¼  rÙ   rn   ÚtimeÚsleepÚ_zes_sample_interval_msr¢  Ú	timestampÚenergy)rD   r,   rr   Úcounter_startrh   rì  Úcounter_endÚdts   &       r   Ú
power_drawrô  @  sí   € ô& )¨Ó0€Lãà×4Ñ4Ó6€MØ	×	'Ñ	'¨´e¸MÓ6JÓ	K€BØ	×0Ñ0Ô0ÜØió
ð 	
ð 
×$Ñ$Ô$ÜÐLÈRÈDÐPRÐSÓTÐTãà‡J�JÔ&¨Õ/Ô0à×2Ñ2Ó4€KÜØ×&Ñ& |´U¸;Ó5GÓHØ?ôð 
×	Ñ	 ×!8Ñ!8Õ	8€BØ×Ñ ×!5Ñ!5Õ5¸Õ;Ð;r   c               ó    € V ^8„  d   QhRRRR/# r©  r   )r:   s   "r   r;   r;   o  s   € ÷ Bñ B 6ð B°Xñ Br   c           	     ó‚  € \        4       p\        V RR7      p \        V 4       \        V ,          pVP                  e   VP                  # VP
                  pVP                  p\        ^ 4      p\        VP                  V\        V4      R4      R4       VP                  ^ 8X  d   \        R4      hVP                  VP                  ,          ! 4       p\        VP                  V\        V4      V4      R4       RpV F«  pVP                  4       p	VP                  V	n        \        VP#                  V\        V	4      4      R4       V	P$                  VP&                  8w  d   Kf  Ve,   V	P(                  '       d   V	P*                  V8X  d   Tp MK“  K•  V	P(                  '       d   K©  Tp M	  Vf   \        R4      hWrn        V# )	a°  Return the Level Zero Sysman GPU engine group handle for the specified device.

The result is cached in ``_ZesDeviceInfo.engine_handle`` so that
repeated calls skip group enumeration.  ``_cached_zes_device_infos``
is lazily populated on the first call.

Args:
    device (torch.device, str or int, optional): target device. Uses the
        current device, given by :func:`~torch.xpu.current_device`,
        if ``None`` (default).
Tr  Nz/Can't get Level Zero Sysman engine group count.z‰No Level Zero Sysman engine groups found. The GPU may not support engine monitoring, or try running with elevated privileges (e.g. sudo).z1Can't get Level Zero Sysman engine group handles.z.Can't get Level Zero Sysman engine properties.z-No Level Zero Sysman GPU engine handle found.)r–  r   r§  r5   r-   r&   r'   r   r¢  ÚzesDeviceEnumEngineGroupsr   r{   rÙ   Úzes_engine_handle_tÚzes_engine_properties_tÚ$ZES_STRUCTURE_TYPE_ENGINE_PROPERTIESrƒ   ÚzesEngineGetPropertiesrù   ÚZES_ENGINE_GROUP_ALLr±  r²  )
rD   rr   r™   r&   r'   Úengine_countÚengine_handlesr-   Ú
eng_handleÚ	eng_propss
   &         r   Ú_get_zes_engine_handler  o  s²  € ô ‹O€Eä˜v°Ô5€FÜ˜VÔ$ä# FÕ+€DØ×ÑÒ%Ø×!Ñ!Ð!à×&Ñ&€MØ×$Ñ$€Lô ˜A“;€LÜØ×'Ñ'¨´u¸\Ó7JÈDÓQØ9ôð ×Ñ˜QÔÜð Xó
ð 	
ð ×/Ñ/°,×2DÑ2DÖDÓG€NÜØ×'Ñ'Øœ5 Ó.°ó	
ð 	<ô	ð €MÛ$ˆ
Ø×1Ñ1Ó3ˆ	Ø×DÑDˆ	ŒÜØ×(Ñ(¨´U¸9Ó5EÓFØ<ô	
ð �>‰>˜U×7Ñ7Ô7ÙØÒ#Ø×$×$Ð$¨×)>Ñ)>À,Ô)NØ *�Ùñ *OÑ$ð ×(×(Ò(Ø *�Ùñ! %ð$ ÒÜÐJÓKÐKØ&ÔØÐr   c               ó    € V ^8„  d   QhRRRR/# r¹  r   )r:   s   "r   r;   r;   ´  s   € ÷ *Fñ *F˜ð *F¨%ñ *Fr   c                ó$  € \        V 4      p^ RIpVP                  4       pVP                  V\	        V4      4      pWBP
                  8X  d   \        R4      hWBP                  8w  d   \        RV R24      h^ RIpVP                  \        R,          4       VP                  4       p\        VP                  V\	        V4      4      R4       VP                  VP                  ,
          pVP                  VP                  ,
          V,          ^d,          # )a  Return the GPU engine utilization as a percentage.

The value is computed by dividing the active-time delta by the time delta
between two engine-activity reads separated by a 100ms sampling interval.

Args:
    device (torch.device, str or int, optional): selected device. Uses the
        current device, given by :func:`~torch.xpu.current_device`,
        if ``None`` (default).

.. note:: This function blocks for approximately 100ms per call due to the
    sampling interval required to compute an accurate utilization reading.

.. note:: This API may require elevated privileges (e.g. ``sudo``) to access GPU utilization information.
Nz\GPU utilization querying is not available. Try running with elevated privileges (e.g. sudo).z4Can't get Level Zero Sysman GPU engine activity (rc=r¥  ré  z0Can't get Level Zero Sysman GPU engine activity.)r  rr   Úzes_engine_stats_tÚzesEngineGetActivityr   r¼  rÙ   rn   rì  rí  rî  r¢  rï  Ú
activeTime)rD   r-   rr   Ústats_startrh   rì  Ú	stats_endró  s   &       r   Úutilizationr	  ´  s÷   € ô  +¨6Ó2€Mãà×*Ñ*Ó,€KØ	×	#Ñ	# M´5¸Ó3EÓ	F€BØ	×0Ñ0Ô0ÜØjó
ð 	
ð 
×$Ñ$Ô$ÜØBÀ2À$ÀbÐIó
ð 	
ó à‡J�JÔ&¨Õ/Ô0à×(Ñ(Ó*€IÜØ×"Ñ" =´%¸	Ó2BÓCØ:ôð
 
×	Ñ	˜{×4Ñ4Õ	4€BØ× Ñ  ;×#9Ñ#9Õ9¸RÕ?À#ÕEÐEr   c               ó    € V ^8„  d   QhRRRR/# r©  r   )r:   s   "r   r;   r;   á  s   € ÷ >ñ > 6ð >°Xñ >r   c           	     ó‚  € \        4       p\        V RR7      p \        V 4       \        V ,          pVP                  e   VP                  # VP
                  pVP                  p\        ^ 4      p\        VP                  V\        V4      R4      R4       VP                  ^ 8X  d   \        R4      hVP                  VP                  ,          ! 4       p\        VP                  V\        V4      V4      R4       RpV F«  pVP                  4       p	VP                  V	n        \        VP#                  V\        V	4      4      R4       V	P$                  VP&                  8w  d   Kf  Ve,   V	P(                  '       d   V	P*                  V8X  d   Tp MK“  K•  V	P(                  '       d   K©  Tp M	  Vf   \        R4      hWrn        V# )	a²  Return the Level Zero Sysman GPU memory module handle for the specified device.

The result is cached in ``_ZesDeviceInfo.memory_handle`` so that
repeated calls skip module enumeration.  ``_cached_zes_device_infos``
is lazily populated on the first call.

Args:
    device (torch.device, str or int, optional): target device. Uses the
        current device, given by :func:`~torch.xpu.current_device`,
        if ``None`` (default).
Tr  Nz0Can't get Level Zero Sysman memory module count.z*No Level Zero Sysman memory modules found.z2Can't get Level Zero Sysman memory module handles.ú.Can't get Level Zero Sysman memory properties.z-No Level Zero Sysman GPU memory handle found.)r–  r   r§  r5   r.   r&   r'   r   r¢  ÚzesDeviceEnumMemoryModulesr   r{   rÙ   Úzes_mem_handle_tÚzes_mem_properties_tÚ!ZES_STRUCTURE_TYPE_MEM_PROPERTIESrƒ   ÚzesMemoryGetPropertiesÚlocationÚZES_MEM_LOC_DEVICEr±  r²  )
rD   rr   r™   r&   r'   Ú	mem_countÚmemory_handlesr.   Ú
mem_handleÚ	mem_propss
   &         r   Ú_zes_get_memory_handler  á  s§  € ô ‹O€Eä˜v°Ô5€FÜ˜VÔ$ä# FÕ+€DØ×ÑÒ%Ø×!Ñ!Ð!à×&Ñ&€MØ×$Ñ$€Lô ˜“€IÜØ×(Ñ(¨¼¸iÓ8HÈ$ÓOØ:ôð ‡�˜!ÔÜÐGÓHÐHØ×,Ñ,¨y¯©Ö>ÓA€NÜØ×(Ñ(Øœ5 Ó+¨^ó	
ð 	=ô	ð €MÛ$ˆ
Ø×.Ñ.Ó0ˆ	Ø×AÑAˆ	ŒÜØ×(Ñ(¨´U¸9Ó5EÓFØ<ô	
ð ×Ñ ×!9Ñ!9Ô9ÙØÒ#Ø×$×$Ð$¨×)>Ñ)>À,Ô)NØ *�Ùñ *OÑ$ð ×(×(Ò(Ø *�Ùñ! %ð$ ÒÜÐJÓKÐKØ&ÔØÐr   c               ó    € V ^8„  d   QhRRRR/# r¹  r   )r:   s   "r   r;   r;   "  s   € ÷ .Vñ .V˜ð .V¨5ñ .Vr   c                óž  € \        V 4      p^ RIpVP                  4       pVP                  V\	        V4      4      pWBP
                  8X  d   \        R4      hWBP                  8w  d   \        RV R24      h^ RIpVP                  \        R,          4       VP                  4       p\        VP                  V\	        V4      4      R4       VP                  VP                  ,
          pVP                  VP                  ,
          pVP                  VP                  ,
          p	RW‰,           ,          VP                  V,          ,          ^d,          # )aÑ  Return the GPU memory bandwidth usage as a percentage.

The value is computed by dividing the byte-transfer delta by the time delta
between two bandwidth-counter reads separated by a 100ms sampling interval,
then normalizing by the peak bandwidth reported by the hardware.

Args:
    device (torch.device, str or int, optional): selected device. Uses the
        current device, given by :func:`~torch.xpu.current_device`,
        if ``None`` (default).

.. note:: This function blocks for approximately 100ms per call due to the
    sampling interval required to compute an accurate bandwidth reading.

.. note:: This API may require elevated privileges (e.g. ``sudo``) to access GPU memory bandwidth usage information.
NzgGPU memory bandwidth usage querying is not available. Try running with elevated privileges (e.g. sudo).z5Can't get Level Zero Sysman GPU memory bandwidth (rc=r¥  ré  z1Can't get Level Zero Sysman GPU memory bandwidth.g    €„.A)r  rr   Úzes_mem_bandwidth_tÚzesMemoryGetBandwidthr   r¼  rÙ   rn   rì  rí  rî  r¢  rï  ÚreadCounterÚwriteCounterÚmaxBandwidth)
rD   r.   rr   Úbandwidth_startrh   rì  Úbandwidth_endró  Ú
read_deltaÚwrite_deltas
   &         r   Úmemory_usager$  "  s&  € ô" +¨6Ó2€Mãà×/Ñ/Ó1€OØ	×	$Ñ	$ ]´E¸/Ó4JÓ	K€BØ	×0Ñ0Ô0ÜØuó
ð 	
ð 
×$Ñ$Ô$ÜØCÀBÀ4ÀrÐJó
ð 	
ó à‡J�JÔ&¨Õ/Ô0à×-Ñ-Ó/€MÜØ×#Ñ# M´5¸Ó3GÓHØ;ôð 
×	 Ñ	  ?×#<Ñ#<Õ	<€Bà×*Ñ*¨_×-HÑ-HÕH€JØ×,Ñ,¨×/KÑ/KÕK€Kà�*Õ*Õ+¨}×/IÑ/IÈBÕ/NÕOÐRUÕUÐUr   c               ó    € V ^8„  d   QhRRRR/# )r8   rD   r   r9   rE   r   )r:   s   "r   r;   r;   S  s   € ÷ "ñ "˜vð "°ñ "r   c                óì  € \        V 4      p^ RIpVP                  4       pVP                  V\	        V4      4      pWBP
                  8X  d   \        R4      hWBP                  8w  d   \        RV R24      hVP                  4       pVP                  Vn
        \        VP                  V\	        V4      4      R4       VP                  ^ 8w  d   VP                  MVP                  pWcP                  ,
          # )a^  Return the current GPU used global (device) memory in bytes.

Args:
    device (torch.device, str or int, optional): selected device. Uses the
        current device, given by :func:`~torch.xpu.current_device`,
        if ``None`` (default).

.. note:: This API may require elevated privileges (e.g. ``sudo``) to access GPU memory usage information.
Nz]GPU memory usage querying is not available. Try running with elevated privileges (e.g. sudo).z1Can't get Level Zero Sysman GPU memory state (rc=r¥  r  )r  rr   Úzes_mem_state_tÚzesMemoryGetStater   r¼  rÙ   rn   r  r  rƒ   r¢  r  ÚphysicalSizeÚsizeÚfree)rD   r.   rr   Ú	mem_staterh   r  Útotals   &      r   Údevice_memory_usedr.  S  sÞ   € ô +¨6Ó2€Mãà×%Ñ%Ó'€IØ	×	 Ñ	  ´°iÓ0@Ó	A€BØ	×0Ñ0Ô0ÜØkó
ð 	
ð 
×$Ñ$Ô$ÜÐNÈrÈdÐRTÐUÓVÐVØ×*Ñ*Ó,€IØ×=Ñ=€I„OÜØ×$Ñ$ ]´E¸)Ó4DÓEØ8ôð '0×&<Ñ&<ÀÔ&AˆI×"Ò"ÀyÇ~Á~€EØ—>‘>Õ!Ð!r   )Úchange_current_allocatorÚempty_cacheÚget_per_process_memory_fractionÚlist_gpu_processesÚ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_allrÁ   rÀ   Úset_rng_stateÚset_rng_state_allÚ_POOL_HANDLEr   r   r@  r   r@  r/  rÔ  r6  rL  rŒ   r.  r0  rw  r/  r"  r²   r  r1  rA  rB  ri  r   r   rÏ   rC  r­   r´   r   r»   r¸   r2  r   rD  rE  r3  r4  r5  r6  r7  r8  r9  r:  r$  r;  rô  r?  r<  r=  rÁ   rÀ   r  r>  rF  rG  rO  rF  Ústreamsrm  r¾  r	  r   r   )TrÓ   )r±   )”Ú__conditional_annotations__r  Ú
__future__r   ÚdataclassesrU   Ú	threadingrÆ   ro   Úctypesr   r   r   r   r   r   Ú	functoolsr	   Útypingr
   r   r   r=   Útorch._CÚtorch._utilsr   r   Úcollections.abcr   Útorch.typesr   Ú_utilsr   Úgraphsr   r   r   r   r   rI  r   r   r¥   Úlocalr§   ÚLockrÂ   r   r3   r,  r>   rº   rÄ   r!   r#   Ú	dataclassr%   r5   rî  r@   rA   Ú_xpu_exchangeDevicerK   Ú_xpu_maybeExchangeDevicerO   rb   rš   r�   r¡   rŒ   r­   r´   r¸   r»   rË   rÏ   rÎ   rä   rD   r  r  r"  r/  r²   r6  r;  r@  rB  rF  r^  rO  rL  ri  rm  rr  rw  r  r‚  rŽ  r’  r–  rž  r¢  r§  r·  r¾  rÍ  rÔ  ræ  rô  r  r	  r  r$  r.  Úmemoryr/  r0  r1  r2  r3  r4  r5  r6  r7  r8  r9  r:  r;  r<  r=  r>  r?  r@  ÚrandomrA  rB  rC  rD  rE  rÁ   rÀ   rF  rG  r'  rE   rH  Ú__all__)rJ  s   @r   Ú<module>r_     sÆ  øðôõ #ã Û 	Û Û Û ß E× EÝ ß .Ñ .ã Û ß 6÷ Ý(å"å %÷õ ÷ #ð €Ø‡‚Ó€Ø —~’~Ó'Ð ð ð ð ó ñ ˜%Ÿ(™(Ð$6¹ÓF€Ù%Ó'Ð Ø02Ð Ð-Ó 2Ø#'Ð �jÓ 'ð ×Ñ÷*ð *ó ð*ð 24Ð Ð.Ó 3àÐ õñ
 ‡>‚>Ø Ÿ8™8×8Ñ8ÐØ—x‘x×3Ñ3ÐØ"ŸX™X×>Ñ>Ññ 'Ð'=Ó>ÐõNõN÷"õJv õr0õ
2õõ2÷õUò2õ
Kõõ%÷P
ñ 
÷ñ ô(�ô õ
(÷.ñ ˆ4ƒöó ð÷0+*õ\%õ
õ;÷ (3ñ (3õV!õõ÷&÷$÷2
-õ	 õõ=õ	-÷÷&*ò õ8õ/õ

÷@÷F÷2C÷L÷&K÷\,<÷^B÷J*F÷Z>÷B.V÷b"÷F÷ ÷ ÷ ÷ ÷(
÷ 
õ 
ñ �~ u¨S°#¨X¥Ó7€ðAØðAàðAð ðAð ð	Að
 ðAð ðAð ðAð ðAð ðAð ðAð ðAð ðAð ðAð ðAð ðAð  ð!Að" ð#Að$ ð%Að& ð'Að( ð)Að* ð+Að, &ð-Að. ð/Að0 ð1Að2 ð3Að4 ð5Að6 ð7Að8 ð9Að: ð;Að< ð=Að> ð?Að@ "ðAAðB ðCAðD ðEAðF ðGAðH ðIAðJ ðKAðL ðMAðN ðOAðP ðQAðR ðSAðT ðUAðV ðWAðX ðYAðZ ð[Að\ "ð]Að^ ð_Að` ðaAðb ðcAðd ðeAðf %ðgAðh ðiAðj ðkAðl ðmAðn ðoAðp &ðqAðr ðsAðt ðuAðv ðwAðx ðyAðz ð{Að| ð}Að~ ðAð@ ðAA‚r   