+
    –°³j€  ã                   ó  a € R t&0 t R t^ RIt^ RIt^ RIHtHt ^ RIHt ^ RI	H
t
Ht ^ RIt^ RIHt ]P                  ! ]4      t ! R R]4      t]]P$                  ]]P(                  ,          .]3,          t/ t] ^ k / t] ^k / t] ^k Rs] ^k RR	 R
 llt]P6                  ! ]RR7      t]P6                  ! ]RR7      tR R ltRR R llt]P@                  R R l4       t!]P@                  R R l4       t"R R lt#R R lt$R R lt%R# )a  
This module implements TorchDynamo's backend registry system for managing compiler backends.

The registry provides a centralized way to register, discover and manage different compiler
backends that can be used with torch.compile(). It handles:

- Backend registration and discovery through decorators and entry points
- Lazy loading of backend implementations
- Lookup and validation of backend names
- Categorization of backends using tags (debug, experimental, etc.)

Key components:
- CompilerFn: Type for backend compiler functions that transform FX graphs
- _BACKENDS: Registry mapping backend names to entry points
- _COMPILER_FNS: Registry mapping backend names to loaded compiler functions
- _BACKEND_TAGS: Registry mapping backend names to their tags

Example usage:
    @register_backend
    def my_compiler(fx_graph, example_inputs):
        # Transform FX graph into optimized implementation
        return compiled_fn

    # Use registered backend
    torch.compile(model, backend="my_compiler")

