+
    åûjZv  ã                   ó¢  a € R% t-0 t R t^ RIt^ RIt^ RIHt ^ RIHtHt ^ RI	H
t
 ^ RIHtHt ^ RIt^ RIHt ] ^ k ]P"                  P%                  4       '       d   ^ RIHt MRt/ t] ^k / t] ^k  ! R R	4      t ! R
 R4      t ! R R]4      t] ^k ]P6                  P%                  4       '       d   ^ RIHt MRt ! R R]4      t] ^k ]P>                  P%                  4       '       d   ^ RIH t! MRt! ! R R]4      t"]
 ! R R4      4       t# ! R R]4      t$ ! R R]4      t% ! R R]4      t&/ t'] ^k Rs(R R lt)R R  lt*R! R" lt+R# R$ lt,R# )&a  
Device abstraction layer for TorchDynamo and Inductor backends.

This module provides a unified interface for different hardware backends (CUDA, XPU,
CPU, MPS, MTIA) through a common device interface. Key components include:

- DeviceInterface: Base class defining the common API for all device types
- Device-specific implementations: CudaInterface, XpuInterface, CpuInterface, MpsInterface, MtiaInterface
- Device registration system for managing available backends
- Worker APIs for multi-processing scenarios
- Stream and event management across different devices
- Device property caching for worker processes

The abstraction layer enables device-agnostic code in TorchDynamo while allowing
specialized implementations for each hardware backend's unique features.
N©Ú
namedtuple)ÚCallableÚIterable)Ú	dataclass©ÚAnyÚLiteral©Úhas_torch_tpu)Ú_cuda_getCurrentRawStreamc                   ó8  a € ] tR t^(t o Rt]V 3R lR l4       t ! R R4      t ! R R4      t ! R R	4      t	 ! R
 R4      t
]V 3R lR l4       t]V 3R lR l4       t]V 3R lR l4       t]V 3R lR l4       t]V 3R lR l4       t]V 3R lR l4       t]V 3R lR l4       t]V 3R lR l4       t]V 3R lR l4       t]V 3R lR l4       t]V 3R  lR! l4       t]R<V 3R# lR$ ll4       t]R<V 3R% lR& ll4       t]V 3R' lR( l4       t]R<V 3R) lR* ll4       t]R=V 3R+ lR, ll4       t]R=V 3R- lR. ll4       t]R<V 3R/ lR0 ll4       t]R<V 3R1 lR2 ll4       t]V 3R3 lR4 l4       t]V 3R5 lR6 l4       t ]R<V 3R7 lR8 ll4       t!]R<V 3R9 lR: ll4       t"R;t#V t$R"# )>ÚDeviceInterfacez’
This is a simple device runtime interface for Inductor. It enables custom
backends to be integrated with Inductor in a device-agnostic semantic.
c                óÔ   <€ V ^8„  d   QhRS[ RS[ RS[S[S[,          S[S[,          S[S[,          S[S[,          S[S[,          S[S[,          S[S[,          3,          R,          /# )é   Úaot_modeÚcompile_onlyÚreturnN)ÚboolÚtupleÚlistÚstr)ÚformatÚ__classdict__s   "€ÚZC:\Ai_Coding\apps\studio\ComfyUI\.venv\Lib\site-packages\torch\_dynamo\device_interface.pyÚ__annotate__ÚDeviceInterface.__annotate__/   sl   ø€ ÷ ñ ÙðÙ&*ðñ 	Ù‘�IÙ‘�IÙ‘�IÙ‘�IÙ‘�IÙ‘�IÙ‘�Iðõ	
ð õ		ñó    c                ó   € R# )zôReturn device-specific C++ build options, if the backend provides them.

Out-of-tree backends may override this to return
``(definitions, include_dirs, cflags, ldflags, library_dirs,
libraries, passthrough_args)`` for Inductor C++ compilation.
N© )r   r   s   &&r   Úget_cpp_device_optionsÚ&DeviceInterface.get_cpp_device_options.   s   € ñ* r   c                   ó2   a € ] tR t^Et o V 3R lR ltRtV tR# )ÚDeviceInterface.devicec                óN   <€ V ^8„  d   QhRS[ P                  P                  RS[/# ©r   Údevicer   ©ÚtorchÚtypesÚDevicer   )r   r   s   "€r   r   Ú#DeviceInterface.device.__annotate__F   s%   ø€ ÷ 	&ñ 	&¡§¡×!3Ñ!3ð 	&¹ñ 	&r   c                ó   € \         h©N©ÚNotImplementedError©Úclsr&   s   &&r   Ú__new__ÚDeviceInterface.device.__new__F   s   € Ü%Ð%r   r   N©Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__r2   Ú__static_attributes__Ú__classdictcell__©r   s   @r   r&   r#   E   s   ø‡ € ÷	&ö 	&r   r&   c                   ó2   a € ] tR t^It o V 3R lR ltRtV tR# )ÚDeviceInterface.Eventc                ó,   <€ V ^8„  d   QhRS[ RS[ RS[ /# ©r   ÚargsÚkwargsr   ©r   )r   r   s   "€r   r   Ú"DeviceInterface.Event.__annotate__J   ó"   ø€ ÷ 	ñ 	¡ð 	©sð 	±sñ 	r   c                ó   € \        R 4      h)zYEvent should be inherited from torch.Event, otherwise, it couldn't be captured by dynamo.r.   ©r1   r@   rA   s   &*,r   r2   ÚDeviceInterface.Event.__new__J   s   € Ü%Økóð r   r   Nr4   r;   s   @r   ÚEventr=   I   ó   ø‡ € ÷	ö 	r   rH   c                   ó2   a € ] tR t^Ot o V 3R lR ltRtV tR# )ÚDeviceInterface.Streamc                ó,   <€ V ^8„  d   QhRS[ RS[ RS[ /# r?   rB   )r   r   s   "€r   r   Ú#DeviceInterface.Stream.__annotate__P   rD   r   c                ó   € \        R 4      h)z[Stream should be inherited from torch.Stream, otherwise, it couldn't be captured by dynamo.r.   rF   s   &*,r   r2   ÚDeviceInterface.Stream.__new__P   s   € Ü%Ømóð r   r   Nr4   r;   s   @r   ÚStreamrK   O   rI   r   rP   c                   ó|   a € ] tR t^Ut o Rt]V 3R lR l4       t]V 3R lR l4       t]R
V 3R lR ll4       tR	t	V t
R# )ÚDeviceInterface.Workerzò
Worker API to query device properties that will work in multi processing
workers that cannot use the GPU APIs (due to processing fork() and
initialization time issues). Properties are recorded in the main process
before we fork the workers.
c                ó$   <€ V ^8„  d   QhRS[ RR/# ©r   r&   r   N©Úint)r   r   s   "€r   r   Ú#DeviceInterface.Worker.__annotate__^   s   ø€ ÷ 	&ñ 	&™sð 	& tñ 	&r   c                ó   € \         hr-   r.   ©r&   s   &r   Ú
set_deviceÚ!DeviceInterface.Worker.set_device]   ó   € ä%Ð%r   c                ó    <€ V ^8„  d   QhRS[ /# ©r   r   rU   )r   r   s   "€r   r   rW   b   s   ø€ ÷ 	&ñ 	&¡ñ 	&r   c                 ó   € \         hr-   r.   r   r   r   Úcurrent_deviceÚ%DeviceInterface.Worker.current_devicea   r\   r   Nc                óN   <€ V ^8„  d   QhRS[ P                  P                  RS[/# r%   r'   )r   r   s   "€r   r   rW   f   s%   ø€ ÷ 	&ñ 	&©%¯+©+×*<Ñ*<ð 	&Éñ 	&r   c                ó   € \         hr-   r.   rY   s   &r   Úget_device_propertiesÚ,DeviceInterface.Worker.get_device_propertiese   r\   r   r   r-   )r5   r6   r7   r8   Ú__doc__ÚstaticmethodrZ   r`   rd   r9   r:   r;   s   @r   ÚWorkerrR   U   sK   ø‡ € ñ	ð 
÷	&ó 
ð	&ð 
÷	&ó 
ð	&ð 
÷	&ñ 	&ó 
ö	&r   rh   c                ó    <€ V ^8„  d   QhRS[ /# r^   rU   )r   r   s   "€r   r   r   j   s   ø€ ÷ "ñ "™Cñ "r   c                 ó   € \         hr-   r.   r   r   r   r`   ÚDeviceInterface.current_devicei   ó   € ä!Ð!r   c                óL   <€ V ^8„  d   QhRS[ P                  P                  RR/# rT   ©r(   r)   r*   )r   r   s   "€r   r   r   n   s%   ø€ ÷ "ñ "™5Ÿ;™;×-Ñ-ð "°$ñ "r   c                ó   € \         hr-   r.   rY   s   &r   rZ   ÚDeviceInterface.set_devicem   rl   r   c                ó&   <€ V ^8„  d   QhRS[ RS[ /# r%   rU   )r   r   s   "€r   r   r   r   s   ø€ ÷ "ñ "¡cð "©cñ "r   c                ó   € \         hr-   r.   rY   s   &r   Úmaybe_exchange_deviceÚ%DeviceInterface.maybe_exchange_deviceq   rl   r   c                ó&   <€ V ^8„  d   QhRS[ RS[ /# r%   rU   )r   r   s   "€r   r   r   v   s   ø€ ÷ "ñ "¡ð "©ñ "r   c                ó   € \         hr-   r.   rY   s   &r   Úexchange_deviceÚDeviceInterface.exchange_deviceu   rl   r   c                ó    <€ V ^8„  d   QhRS[ /# r^   rU   )r   r   s   "€r   r   r   z   s   ø€ ÷ "ñ "™#ñ "r   c                 ó   € \         hr-   r.   r   r   r   Údevice_countÚDeviceInterface.device_county   rl   r   c                ó    <€ V ^8„  d   QhRS[ /# r^   ©r   )r   r   s   "€r   r   r   ~   s   ø€ ÷ "ñ "™$ñ "r   c                 ó   € \         hr-   r.   r   r   r   Úis_availableÚDeviceInterface.is_available}   rl   r   c                ó:   <€ V ^8„  d   QhRS[ P                  RS[/# )r   Ústreamr   )r(   rP   r   )r   r   s   "€r   r   r   ‚   s   ø€ ÷ "ñ "‘u—|‘|ð "©ñ "r   c                ó   € \         hr-   r.   ©rƒ   s   &r   rƒ   ÚDeviceInterface.stream�   rl   r   c                ó4   <€ V ^8„  d   QhRS[ P                  /# r^   ©r(   rP   )r   r   s   "€r   r   r   †   s   ø€ ÷ "ñ "™EŸL™Lñ "r   c                 ó   € \         hr-   r.   r   r   r   Úcurrent_streamÚDeviceInterface.current_stream…   rl   r   c                ó8   <€ V ^8„  d   QhRS[ P                  RR/# ©r   rƒ   r   Nrˆ   )r   r   s   "€r   r   r   Š   s   ø€ ÷ "ñ "™5Ÿ<™<ð "¨Dñ "r   c                ó   € \         hr-   r.   r…   s   &r   Ú
set_streamÚDeviceInterface.set_stream‰   rl   r   c                ó0   <€ V ^8„  d   QhRS[ RS[ RS[ RR/# )r   Ú	stream_idÚdevice_indexÚdevice_typer   NrU   )r   r   s   "€r   r   r   Ž   s*   ø€ ÷ "ñ "¡Sð "¹ð "É#ð "ÐRVñ "r   c                ó   € \         hr-   r.   )r’   r“   r”   s   &&&r   Ú_set_stream_by_idÚ!DeviceInterface._set_stream_by_id�   rl   r   c                ó&   <€ V ^8„  d   QhRS[ RS[ /# ©r   Ú
device_idxr   rU   )r   r   s   "€r   r   r   ’   s   ø€ ÷ "ñ "¡3ð "©3ñ "r   c                ó   € \         hr-   r.   ©rš   s   &r   Úget_raw_streamÚDeviceInterface.get_raw_stream‘   rl   r   Nc                óL   <€ V ^8„  d   QhRS[ P                  P                  RR/# rT   rn   )r   r   s   "€r   r   r   –   s%   ø€ ÷ "ñ "™EŸK™K×.Ñ.ð "¸$ñ "r   c                ó   € \         hr-   r.   rY   s   &r   ÚsynchronizeÚDeviceInterface.synchronize•   rl   r   c                óN   <€ V ^8„  d   QhRS[ P                  P                  RS[/# r%   r'   )r   r   s   "€r   r   r   š   s%   ø€ ÷ 8ñ 8©5¯;©;×+=Ñ+=ð 8Éñ 8r   c                ó8   € V P                   P                  V4      # r-   )rh   rd   r0   s   &&r   rd   Ú%DeviceInterface.get_device_properties™   s   € à�z‰z×/Ñ/°Ó7Ð7r   c                óD   <€ V ^8„  d   QhRS[ S[S[3,          R,          /# ©r   r   N)Údictr   Úobject)r   r   s   "€r   r   r   ž   s"   ø€ ÷ 
ñ 
¡d©3±¨;Õ&7¸$Õ&>ñ 
r   c                ó   € R# )aÒ  Return stable, JSON-serializable metadata for the code cache key.

Returning None opts out. An empty dict still contributes metadata.
Implementations should return only metadata that invalidates generated
or autotuned code when changed, without unnecessarily initializing hardware.
Only called when is_available() returns True. This hook is sampled through
the cached CacheBase.get_system() path, so interfaces must be registered
and available before its first use.
Nr   ©r1   s   &r   Úget_cache_system_infoÚ%DeviceInterface.get_cache_system_info�   s   € ñ r   c                óN   <€ V ^8„  d   QhRS[ P                  P                  RS[/# r%   r'   )r   r   s   "€r   r   r   «   s%   ø€ ÷ "ñ "¡u§{¡{×'9Ñ'9ð "ÁSñ "r   c                ó   € \         hr-   r.   rY   s   &r   Úget_compute_capabilityÚ&DeviceInterface.get_compute_capabilityª   rl   r   c                ó&   <€ V ^8„  d   QhRS[ RS[ /# ©r   Úincluding_emulationr   r~   )r   r   s   "€r   r   r   ¯   s   ø€ ÷ "ñ "©tð "Áñ "r   c                ó   € \         hr-   r.   ©r´   s   &r   Úis_bf16_supportedÚ!DeviceInterface.is_bf16_supported®   rl   r   c                ó@   <€ V ^8„  d   QhRS[ P                  RS[RS[/# ©r   Údtyper´   r   ©r(   r»   r   )r   r   s   "€r   r   r   ³   s.   ø€ ÷ Uñ UÙ—K‘KðUÙ6:ðUá	ñUr   c                óZ   € V\         P                  8g  ;'       g    V P                  V4      # r-   )r(   Úbfloat16r·   ©r1   r»   r´   s   &&&r   Úis_dtype_supportedÚ"DeviceInterface.is_dtype_supported²   s'   € ð œŸ™Ñ&×TÐT¨#×*?Ñ*?Ð@SÓ*TÐTr   c                óN   <€ V ^8„  d   QhRS[ P                  P                  RS[/# r%   ©r(   r)   r*   rV   )r   r   s   "€r   r   r   ¹   s%   ø€ ÷ "ñ "¡§¡×!3Ñ!3ð "¹sñ "r   c                ó   € \         hr-   r.   rY   s   &r   Úmemory_allocatedÚ DeviceInterface.memory_allocated¸   rl   r   c                óN   <€ V ^8„  d   QhRS[ P                  P                  RS[/# r%   ©r(   r)   r*   r   )r   r   s   "€r   r   r   ½   s%   ø€ ÷ ñ ¡%§+¡+×"4Ñ"4ð Áñ r   c                ó   € R# )zz
Returns True if the device has Triton support, False otherwise, even if
the appropriate Triton backend is not available.
Fr   rY   s   &r   Úis_triton_capableÚ!DeviceInterface.is_triton_capable¼   s   € ñ r   c                ó    <€ V ^8„  d   QhRS[ /# r^   r~   )r   r   s   "€r   r   r   Å   s   ø€ ÷ ñ ‘Dñ r   c                 ó   € R# )zÕ
Returns True if Inductor should treat this device as a GPU-class
accelerator (device guards, GPU codegen/fusion, cudagraph eligibility).
Defaults to False so unknown backends stay conservative until they opt in.
Fr   r   r   r   Úis_gpuÚDeviceInterface.is_gpuÄ   s   € ñ r   c                ó    <€ V ^8„  d   QhRS[ /# r^   r~   )r   r   s   "€r   r   r   Î   s   ø€ ÷ 8ñ 8¡ñ 8r   c                ó:   € V P                   \        P                   J# )aê  
True when a subclass provides its own Stream. The base Stream is a
raising sentinel, so compare against it rather than None.

Overriding the Stream slot is the contract for stream support: it is
what opts a GPU-class device into stream guards (device_need_guard),
so stream-capable backends must override it. The override must be a
real, instantiable torch.Stream subclass: a placeholder that raises on
construction is still reported as stream-capable here and fails later,
at guard time.
)rP   r   r«   s   &r   Úexposes_streamsÚDeviceInterface.exposes_streamsÍ   s   € ð �z‰z¤×!7Ñ!7Ð7Ð7r   c                óN   <€ V ^8„  d   QhRS[ P                  P                  RS[/# r%   rÃ   )r   r   s   "€r   r   r   Ý   s%   ø€ ÷ ñ ©u¯{©{×/AÑ/Að ÉSñ r   c                óz   € V P                  V4      p\        VRR4      pVf   \        V P                   R24      hV# )a)  Return the number of compute units, used for occupancy /
reduction heuristics / max-autotune heuristics.  Defaults to
reading the standard field ``multi_processor_count`` from device
properties; backends with a different property representation or
backend-specific fallback behavior must override.Úmulti_processor_countNz must override get_multi_processor_count because its device properties do not expose the standard field 'multi_processor_count')rd   ÚgetattrÚAttributeErrorr5   )r1   r&   ÚpropsÚmp_counts   &&  r   Úget_multi_processor_countÚ)DeviceInterface.get_multi_processor_countÜ   sP   € ð ×)Ñ)¨&Ó1ˆÜ˜5Ð"9¸4Ó@ˆØÒÜ Ø—<‘<�.ð !0ð 1óð ð
 ˆr   c                óL   <€ V ^8„  d   QhRS[ P                  P                  RR/# rT   rn   )r   r   s   "€r   r   r   î   s%   ø€ ÷ ñ ±·±×1CÑ1Cð Ètñ r   c                óN   € ^ RI Hp V P                  4       '       g	   V! R4      hR# )aò  
Raises a `TritonUnavailableError` with human-readable instructions if
the Triton backend for the given device (or the default device if
`device` is `None`) is not built. Implementations may raise a
different, more specific error when the device itself is not
Triton-capable (e.g. CUDA raises `GPUTooOldForTriton`), so callers
that only want an availability answer should check
`is_triton_capable()` first.

The caller should ensure the presence of the 'triton' package before
calling this method.
©ÚTritonUnavailableErrorz/This device is not capable of supporting TritonN)Útorch._dynamo.excrà   rÊ   )r1   r&   rà   s   && r   Úraise_if_triton_unavailableÚ+DeviceInterface.raise_if_triton_unavailableí   s+   € õ 	=à×$Ñ$×&Ò&Ù(ØAóð ñ 'r   r   r-   ©F)%r5   r6   r7   r8   rf   rg   r    r&   rH   rP   rh   r`   rZ   rs   rw   r{   r€   rƒ   rŠ   r�   r–   r�   r¡   Úclassmethodrd   r¬   r°   r·   rÀ   rÅ   rÊ   rÎ   rÒ   rÛ   râ   r9   r:   r;   s   @r   r   r   (   sB  ø‡ € ñð
 ÷ó ð÷,&ñ &÷ñ ÷ñ ÷&ñ &ð( ÷"ó ð"ð ÷"ó ð"ð ÷"ó ð"ð ÷"ó ð"ð ÷"ó ð"ð ÷"ó ð"ð ÷"ó ð"ð ÷"ó ð"ð ÷"ó ð"ð ÷"ó ð"ð ÷"ó ð"ð ÷"ñ "ó ð"ð ÷8ñ 8ó ð8ð ÷
ó ð
ð ÷"ñ "ó ð"ð ÷"ñ "ó ð"ð ÷Uñ Uó ðUð
 ÷"ñ "ó ð"ð ÷ñ ó ðð ÷ó ðð ÷8ó ð8ð ÷ñ ó ðð  ÷ñ ó ör   r   c                   óZ   a € ] tR tRt o RtV 3R lR ltV 3R lR ltV 3R lR ltR	tV t	R
# )ÚDeviceGuardi  aG  
This class provides a context manager for device switching. This is a stripped
down version of torch.{device_name}.device.

The context manager changes the current device to the given device index
on entering the context and restores the original device on exiting.
The device is switched using the provided device interface.
c                óH   <€ V ^8„  d   QhRS[ S[,          RS[R,          RR/# )r   Údevice_interfaceÚindexNr   )Útyper   rV   )r   r   s   "€r   r   ÚDeviceGuard.__annotate__  s.   ø€ ÷ ñ Ù $¡_Õ 5ðÙ>AÀD½jðà	ñr   c                ó,   € Wn         W n        RV n        R# )é   Néÿÿÿÿ©ré   ÚidxÚprev_idx)Úselfré   rê   s   &&&r   Ú__init__ÚDeviceGuard.__init__  s   € ð !1ÔØŒØˆŽr   c                ó   <€ V ^8„  d   QhRR/# r§   r   )r   r   s   "€r   r   rì     s   ø€ ÷ Lñ L˜4ñ Lr   c                óz   € V P                   e-   V P                  P                  V P                   4      V n        R # R # r-   )rñ   ré   rw   rò   )ró   s   &r   Ú	__enter__ÚDeviceGuard.__enter__  s-   € Ø�8‰8ÒØ ×1Ñ1×AÑAÀ$Ç(Á(ÓKˆDŽMñ  r   c          	      ó@   <€ V ^8„  d   QhRS[ RS[ RS[ RS[R,          /# )r   rë   ÚvalueÚ	tracebackr   Fr   )r   r   s   "€r   r   rì     s-   ø€ ÷ ñ ™Sð ©ð ¹ð ÁÈÅñ r   c                óv   € V P                   e+   V P                  P                  V P                  4      V n         R# )NF)rñ   ré   rs   rò   )ró   rë   rû   rü   s   &&&&r   Ú__exit__ÚDeviceGuard.__exit__  s+   € Ø�8‰8ÒØ×,Ñ,×BÑBÀ4Ç=Á=ÓQˆDŒHÙr   rð   N)
r5   r6   r7   r8   rf   rô   rø   rþ   r9   r:   r;   s   @r   rç   rç     s*   ø‡ € ñ÷ð ÷Lð L÷ö r   rç   c                   ó8  a € ] tR tRt o ]P
                  P                  t]P
                  P                  t]P
                  P                  t]	V 3R lR l4       t
 ! R R4      t]	! ]P
                  P                  4      t]	! ]P
                  P                  4      t]	! ]P
                  P                  4      t]	! ]P
                  P                  4      t]	! ]P
                  P                   4      t]	! ]P
                  P"                  4      t]	! ]P
                  P$                  4      t]	! ]P
                  P&                  4      t]	! ]P
                  P(                  4      t]	! ]4      t]	! ]P
                  P.                  4      t]	! ]P
                  P2                  4      t]	! ]P
                  P6                  4      t]	! ]P
                  P8                  4      t]	V 3R lR l4       t]	RV 3R	 lR
 ll4       t]	RV 3R lR ll4       t]	RV 3R lR ll4       t Rt!V t"R# )ÚCudaInterfacei  c                ó    <€ V ^8„  d   QhRS[ /# r^   r~   )r   r   s   "€r   r   ÚCudaInterface.__annotate__'  ó   ø€ ÷ ñ ‘Dñ r   c                 ó   € R # ©Tr   r   r   r   rÎ   ÚCudaInterface.is_gpu&  ó   € ár   c                   óx   a € ] tR tRt o ]V 3R lR l4       t]V 3R lR l4       t]R