The registry also supports discovering backends through setuptools entry points
in the "torch_dynamo_backends" group. Example:
```
setup.py
---
from setuptools import setup

setup(
    name='my_torch_backend',
    version='0.1',
    packages=['my_torch_backend'],
    entry_points={
        'torch_dynamo_backends': [
            # name = path to entry point of backend implementation
            'my_compiler = my_torch_backend.compiler:my_compiler_function',
        ],
    },
)
```
```
my_torch_backend/compiler.py
---
def my_compiler_function(fx_graph, example_inputs):
    # Transform FX graph into optimized implementation
    return compiled_fn
```
Using `my_compiler` backend:
```
import torch

model = ...  # Your PyTorch model
optimized_model = torch.compile(model, backend="my_compiler")
```
N)ÚCallableÚSequence)Ú
EntryPoint)ÚAnyÚProtocol)Úfxc                   ó2   a € ] tR t^Kt o V 3R lR ltRtV tR# )Ú
CompiledFnc                ób   <€ V ^8„  d   QhRS[ P                  RS[S[ P                  R3,          /# )é   ÚargsÚreturn.)ÚtorchÚTensorÚtuple)ÚformatÚ__classdict__s   "€Ú`/home/luca/screen-checking/.venv/lib/python3.14/site-packages/torch/_dynamo/backends/registry.pyÚ__annotate__ÚCompiledFn.__annotate__L   s%   ø€ ×LÑL™eŸl™lÐL©u±U·\±\À3Ð5FÕ/GÑLó    c                ó   € R # )N© )Úselfr   s   &*r   Ú__call__ÚCompiledFn.__call__L   s   € Ér   r   N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__r   Ú__static_attributes__Ú__classdictcell__)r   s   @r   r	   r	   K   s   ø‡ € ßLÖLr   r	   Úinductorc          
      ó”   € V ^8„  d   QhR\         R,          R\        R,          R\        \        ,          R\        R\        3,          /# )r   Úcompiler_fnNÚnameÚtagsr   .)Ú
CompilerFnÚstrr   r   r   )r   s   "r   r   r   W   sF   € ÷ ñ Ü˜dÕ"ðä
��*ðô ”3�-ðô ˆc”3ˆhÕñ	r   c                óR  € V f   \         P                  ! \        WR7      # \        V 4      '       g   \	        R\        V 4       24      hT;'       g    V P                  pV\        9   d   \	        RV 24      hV\        9  d
   R\        V&   V \        V&   \        V4      \        V&   V # )a±  
Decorator to add a given compiler to the registry to allow calling
`torch.compile` with string shorthand.  Note: for projects not
imported by default, it might be easier to pass a function directly
as a backend and not use a string.

Args:
    compiler_fn: Callable taking a FX graph and fake tensor inputs
    name: Optional name, defaults to `compiler_fn.__name__`
    tags: Optional set of string tags to categorize backend with
N)r%   r&   z"compiler_fn must be callable, got zduplicate name: )Ú	functoolsÚpartialÚregister_backendÚcallableÚAssertionErrorÚtyper   Ú_COMPILER_FNSÚ	_BACKENDSr   Ú_BACKEND_TAGS)r$   r%   r&   s   &&&r   r,   r,   W   sŸ   € ð  Òä× Ò Ô!1¸ÔHÐHÜ�K× Ò ÜÐAÄ$À{ÓBSÐATÐUÓVÐVØ×'Ð'�;×'Ñ'€DØŒ}ÔÜÐ/°¨vÐ6Ó7Ð7Ø”9ÔØŒ	�$‰Ø%„M�$ÑÜ ›+„M�$ÑØÐr   )r&   c                óF   € V ^8„  d   QhR\         \        ,          R\        /# ©r   r$   r   ©r(   r'   )r   s   "r   r   r   |   s   € ÷ ñ ¤¤jÕ 0ð ´Zñ r   c                óX  € \        V \        4      '       d”   V \        9  d   \        4        V \        9  d0   ^ RIp^RIHp VP                  V \        4       ^R7      pV! WR7      hV \        9  d-   \        V ,          pVe   \        VP                  4       V R7       \        V ,          p V # )z#Expand backend strings to functionsN)ÚInvalidBackend)Ún)r%   Úsuggestions)r$   r%   )Ú
isinstancer(   r1   Ú_lazy_importÚdifflibÚexcr7   Úget_close_matchesÚlist_backendsr0   r,   Úload)r$   r<   r7   r9   Úentry_points   &    r   Úlookup_backendrB   |   sŠ   € ä�+œs×#Ò#ØœiÔ'ÜŒNØœiÔ'Ûå,à!×3Ñ3°KÄÃÐTUÐ3ÓVˆKÙ  kÔKÐKàœmÔ+Ü# KÕ0ˆKØÒ&Ü ¨[×-=Ñ-=Ó-?ÀkÕRÜ# KÕ0ˆØÐr   c                ó:   € V ^8„  d   QhR\         \        ,          /# ©r   r   )Úlistr(   )r   s   "r   r   r   ’   s   € ÷ ñ ¼TÄ#½Yñ r   c           	     óä   € \        4        \        T ;'       g    R4      p\         Uu. uF2  pVP                  \        P                  VR4      4      '       d   K0  VNK4  	  pp\        V4      # u upi )zU
Return valid strings that can be passed to:

    torch.compile(..., backend="name")
r   )r;   Úsetr1   Úintersectionr2   ÚgetÚsorted)Úexclude_tagsÚexclude_tags_setr%   Úbackendss   &   r   r?   r?   ’   sm   € ô „NÜ˜<×-Ð-¨2Ó.Ðõ óáˆDØ×,Ñ,¬]×->Ñ->¸tÀRÓ-H×I÷ 	ˆÙð ð ô
 �(ÓÐùòs   ¨-A-ÁA-c                ó   € V ^8„  d   QhRR/# ©r   r   Nr   )r   s   "r   r   r   ¤   s   € ÷ $ñ $�dñ $r   c                  ól   € ^RI Hp  ^RIHp V! V 4       ^RIHp Vf   \        R4      h\        4        R# )r   )rM   )Úimport_submodule)Údynamo_minifier_backendNz&dynamo_minifier_backend failed to load)Ú rM   ÚutilsrQ   Úrepro.after_dynamorR   r.   Ú_discover_entrypoint_backends)rM   rQ   rR   s      r   r;   r;   £   s+   € åÝ(á�XÔå<àÒ&ÜÐEÓFÐFä!Ö#r   c                ó   € V ^8„  d   QhRR/# rO   r   )r   s   "r   r   r   ³   s   € ÷ 	9ñ 	9 tñ 	9r   c                  ó¤   € ^ RI Hp  RpV ! VR7      pVP                   Uu/ uF  q3W#,          bK  	  ppV F  pWE,          \        V&   K  	  R# u upi )é    )Úentry_pointsÚtorch_dynamo_backends)ÚgroupN)Úimportlib.metadatarZ   Únamesr1   )rZ   Ú
group_nameÚepsr%   Úeps_dictÚbackend_names         r   rV   rV   ²   sN   € õ 0à(€JÙ
˜ZÔ
(€Cà,/¯IªIÓ6©I D�c•i’©I€HÐ6Û ˆØ"*Õ"8Œ	�,Óó !ùò 7s    Ac                ó0   € V ^8„  d   QhR\         R\        /# r4   )r'   Úbool)r   s   "r   r   r   ¿   s   € ÷ ñ ¬
ð ´tñ r   c                ó  € \        4        V \        P                  4       9   d   R# \        V \        P
                  4      '       d   R# \        V \        P                  4      '       d"   V P                  \        P                  4       9   # R# )z‹
Check if the given compiler function is a registered backend.
Custom backends (user-provided callables not in the registry) return False.
TF)r;   r0   Úvaluesr:   r   Ú_TorchCompileInductorWrapperÚ_TorchCompileWrapperr$   )r$   s   &r   Ú_is_registered_backendri   ¿   sg   € ô „Nð ”m×*Ñ*Ó,Ô,Ùä�+œu×AÑA×BÒBÙô �+œu×9Ñ9×:Ò:Ø×&Ñ&¬-×*>Ñ*>Ó*@Ñ@Ð@ár   c                óL   € V ^8„  d   QhR\         \        ,          R,          RR/# )r   ÚbackendNr   r5   )r   s   "r   r   r   Õ   s$   € ÷ ñ ¤¤zÕ!1°DÕ!8ð ¸Tñ r   c                ó–   € V f   Rs R# \        V \        4      '       g)   \        V 4      '       g   \	        R\        V 4       24      hV s R# )zˆSet the default backend used by torch.compile when no backend is explicitly specified.

Pass None to reset to the default ("inductor").
Nr"   z*backend must be a string or callable, got )Ú_default_backendr:   r(   r-   Ú	TypeErrorr/   )rk   s   &r   Úset_default_backendro   Õ   sF   € ð ‚Ø%ÐÙÜ�gœs×#Ò#¬H°W×,=Ò,=ÜÐDÄTÈ'Ã]ÀOÐTÓUÐUØÒr   c                ó:   € V ^8„  d   QhR\         \        ,          /# rD   r5   )r   s   "r   r   r   ã   s   € ÷ ñ œS¤:Õ-ñ r   c                 ó   € \         # )z5Return the current default backend for torch.compile.)rm   r   r   r   Úget_default_backendrr   ã   s   € äÐr   c                ó\  € V ^8„  d   Qh/ ^ \         9   d"   \        \        \        R,          3,          ;R&   ^\         9   d   \        \        \        3,          ;R&   ^\         9   d(   \        \        \
        \        R3,          3,          ;R&   ^\         9   d   \        \        ,          ;R&   # )r   Nr1   r0   .r2   rm   )Ú__conditional_annotations__Údictr(   r   r'   r   )r   s   "r   r   r      s‹   € ÷ ;ñ ;÷` -Ò ,Œ4””Z $Õ&Ð&Õ'Ñ ,ña;÷b *Ò )Œt”Cœ�OÕ$Ñ )ñc;÷d /Ò .Œt”Cœœs C˜x�Ð(Õ)Ñ .ñe;÷f 0Ò /”#œ
Õ"Ñ /òg;r   )NNr   )Údebug)Úexperimental))rv   rw   )'rt   Ú__doc__r*   ÚloggingÚcollections.abcr   r   r]   r   Útypingr   r   r   r   Ú	getLoggerr   Úlogr	   ÚGraphModulerE   r   r'   r1   r0   r2   rm   r,   r+   Úregister_debug_backendÚregister_experimental_backendrB   r?   Úcacher;   rV   ri   ro   rr   r   )rt   s   @r   Ú<module>r‚      s  øðö;óz Û ß .Ý )ß  ã Ý ð ×Ò˜Ó!€ôM�ô Mð �r—~‘~ t¨E¯L©LÕ'9Ð:¸JÐFÕG€
à*,€	Ó ,Ø')€Ó )Ø,.€Ó .Ø%/Ð Ó /÷ð> #×*Ò*Ð+;À*ÔMÐ Ø )× 1Ò 1ØÐ,ô!Ð õ
÷,ð" ‡�ô$ó ð$ð ‡�ô	9ó ð	9õõ,÷r   