V 3R lR ll4       tR	tV t	R# )ÚCudaInterface.Workeri+  c                ó$   <€ V ^8„  d   QhRS[ RR/# rT   rU   )r   r   s   "€r   r   Ú!CudaInterface.Worker.__annotate__-  ó   ø€ ÷ 	<ñ 	<™sð 	< tñ 	<r   c                ó   € V \         R &   R# )ÚcudaN©Úcaching_worker_current_devicesrY   s   &r   rZ   ÚCudaInterface.Worker.set_device,  ó   € à5;Ô*¨6Ó2r   c                ó    <€ V ^8„  d   QhRS[ /# r^   rU   )r   r   s   "€r   r   r  1  ó   ø€ ÷ 	/ñ 	/¡ñ 	/r   c                 ón   € R \         9   d   \         R ,          # \        P                  P                  4       # )r  )r  r(   r  r`   r   r   r   r`   Ú#CudaInterface.Worker.current_device0  ó)   € àÔ7Ô7Ü5°fÕ=Ð=Ü—:‘:×,Ñ,Ó.Ð.r   Nc                óN   <€ V ^8„  d   QhRS[ P                  P                  RS[/# r%   r'   )r   r   s   "€r   r   r  7  ó)   ø€ ÷ 	Dñ 	D©%¯+©+×*<Ñ*<ð 	DÉñ 	Dr   c                óR  € V eƒ   \        V \        4      '       dA   \        P                  ! V 4      p V P                  R8w  d   \        RV P                   R24      h\        V \        P                  4      '       d   V P                  p V f   \        P                  P                  4       p R\        9  d]   \        \        P                  P                  4       4       Uu. uF"  p\        P                  P                  V4      NK$  	  ppV\        R&   \        R,          V ,          # u upi )Nr  z"Expected device type 'cuda', got 'Ú')Ú
isinstancer   r(   r&   rë   ÚAssertionErrorrê   r  rh   r`   Ú caching_worker_device_propertiesÚranger  r{   rd   ©r&   ÚiÚdevice_props   &  r   rd   Ú*CudaInterface.Worker.get_device_properties6  óð   € àÒ!Ü˜f¤c×*Ò*Ü"Ÿ\š\¨&Ó1�FØ—{‘{ fÔ,Ü,Ø@ÀÇÁÀÈQÐOóð ô ˜f¤e§l¡l×3Ò3Ø#Ÿ\™\�FØŠ~Ü&×-Ñ-×<Ñ<Ó>�àÔ=Ô=ô #¤5§:¡:×#:Ñ#:Ó#<Ô=óá=˜ô —J‘J×4Ñ4°QÖ7Ù=ð ð ð <GÔ0°Ñ8ä3°FÕ;¸FÕCÐCùòó   Ã(D$r   r-   ©
r5   r6   r7   r8   rg   rZ   r`   rd   r9   r:   r;   s   @r   rh   r
  +  óG   ø‡ € Ø	÷	<ó 
ð	<ð 
÷	/ó 
ð	/ð
 
÷	Dñ 	Dó 
ö	Dr   rh   c                ó    <€ V ^8„  d   QhRS[ /# r^   r~   )r   r   s   "€r   r   r  ^  s   ø€ ÷ )ñ )™$ñ )r   c                 ó>   € \         P                  P                  4       # r-   )r(   r  r€   r   r   r   r€   ÚCudaInterface.is_available]  s   € ä�z‰z×&Ñ&Ó(Ð(r   Nc                ó^   <€ V ^8„  d   QhRS[ P                  P                  RS[S[,          /# r%   )r(   r)   r*   rV   r   )r   r   s   "€r   r   r  b  s-   ø€ ÷ Yñ Y¡u§{¡{×'9Ñ'9ð YÁSÉ3ÅYñ Yr   c                ó  € \         P                  P                  f2   \         P                  P	                  V 4      w  rV^
,          V,           # \         P                  P                  V 4      P                  P                  R^4      ^ ,          # )NÚ:)r(   ÚversionÚhipr  Úget_device_capabilityrd   ÚgcnArchNameÚsplit)r&   ÚmajorÚmins   &  r   r°   Ú$CudaInterface.get_compute_capabilitya  sf   € ä�=‰=×ÑÒ$ÜŸ™×9Ñ9¸&ÓA‰JˆEØ˜2•: Õ#Ð#ä—:‘:×3Ñ3°FÓ;×GÑG×MÑMÈcÐSTÓUÐVWÕXÐXr   c                óN   <€ V ^8„  d   QhRS[ P                  P                  RS[/# r%   rÈ   )r   r   s   "€r   r   r  j  s%   ø€ ÷ 
ñ 
¡%§+¡+×"4Ñ"4ð 
Áñ 
r   c                ó¢   € \         P                  P                  R J;'       g-    \        P                  P                  V 4      P                  ^8¬  # r-   )r(   r/  r0  r  rh   rd   r4  rY   s   &r   rÊ   ÚCudaInterface.is_triton_capablei  sF   € ô �M‰M×Ñ TÐ)÷ Mð MÜ×#Ñ#×9Ñ9¸&ÓA×GÑGÈ1ÑLð	
r   c                óL   <€ V ^8„  d   QhRS[ P                  P                  RR/# rT   rn   )r   r   s   "€r   r   r  u  s)   ø€ ÷ Wñ W©E¯K©K×,>Ñ,>ð WÈ$ñ Wr   c                óš  € ^ RI Hp ^ RIHp \        P                  V 4      '       g<   \        P                  P                  V 4      pV! V\        P                  ! 4       4      h^ RIp\        P                  P                  e&   RVP                  P                  9  d	   V! R4      hR# RVP                  P                  9  d	   V! R4      hR# )é    rß   )ÚGPUTooOldForTritonNÚamdz'triton not built with the 'amd' backendÚnvidiaz*triton not built with the 'nvidia' backend)rá   rà   Útorch._inductor.excr=  r  rÊ   r(   r  rd   ÚinspectÚcurrentframeÚtriton.backendsr/  r0  Úbackends)r&   rà   r=  Údevice_propsÚtritons   &    r   râ   Ú)CudaInterface.raise_if_triton_unavailablet  sœ   € å<Ý:ä×.Ñ.¨v×6Ò6Ü Ÿ:™:×;Ñ;¸FÓCˆLÙ$ \´7×3GÒ3GÓ3IÓJÐJãä�=‰=×ÑÒ(Ø˜FŸO™O×4Ñ4Ô4Ù,Ð-VÓWÐWñ 5à˜VŸ_™_×5Ñ5Ô5Ù(Ð)UÓVÐVñ 6r   r   r-   )#r5   r6   r7   r8   r(   r  r&   rH   rP   rg   rÎ   rh   r`   rZ   r{   rƒ   rŠ   r�   r–   r¡   rd   Úget_cuda_streamr�   Ú_exchange_devicerw   Ú_maybe_exchange_devicers   rÅ   r·   r€   r°   rÊ   râ   r9   r:   r;   s   @r   r  r    sÍ  ø‡ € Ø�Z‰Z×Ñ€Fð �J‰J×Ñ€EØ�Z‰Z×Ñ€Fà÷ó ð÷ Dñ  DñD " %§*¡*×";Ñ";Ó<€NÙ˜eŸj™j×3Ñ3Ó4€JÙ §
¡
× 7Ñ 7Ó8€LÙ˜%Ÿ*™*×+Ñ+Ó,€FÙ! %§*¡*×";Ñ";Ó<€NÙ˜eŸj™j×3Ñ3Ó4€JÙ$ U§Z¡Z×%AÑ%AÓBÐÙ˜uŸz™z×5Ñ5Ó6€KÙ(¨¯©×)IÑ)IÓJÐÙ! /Ó2€NÙ" 5§:¡:×#>Ñ#>Ó?€OÙ(¨¯©×)JÑ)JÓKÐÙ# E§J¡J×$?Ñ$?Ó@ÐÙ$ U§Z¡Z×%AÑ%AÓBÐð ÷)ó ð)ð ÷Yñ Yó ðYð ÷
ñ 
ó ð
ð ÷Wñ Wó öWr   r  )Ú_mtia_getCurrentRawStreamc                   ó<  a € ] tR tRt o ]P
                  P                  t]P
                  P                  t]P
                  P                  t]	V 3R lR l4       t
 ! R R4      t]	! ]P
                  P                  4      t]	! ]P
                  P                  4      t]	V 3R lR l4       t]	! ]P
                  P                  4      t]	! ]P
                  P                   4      t]	! ]P
                  P"                  4      t]	! ]P
                  P$                  4      t]	! ]P
                  P&                  4      t]	! ]P
                  P(                  4      t]	! ]4      t]	! ]P
                  P.                  4      t]	! ]P
                  P2                  4      t]	! ]P
                  P6                  4      t]	! ]P
                  P8                  4      t]	V 3R lR	 l4       t]RV 3R lR ll4       t]	RV 3R lR ll4       t ]	RV 3R lR ll4       t!]	RV 3R lR ll4       t"Rt#V t$R
# )ÚMtiaInterfacei�  c                ó    <€ V ^8„  d   QhRS[ /# r^   r~   )r   r   s   "€r   r   ÚMtiaInterface.__annotate__“  r  r   c                 ó   € R # r  r   r   r   r   rÎ   ÚMtiaInterface.is_gpu’  r  r   c                   óx   a € ] tR tRt o ]V 3R lR l4       t]V 3R lR l4       t]R
V 3R lR ll4       tR	tV t	R# )ÚMtiaInterface.Workeri—  c                ó$   <€ V ^8„  d   QhRS[ RR/# rT   rU   )r   r   s   "€r   r   Ú!MtiaInterface.Worker.__annotate__™  r  r   c                ó   € V \         R &   R# )ÚmtiaNr  rY   s   &r   rZ   ÚMtiaInterface.Worker.set_device˜  r  r   c                ó    <€ V ^8„  d   QhRS[ /# r^   rU   )r   r   s   "€r   r   rU  �  r  r   c                 ón   € R \         9   d   \         R ,          # \        P                  P                  4       # )rW  )r  r(   rW  r`   r   r   r   r`   Ú#MtiaInterface.Worker.current_deviceœ  r  r   Nc                óN   <€ V ^8„  d   QhRS[ P                  P                  RS[/# r%   r'   )r   r   s   "€r   r   rU  £  r  r   c                óR  € V eƒ   \        V \        4      '       dA   \        P                  ! V 4      p V P                  R8w  d   \        RV P                   R24      h\        V \        P                  4      '       d   V P                  p V f   \        P                  P                  4       p R\        9  d]   \        \        P                  P                  4       4       Uu. uF"  p\        P                  P                  V4      NK$  	  ppV\        R&   \        R,          V ,          # u upi )NrW  z"Expected device type 'mtia', got 'r  )r  r   r(   r&   rë   r  rê   rM  rh   r`   r  r   rW  r{   rd   r!  s   &  r   rd   Ú*MtiaInterface.Worker.get_device_properties¢  r%  r&  r   r-   r'  r;   s   @r   rh   rS  —  r(  r   rh   c                ó    <€ V ^8„  d   QhRS[ /# r^   rU   )r   r   s   "€r   r   rO  Ã  s   ø€ ÷ )ñ )™#ñ )r   c                 óŠ   € \         P                  P                  4       '       g   ^ # \         P                  P                  4       # ©r<  )r(   rW  Ú_is_compiledr{   r   r   r   r{   ÚMtiaInterface.device_countÂ  s+   € ä�z‰z×&Ñ&×(Ò(ÙÜ�z‰z×&Ñ&Ó(Ð(r   c                ó    <€ V ^8„  d   QhRS[ /# r^   r~   )r   r   s   "€r   r   rO  Ö  s   ø€ ÷ ñ ™$ñ r   c                 óB   € \         P                  P                  4       p V # r-   )r(   rW  r€   )Úrets    r   r€   ÚMtiaInterface.is_availableÕ  s   € ä�j‰j×%Ñ%Ó'ˆØˆ
r   Nc                óN   <€ V ^8„  d   QhRS[ P                  P                  RS[/# r%   rÃ   )r   r   s   "€r   r   rO  Û  s%   ø€ ÷ 
ñ 
©u¯{©{×/AÑ/Að 
ÉSñ 
r   c                ó:   € \        V P                  V4      R ^@4      # )rÖ   )r×   rd   r0   s   &&r   rÛ   Ú'MtiaInterface.get_multi_processor_countÚ  s#   € äØ×%Ñ% fÓ-Ø#Øó
ð 	
r   c                óN   <€ V ^8„  d   QhRS[ P                  P                  RS[/# r%   r'   )r   r   s   "€r   r   rO  ã  ó%   ø€ ÷ ñ ¡u§{¡{×'9Ñ'9ð ÁSñ r   c                óD   € \         P                  P                  V 4      pV# r-   )r(   rW  r1  ©r&   Úccs   & r   r°   Ú$MtiaInterface.get_compute_capabilityâ  s   € ä�Z‰Z×-Ñ-¨fÓ5ˆØˆ	r   c                óN   <€ V ^8„  d   QhRS[ P                  P                  RS[/# r%   rÈ   )r   r   s   "€r   r   rO  è  ó%   ø€ ÷ ñ ¡%§+¡+×"4Ñ"4ð Áñ r   c                ó   € R # r  r   rY   s   &r   rÊ   ÚMtiaInterface.is_triton_capableç  r  r   c                óL   <€ V ^8„  d   QhRS[ P                  P                  RR/# rT   rn   )r   r   s   "€r   r   rO  ì  s)   ø€ ÷ Uñ U©E¯K©K×,>Ñ,>ð UÈ$ñ Ur   c                ó`   € ^ RI p^ RIHp RVP                  P                  9  d	   V! R4      hR# )r<  Nrß   rW  z(triton not built with the 'mtia' backend©rC  rá   rà   rD  ©r&   rF  rà   s   &  r   râ   Ú)MtiaInterface.raise_if_triton_unavailableë  s+   € ãå<à˜Ÿ™×1Ñ1Ô1Ù(Ð)SÓTÐTñ 2r   r   r-   )%r5   r6   r7   r8   r(   rW  r&   rH   rP   rg   rÎ   rh   r`   rZ   r{   rƒ   rŠ   r�   r–   r¡   rd   Úget_mtia_streamr�   rI  rw   rJ  rs   rÅ   r·   r€   rå   rÛ   r°   rÊ   râ   r9   r:   r;   s   @r   rM  rM  �  sã  ø‡ € Ø�Z‰Z×Ñ€FØ�J‰J×Ñ€EØ�Z‰Z×Ñ€Fà÷ó ð÷ Dñ  DñD " %§*¡*×";Ñ";Ó<€NÙ˜eŸj™j×3Ñ3Ó4€Jð ÷)ó ð)ñ
 ˜%Ÿ*™*×+Ñ+Ó,€FÙ! %§*¡*×";Ñ";Ó<€NÙ˜eŸj™j×3Ñ3Ó4€JÙ$ U§Z¡Z×%AÑ%AÓBÐÙ˜uŸz™z×5Ñ5Ó6€KÙ(¨¯©×)IÑ)IÓJÐÙ! /Ó2€NÙ" 5§:¡:×#>Ñ#>Ó?€OÙ(¨¯©×)JÑ)JÓKÐÙ# E§J¡J×$?Ñ$?Ó@ÐÙ$ U§Z¡Z×%AÑ%AÓBÐð ÷ó ðð ÷
ñ 
ó ð
ð ÷ñ ó ðð ÷ñ ó ðð ÷Uñ Uó öUr   rM  )Ú_xpu_getCurrentRawStreamc                   ó@  a € ] tR tRt o ]P
                  P                  t]P
                  P                  t]P
                  P                  t]	V 3R lR l4       t
 ! R R4      t]	! ]P
                  P                  4      t]	! ]P
                  P                  4      t]	! ]P
                  P                  4      t]	! ]P
                  P                  4      t]	! ]P
                  P                   4      t]	! ]P
                  P"                  4      t]	! ]P
                  P$                  4      t]	! ]P
                  P&                  4      t]	! ]P
                  P(                  4      t]	! ]4      t]	! ]P
                  P.                  4      t]	! ]P
                  P2                  4      t]	! ]P
                  P6                  4      t]	V 3R lR l4       t]RV 3R	 lR
 ll4       t]	RV 3R lR ll4       t]	RV 3R lR ll4       t ]	RV 3R lR ll4       t!]	RV 3R lR ll4       t"Rt#V t$R# )ÚXpuInterfaceiü  c                ó    <€ V ^8„  d   QhRS[ /# r^   r~   )r   r   s   "€r   r   ÚXpuInterface.__annotate__  r  r   c                 ó   € R # r  r   r   r   r   rÎ   ÚXpuInterface.is_gpu  r  r   c                   óx   a € ] tR tRt o ]V 3R lR l4       t]V 3R lR l4       t]R
V 3R lR ll4       tR	tV t	R# )ÚXpuInterface.Workeri  c                ó$   <€ V ^8„  d   QhRS[ RR/# rT   rU   )r   r   s   "€r   r   Ú XpuInterface.Worker.__annotate__  s   ø€ ÷ 	;ñ 	;™sð 	; tñ 	;r   c                ó   € V \         R &   R# )ÚxpuNr  rY   s   &r   rZ   ÚXpuInterface.Worker.set_device  s   € à4:Ô*¨5Ó1r   c                ó    <€ V ^8„  d   QhRS[ /# r^   rU   )r   r   s   "€r   r   r…    s   ø€ ÷ 	.ñ 	.¡ñ 	.r   c                 ón   € R \         9   d   \         R ,          # \        P                  P                  4       # )r‡  )r  r(   r‡  r`   r   r   r   r`   Ú"XpuInterface.Worker.current_device  s)   € àÔ6Ô6Ü5°eÕ<Ð<Ü—9‘9×+Ñ+Ó-Ð-r   Nc                óN   <€ V ^8„  d   QhRS[ P                  P                  RS[/# r%   r'   )r   r   s   "€r   r   r…    s)   ø€ ÷ 	Cñ 	C©%¯+©+×*<Ñ*<ð 	CÉñ 	Cr   c                óR  € V eƒ   \        V \        4      '       dA   \        P                  ! V 4      p V P                  R8w  d   \        RV P                   R24      h\        V \        P                  4      '       d   V P                  p V f   \        P                  P                  4       p R\        9  d]   \        \        P                  P                  4       4       Uu. uF"  p\        P                  P                  V4      NK$  	  ppV\        R&   \        R,          V ,          # u upi )Nr‡  z!Expected device type 'xpu', got 'r  )r  r   r(   r&   rë   r  rê   r}  rh   r`   r  r   r‡  r{   rd   r!  s   &  r   rd   Ú)XpuInterface.Worker.get_device_properties  sð   € àÒ!Ü˜f¤c×*Ò*Ü"Ÿ\š\¨&Ó1�FØ—{‘{ eÔ+Ü,Ø?ÀÇÁ¸}ÈAÐNóð ô ˜f¤e§l¡l×3Ò3Ø#Ÿ\™\�FØŠ~Ü%×,Ñ,×;Ñ;Ó=�àÔ<Ô<ô #¤5§9¡9×#9Ñ#9Ó#;Ô<óá<˜ô —I‘I×3Ñ3°AÖ6Ù<ð ð ð ;FÔ0°Ñ7ä3°EÕ:¸6ÕBÐBùòr&  r   r-   r'  r;   s   @r   rh   rƒ    sG   ø‡ € Ø	÷	;ó 
ð	;ð 
÷	.ó 
ð	.ð
 
÷	Cñ 	Có 
ö	Cr   rh   c                ó    <€ V ^8„  d   QhRS[ /# r^   r~   )r   r   s   "€r   r   r  8  s   ø€ ÷ (ñ (™$ñ (r   c                 ó>   € \         P                  P                  4       # r-   )r(   r‡  r€   r   r   r   r€   ÚXpuInterface.is_available7  s   € ä�y‰y×%Ñ%Ó'Ð'r   Nc                óN   <€ V ^8„  d   QhRS[ P                  P                  RS[/# r%   rÃ   )r   r   s   "€r   r   r  <  s)   ø€ ÷ Yñ Y©u¯{©{×/AÑ/Að YÉSñ Yr   c                óf   € V P                  V4      p\        VR R4      ;'       g    VP                  # )rÖ   N)rd   r×   Úgpu_subslice_count)r1   r&   rÙ   s   && r   rÛ   Ú&XpuInterface.get_multi_processor_count;  s0   € à×)Ñ)¨&Ó1ˆÜ�uÐ5°tÓ<×XÐXÀ×@XÑ@XÐXr   c                óN   <€ V ^8„  d   QhRS[ P                  P                  RS[/# r%   r'   )r   r   s   "€r   r   r  A  rl  r   c                óD   € \         P                  P                  V 4      pV# r-   )r(   r‡  r1  rn  s   & r   r°   Ú#XpuInterface.get_compute_capability@  s   € ä�Y‰Y×,Ñ,¨VÓ4ˆØˆ	r   c                ó&   <€ V ^8„  d   QhRS[ RS[ /# r³   r~   )r   r   s   "€r   r   r  F  s   ø€ ÷ -ñ -©tð -Áñ -r   c                ó>   € \         P                  P                  4       # r-   )r(   r‡  r·   r¶   s   &r   r·   ÚXpuInterface.is_bf16_supportedE  s   € ä�y‰y×*Ñ*Ó,Ð,r   c                óN   <€ V ^8„  d   QhRS[ P                  P                  RS[/# r%   rÈ   )r   r   s   "€r   r   r  J  rr  r   c                ó   € R # r  r   rY   s   &r   rÊ   ÚXpuInterface.is_triton_capableI  r  r   c                óL   <€ V ^8„  d   QhRS[ P                  P                  RR/# rT   rn   )r   r   s   "€r   r   r  N  s)   ø€ ÷ Vñ V©E¯K©K×,>Ñ,>ð VÈ$ñ Vr   c                ó`   € ^ RI p^ RIHp RVP                  P                  9  d	   V! R4      hR# )r<  Nrß   Úintelz)triton not built with the 'intel' backendrw  rx  s   &  r   râ   Ú(XpuInterface.raise_if_triton_unavailableM  s+   € ãå<à˜&Ÿ/™/×2Ñ2Ô2Ù(Ð)TÓUÐUñ 3r   r   r-   rä   )%r5   r6   r7   r8   r(   r‡  r&   rH   rP   rg   rÎ   rh   r`   rZ   r{   rƒ   rŠ   r�   r–   r¡   rd   Úget_xpu_streamr�   rI  rw   rJ  rs   rÅ   r€   rå   rÛ   r°   r·   rÊ   râ   r9   r:   r;   s   @r   r}  r}  ü  sæ  ø‡ € Ø�Y‰Y×Ñ€FØ�I‰I�O‰O€EØ�Y‰Y×Ñ€Fà÷ó ð÷ Cñ  CñD " %§)¡)×":Ñ":Ó;€NÙ˜eŸi™i×2Ñ2Ó3€JÙ §	¡	× 6Ñ 6Ó7€LÙ˜%Ÿ)™)×*Ñ*Ó+€FÙ! %§)¡)×":Ñ":Ó;€NÙ˜eŸi™i×2Ñ2Ó3€JÙ$ U§Y¡Y×%@Ñ%@ÓAÐÙ˜uŸy™y×4Ñ4Ó5€KÙ(¨¯©×)HÑ)HÓIÐÙ! .Ó1€NÙ" 5§9¡9×#=Ñ#=Ó>€OÙ(¨¯©×)IÑ)IÓJÐÙ# E§I¡I×$>Ñ$>Ó?Ðð ÷(ó ð(ð ÷Yñ Yó ðYð ÷ñ ó ðð ÷-ñ -ó ð-ð ÷ñ ó ðð ÷Vñ Vó öVr   r}  c                   ó,   a € ] tR tRt o V 3R ltRtV tR# )ÚCpuDevicePropertiesiW  c                ó&   <€ V ^8„  d   Qh/ S[ ;R&   # )r   rÖ   rU   )r   r   s   "€r   r   Ú CpuDeviceProperties.__annotate__W  s   ø‡ ‚ áÑò r   r   N)r5   r6   r7   r8   Ú__annotate_func__r9   r:   r;   s   @r   r¥  r¥  W  s   ø‡ ‡ „ r   r¥  c                   óR  a € ] tR tRt o  ! R R]P
                  4      t ! R R4      t]V 3R lR l4       t]RV 3R lR	 ll4       t	]RV 3R lR ll4       t
]V 3R lR l4       t]V 3R lR l4       t]RV 3R lR ll4       t]RV 3R lR ll4       t]RV 3R lR ll4       tRtV tR
# )ÚCpuInterfacei\  c                   ó^   a € ] tR tRt o R
V 3R lR lltV 3R lR ltRV 3R lR lltR	tV tR# )ÚCpuInterface.Eventi^  c                ó$   <€ V ^8„  d   QhRS[ RR/# )r   Úenable_timingr   Nr~   )r   r   s   "€r   r   ÚCpuInterface.Event.__annotate___  s   ø€ ÷ 	ñ 	©$ð 	¸$ñ 	r   c                ó   € R V n         R# )g        N©Útime)ró   r®  s   &&r   rô   ÚCpuInterface.Event.__init___  s	   € ØˆDŽIr   c                ó&   <€ V ^8„  d   QhRS[ RS[/# )r   Úotherr   )r   Úfloat)r   r   s   "€r   r   r¯  b  s   ø€ ÷ 	3ñ 	3¡cð 	3©eñ 	3r   c                óJ   € VP                   V P                   ,
          R ,          # )iè  r±  )ró   rµ  s   &&r   Úelapsed_timeÚCpuInterface.Event.elapsed_timeb  s   € Ø—J‘J §¡Õ*¨dÕ2Ð2r   Nc                ó$   <€ V ^8„  d   QhRS[ RR/# r�   rB   )r   r   s   "€r   r   r¯  e  s   ø€ ÷ 	,ñ 	,¡ð 	,°ñ 	,r   c                ó:   € \         P                  ! 4       V n         R # r-   )r²  Úperf_counter)ró   rƒ   s   &&r   ÚrecordÚCpuInterface.Event.recorde  s   € Ü×)Ò)Ó+ˆDŽIr   r±  r  r-   )	r5   r6   r7   r8   rô   r¸  r½  r9   r:   r;   s   @r   rH   r¬  ^  s(   ø‡ € ÷	ò 	÷	3ð 	3÷	,÷ 	,ð 	,r   rH   c                   ó@   a € ] tR tRt o ]RV 3R lR ll4       tRtV tR# )ÚCpuInterface.Workerii  Nc                óN   <€ V ^8„  d   QhRS[ P                  P                  RS[/# r%   )r(   r)   r*   r¥  )r   r   s   "€r   r   Ú CpuInterface.Worker.__annotate__k  s'   ø€ ÷ 	2ñ 	2Ù—K‘K×&Ñ&ð	2á ñ	2r   c                ó@   € ^ RI pVP                  4       p\        V4      # )r<  N)ÚmultiprocessingÚ	cpu_countr¥  )r&   rÄ  rÅ  s   &  r   rd   Ú)CpuInterface.Worker.get_device_propertiesj  s    € ó #à'×1Ñ1Ó3ˆIÜ& yÓ1Ð1r   r   r-   )r5   r6   r7   r8   rg   rd   r9   r:   r;   s   @r   rh   rÀ  i  s   ø‡ € Ø	÷	2ñ 	2ó 
ö	2r   rh   c                ó    <€ V ^8„  d   QhRS[ /# r^   r~   )r   r   s   "€r   r   ÚCpuInterface.__annotate__t  s   ø€ ÷ ñ ™$ñ r   c                 ó   € R # r  r   r   r   r   r€   ÚCpuInterface.is_availables  r  r   c                ó&   <€ V ^8„  d   QhRS[ RS[ /# r³   r~   )r   r   s   "€r   r   rÈ  x  ó   ø€ ÷ ñ ©tð Áñ r   c                ó   € R # r  r   r¶   s   &r   r·   ÚCpuInterface.is_bf16_supportedw  r  r   Nc                óN   <€ V ^8„  d   QhRS[ P                  P                  RS[/# r%   ©r(   r)   r*   r   )r   r   s   "€r   r   rÈ  |  ó%   ø€ ÷ ñ ¡u§{¡{×'9Ñ'9ð ÁSñ r   c                ó   € R # ©Ú r   rY   s   &r   r°   Ú#CpuInterface.get_compute_capability{  ó   € ár   c                ó&   <€ V ^8„  d   QhRS[ RS[/# r™   )r   rV   )r   r   s   "€r   r   rÈ  €  s   ø€ ÷ ñ ¡3ð ©3ñ r   c                ó   € ^ # ra  r   rœ   s   &r   r�   ÚCpuInterface.get_raw_stream  ó   € ár   c                ó    <€ V ^8„  d   QhRS[ /# r^   rU   )r   r   s   "€r   r   rÈ  „  ó   ø€ ÷ ñ ™Cñ r   c                 ó   € ^ # ra  r   r   r   r   r`   ÚCpuInterface.current_deviceƒ  rÚ  r   c                óL   <€ V ^8„  d   QhRS[ P                  P                  RR/# rT   rn   )r   r   s   "€r   r   rÈ  ˆ  s%   ø€ ÷ ñ ™EŸK™K×.Ñ.ð ¸$ñ r   c                ó   € R # r-   r   rY   s   &r   r¡   ÚCpuInterface.synchronize‡  s   € ár   c                óN   <€ V ^8„  d   QhRS[ P                  P                  RS[/# r%   rÈ   )r   r   s   "€r   r   rÈ  Œ  rr  r   c                ó   € R # r  r   rY   s   &r   rÊ   ÚCpuInterface.is_triton_capable‹  r  r   c                óL   <€ V ^8„  d   QhRS[ P                  P                  RR/# rT   rn   )r   r   s   "€r   r   rÈ  �  s)   ø€ ÷ Tñ T©E¯K©K×,>Ñ,>ð TÈ$ñ Tr   c                ó`   € ^ RI p^ RIHp RVP                  P                  9  d	   V! R4      hR# )r<  Nrß   Úcpuz'triton not built with the 'cpu' backendrw  rx  s   &  r   râ   Ú(CpuInterface.raise_if_triton_unavailable�  s+   € ãå<à˜Ÿ™×0Ñ0Ô0Ù(Ð)RÓSÐSñ 1r   r   rä   r-   )r5   r6   r7   r8   r(   rH   rh   rg   r€   r·   r°   r�   r`   r¡   rÊ   râ   r9   r:   r;   s   @r   rª  rª  \  sÛ   ø‡ € ô,�—‘ô ,÷2ñ 2ð ÷ó ðð ÷ñ ó ðð ÷ñ ó ðð ÷ó ðð ÷ó ðð ÷ñ ó ðð ÷ñ ó ðð ÷Tñ Tó öTr   rª  c                   ó  a € ] tR tRt o ]V 3R lR l4       t]RV 3R lR ll4       t]RV 3R lR ll4       t]V 3R lR	 l4       t	]V 3R
 lR l4       t
]RV 3R lR ll4       t]RV 3R lR ll4       t ! R R4      tRtV tR# )ÚMpsInterfacei™  c                ó    <€ V ^8„  d   QhRS[ /# r^   r~   )r   r   s   "€r   r   ÚMpsInterface.__annotate__›  r  r   c                 ó   € R # r  r   r   r   r   rÎ   ÚMpsInterface.is_gpuš  r  r   c                ó&   <€ V ^8„  d   QhRS[ RS[ /# r³   r~   )r   r   s   "€r   r   rì  Ÿ  rÌ  r   c                ó   € R # r  r   r¶   s   &r   r·   ÚMpsInterface.is_bf16_supportedž  r  r   c                ó@   <€ V ^8„  d   QhRS[ P                  RS[RS[/# rº   r¼   )r   r   s   "€r   r   rì  £  s)   ø€ ÷ ñ Ù—K‘KðÙ6:ðá	ñr   c                óT   € V\         P                  \         P                  39   d   R # R# )FT)r(   Úfloat64Ú
complex128r¿   s   &&&r   rÀ   ÚMpsInterface.is_dtype_supported¢  s!   € ð ”U—]‘]¤E×$4Ñ$4Ð5Ô5ÙÙr   c                ó    <€ V ^8„  d   QhRS[ /# r^   r~   )r   r   s   "€r   r   rì  «  s   ø€ ÷ 1ñ 1™$ñ 1r   c                 óR   € \         P                  P                  P                  4       # r-   )r(   rD  Úmpsr€   r   r   r   r€   ÚMpsInterface.is_availableª  s   € ä�~‰~×!Ñ!×.Ñ.Ó0Ð0r   c                ó    <€ V ^8„  d   QhRS[ /# r^   rU   )r   r   s   "€r   r   rì  ¯  rÜ  r   c                 ó   € ^ # ra  r   r   r   r   r`   ÚMpsInterface.current_device®  rÚ  r   Nc                óN   <€ V ^8„  d   QhRS[ P                  P                  RS[/# r%   rÐ  )r   r   s   "€r   r   rì  ³  rÑ  r   c                ó   € R # rÓ  r   rY   s   &r   r°   Ú#MpsInterface.get_compute_capability²  rÖ  r   c                óL   <€ V ^8„  d   QhRS[ P                  P                  RR/# rT   rn   )r   r   s   "€r   r   rì  ·  s%   ø€ ÷  ñ  ™EŸK™K×.Ñ.ð  ¸$ñ  r   c                óB   € \         P                  P                  4        R # r-   )r(   rù  r¡   rY   s   &r   r¡   ÚMpsInterface.synchronize¶  s   € ä�	‰	×ÑÖr   c                   ó\   a € ] tR tRt o ]RV 3R lR ll4       t]V 3R lR l4       tRtV tR# )	ÚMpsInterface.Workeri»  Nc                óN   <€ V ^8„  d   QhRS[ P                  P                  RS[/# r%   r'   )r   r   s   "€r   r   Ú MpsInterface.Worker.__annotate__½  ó%   ø€ ÷ 	ñ 	©%¯+©+×*<Ñ*<ð 	Éñ 	r   c                ót   € \        R R.4      ! \        P                  P                  P	                  4       4      # )ÚMPSPropertiesrÖ   )r   r(   rD  rù  Úget_core_countrY   s   &r   rd   Ú)MpsInterface.Worker.get_device_properties¼  s0   € ä˜oÐ0GÐ/HÔIÜ—‘×"Ñ"×1Ñ1Ó3óð r   c                ó    <€ V ^8„  d   QhRS[ /# r^   rU   )r   r   s   "€r   r   r  Ã  ó   ø€ ÷ 	ñ 	¡ñ 	r   c                 ó   € ^ # ra  r   r   r   r   r`   Ú"MpsInterface.Worker.current_deviceÂ  ó   € ár   r   r-   ©	r5   r6   r7   r8   rg   rd   r`   r9   r:   r;   s   @r   rh   r  »  ó0   ø‡ € Ø	÷	ñ 	ó 
ð	ð
 
÷	ó 
ö	r   rh   r   rä   r-   )r5   r6   r7   r8   rg   rÎ   r·   rå   rÀ   r€   r`   r°   r¡   rh   r9   r:   r;   s   @r   rê  rê  ™  s­   ø‡ € Ø÷ó ðð ÷ñ ó ðð ÷ñ ó ðð ÷1ó ð1ð ÷ó ðð ÷ñ ó ðð ÷ ñ  ó ð ÷	÷ 	r   rê  c                   óÌ   a € ] tR tRt o ]RV 3R lR ll4       t]RV 3R lR ll4       t]V 3R lR l4       t]V 3R lR	 l4       t	]RV 3R lR ll4       t
 ! R R4      tRtV tR
# )ÚTpuInterfaceiÇ  c                ó&   <€ V ^8„  d   QhRS[ RS[ /# r³   r~   )r   r   s   "€r   r   ÚTpuInterface.__annotate__É  rÌ  r   c                ó   € R # r  r   r¶   s   &r   r·   ÚTpuInterface.is_bf16_supportedÈ  r  r   c                ó@   <€ V ^8„  d   QhRS[ P                  RS[RS[/# rº   r¼   )r   r   s   "€r   r   r  Í  s)   ø€ ÷ 	
ñ 	
Ù—K‘Kð	
Ù6:ð	
á	ñ	
r   c                ó¢   € V\         P                  \         P                  \         P                  \         P                  \         P
                  39  # r-   )r(   rô  Ú	complex32Ú	complex64rõ  Úhalfr¿   s   &&&r   rÀ   ÚTpuInterface.is_dtype_supportedÌ  s;   € ð Ü�M‰MÜ�O‰OÜ�O‰OÜ×ÑÜ�J‰Jð
ñ 
ð 	
r   c                ó    <€ V ^8„  d   QhRS[ /# r^   r~   )r   r   s   "€r   r   r  Ù  s   ø€ ÷ ñ ™$ñ r   c                 ó   € \        4       # r-   r
   r   r   r   r€   ÚTpuInterface.is_availableØ  s
   € ä‹Ðr   c                ó    <€ V ^8„  d   QhRS[ /# r^   rU   )r   r   s   "€r   r   r  Ý  rÜ  r   c                 ó   € ^ # ra  r   r   r   r   r`   ÚTpuInterface.current_deviceÜ  rÚ  r   Nc                óN   <€ V ^8„  d   QhRS[ P                  P                  RS[/# r%   rÐ  )r   r   s   "€r   r   r  á  rÑ  r   c                ó   € R # rÓ  r   rY   s   &r   r°   Ú#TpuInterface.get_compute_capabilityà  rÖ  r   c                   ó\   a € ] tR tRt o ]RV 3R lR ll4       t]V 3R lR l4       tRtV tR# )	ÚTpuInterface.Workeriå  Nc                óN   <€ V ^8„  d   QhRS[ P                  P                  RS[/# r%   r'   )r   r   s   "€r   r   Ú TpuInterface.Worker.__annotate__ç  r  r   c                ó(   € \        R R.4      ! ^4      # )ÚTPUPropertiesrÖ   r   rY   s   &r   rd   Ú)TpuInterface.Worker.get_device_propertiesæ  s   € ä˜oÐ0GÐ/HÔIØóð r   c                ó    <€ V ^8„  d   QhRS[ /# r^   rU   )r   r   s   "€r   r   r,  í  r  r   c                 ó   € ^ # ra  r   r   r   r   r`   Ú"TpuInterface.Worker.current_deviceì  r  r   r   r-   r  r;   s   @r   rh   r*  å  r  r   rh   r   rä   r-   )r5   r6   r7   r8   rg   r·   rå   rÀ   r€   r`   r°   rh   r9   r:   r;   s   @r   r  r  Ç  s€   ø‡ € Ø÷ñ ó ðð ÷	
ñ 	
ó ð	
ð ÷ó ðð ÷ó ðð ÷ñ ó ð÷	÷ 	r   r  Fc                ót   € V ^8„  d   QhR\         \        P                  ,          R\        \        ,          RR/# )r   r&   ré   r   N©r   r(   r&   rë   r   )r   s   "r   r   r   õ  s2   € ÷ =ñ =Ü”%—,‘,Õð=Ü26´Õ2Gð=à	ñ=r   c                ó°   € \        V \        P                  4      '       d   V P                  p T\        V &   ^RIHp VP                  P                  4        R# )a{  Register a DeviceInterface for a device type.

Registration must happen before ``torch._inductor.utils`` is imported:
the registry-derived GPU classification (GPU_TYPES / is_gpu() /
get_gpu_type()) is scanned exactly once, at that import. In-tree backends
satisfy this by construction (init_device_reg() runs inside the scan
itself). Out-of-tree backends register at package import, either
autoloaded during ``import torch`` (TORCH_DEVICE_BACKEND_AUTOLOAD) or via
an explicit ``import torch_npu``-style import, both of which precede any
import of inductor. Registering later is not supported and will not be
reflected in the snapshot.
)ÚUserDefinedClassVariableN)	r  r(   r&   rë   Údevice_interfacesÚvariables.user_definedr6  Ú_in_graph_classesÚcache_clear)r&   ré   r6  s   && r   Úregister_interface_for_devicer;  õ  s>   € ô �&œ%Ÿ,™,×'Ò'Ø—‘ˆØ 0Ô�fÑÝ@à×.Ñ.×:Ñ:Ö<r   c                óp   € V ^8„  d   QhR\         \        P                  ,          R\        \        ,          /# r%   r4  )r   s   "r   r   r     s,   € ÷ Cñ C¤S¬5¯<©<Õ%7ð C¼DÄÕ<Qñ Cr   c                 óÒ   € \        V \        P                  4      '       d   V P                  p \        '       g   \        4        V \        9   d   \        V ,          # \        R V  24      h)zNo interface for device )r  r(   r&   rë   Ú_device_initializedÚinit_device_regr7  r/   rY   s   &r   Úget_interface_for_devicer@    sO   € Ü�&œ%Ÿ,™,×'Ò'Ø—‘ˆßÓÜÔØÔ"Ô"Ü  Õ(Ð(Ü
Ð 8¸¸ÐAÓ
BÐBr   c                ór   € V ^8„  d   QhR\         \        \        \        \        ,          3,          ,          /# r^   )r   r   r   rë   r   )r   s   "r   r   r     s'   € ÷ %ñ %¬(´5¼¼dÄ?Õ>SÐ9SÕ3TÕ*Uñ %r   c                  óV   € \         '       g   \        4        \        P                  4       # r-   )r>  r?  r7  Úitemsr   r   r   Ú get_registered_device_interfacesrD    s   € ßÓÜÔÜ×"Ñ"Ó$Ð$r   c                ó   € V ^8„  d   QhRR/# r§   r   )r   s   "r   r   r     s   € ÷ 	ñ 	˜ñ 	r   c                  óÊ   € \        R \        4       \        R\        4       \        R\        4       \        R\        4       \        R\
        4       \        R\        4       RsR# )r  r‡  rW  rç  rù  ÚtpuTN)r;  r  r}  rM  rª  rê  r  r>  r   r   r   r?  r?    sD   € ä! &¬-Ô8Ü! %¬Ô6Ü! &¬-Ô8Ü! %¬Ô6Ü! %¬Ô6Ü! %¬Ô6àÒr   c                ó  € V ^8„  d   Qh/ ^ \         9   d#   \        \        .\        3,          R,          ;R&   ^\         9   d   \        \        \
        3,          ;R&   ^\         9   d   \        \        \        3,          ;R&   ^\         9   d#   \        \        .\        3,          R,          ;R&   ^\         9   d#   \        \        .\        3,          R,          ;R&   ^\         9   d&   \        \        \        \        ,          3,          ;R&   # )r   NrH  r  r  rz  r£  r7  )Ú__conditional_annotations__r   rV   r¨   r   r   rë   r   )r   s   "r   r   r      sÑ   € ÷ ñ ÷8 -Ò ,”œ3˜%¤˜*Õ%¨Õ,Ñ ,ñ9÷F 6Ò 5¤$¤s¬C x¥.Ñ 5ñG÷H 4Ò 3¤¤S¬# X¥Ñ 3ñI÷J -Ò ,”œ3˜%¤˜*Õ%¨Õ,Ñ ,ñK÷h ,Ò +”œ#˜¤˜Õ$ tÕ+Ñ +ñi÷` 9Ò 8”4œœT¤/Õ2Ð2Õ3Ñ 8òar   ).rI  rf   rA  r²  Úcollectionsr   Úcollections.abcr   r   Údataclassesr   Útypingr   r	   r(   Útorch.utils._pallasr   r  rb  Útorch._Cr   rH  r  r  r   rç   r  rW  rK  rz  rM  r‡  r{  r£  r}  r¥  rª  rê  r  r7  r>  r;  r@  rD  r?  r   )rI  s   @r   Ú<module>rP     sK  øðöó" Û Ý "ß .Ý !ß ã Ý -ó -Ø‡:�:×Ñ×ÒÞEà€Oð 46Ð  Ó 5Ø13Ð Ó 3÷Xñ X÷vñ ô6eW�Oô eWóP -Ø‡:�:×Ñ×ÒÞEà€OôeU�Oô eUóP ,Ø‡9�9×Ñ×ÒÞCà€NôXV�?ô XVðv ÷ð ó ðô:T�?ô :Tôz+�?ô +ô\'�?ô 'ðT 79Ð Ó 8ØÐ õ=õ.Cõ%÷	r   