
    0;ji                     4   d dl mZmZ d dlmZmZ d dlmZ d dlm	Z	m
Z
 d dlmZ  e            ZdZ G d de          Z e            Z e            Z G d	 d
e          Zd Zd Zd Zd Zd Z G d de          Z G d de          Z G d de          Z G d de          Z G d de          Z G d de          Z G d de          Z eed<   eed<   eed<   eed<   eed<   eed<   eed <   e ed!<    ee"          Z!ed         Z"ee!e"<   eee"<   d#S )$    )ABCabstractmethod)DelayedRegistryCPUDispatcher)jit)InternalTargetMismatchErrorNonexistentTargetError)localcpuc                        e Zd Z fdZ xZS )_TargetRegistryc                    	 t                                          |          S # t          $ r] d}d                    d t                                          D                       }t          |                    ||                    d w xY w)Nz7No target is registered against '{}', known targets:
{}
c                 *    g | ]\  }}|d d d| S )z <
   z ->  ).0kvs      U/root/voice-cloning/.venv/lib/python3.11/site-packages/numba/core/target_extension.py
<listcomp>z/_TargetRegistry.__getitem__.<locals>.<listcomp>   sK     D D D#'1a #$3r333333 D D D    )super__getitem__KeyErrorjointarget_registryitemsr	   format)selfitemmsgknown	__class__s       r   r   z_TargetRegistry.__getitem__   s    	L77&&t,,, 	L 	L 	LLCII D D+:+@+@+B+BD D D E EE(D%)@)@AAtK		Ls
    $ A'B)__name__
__module____qualname__r   __classcell__)r$   s   @r   r   r      sA        L L L L L L L L Lr   r   c                   $    e Zd ZdZd Zd Zd ZdS )target_overridezWContext manager to temporarily override the current target with that
       prescribed.c                 T    t          t          dt                    | _        || _        d S )Ntarget)getattr_active_context_active_context_default_orig_targetr,   )r    names     r   __init__ztarget_override.__init__#   s&    #OX$;= =r   c                 (    | j         t          _         d S N)r,   r.   r    s    r   	__enter__ztarget_override.__enter__(   s    !%r   c                 (    | j         t          _        d S r4   )r0   r.   r,   )r    tyvaltbs       r   __exit__ztarget_override.__exit__+   s    !%!2r   N)r%   r&   r'   __doc__r2   r6   r;   r   r   r   r*   r*       sK           
- - -3 3 3 3 3r   r*   c                  8    t          t          dt                    S )zReturns the current target
    r,   )r-   r.   r/   r   r   r   current_targetr>   /   s     ?H.EFFFr   c                     t          | j        j                  dk    r| j        d         j        }n't                              t                      d          }|$d}t          |                    |                    |S )za
    Gets the local target from the call stack if available and the TLS
    override if not.
    r   Nz7The target found is not registered.Given target was {}.)	len	callstack_stackr,   r   getr>   
ValueErrorr   )contextr,   r"   s      r   get_local_targetrF   5   su     7#$$q(("1%, $$^%5%5t<<~&F++,,,r   c                     t           |          S )z<Resolves a target specified as a string to its Target class.)r   )
target_strs    r   resolve_target_strrI   G   s    :&&r   c                 :    t          |           }t          |         S )z6Returns the dispatcher associated with a target string)rI   dispatcher_registry)rH   	target_hws     r   resolve_dispatcher_from_strrM   L   s    ":..Iy))r   c                     t          |          }t          |           }|                    |          st          |||          |S )a  Returns the local target if it is compatible with the given target
    name during a type resolution; otherwise, raises an exception.

    Parameters
    ----------
    tyctx: typing context
    hwstr: str
        target name to check against
    reason: str
        Reason for the resolution. Expects a noun.
    Returns
    -------
    target_hw : Target

    Raises
    ------
    InternalTargetMismatchError
    )rI   rF   inherits_fromr   )tyctxhwstrreasonhw_clazzrL   s        r   _get_local_target_checkedrT   R   sM    ( "%((H ''I""8,, G)&)XFFFr   c                   $    e Zd Zed             ZdS )JitDecoratorc                     t           S r4   )NotImplementedr5   s    r   __call__zJitDecorator.__call__q   s    r   N)r%   r&   r'   r   rY   r   r   r   rV   rV   o   s-          ^  r   rV   c                   (    e Zd ZdZed             ZdS )Targetz Implements a target c                 "    t          | |          S )zAReturns True if this target inherits from 'other' False otherwise)
issubclass)clsothers     r   rO   zTarget.inherits_fromy   s     #u%%%r   N)r%   r&   r'   r<   classmethodrO   r   r   r   r[   r[   v   s3        & & [& & &r   r[   c                       e Zd ZdZdS )GenericzmMark the target as generic, i.e. suitable for compilation on
    any target. All must inherit from this.
    Nr%   r&   r'   r<   r   r   r   rb   rb                 r   rb   c                       e Zd ZdZdS )CPUzMark the target as CPU.
    Nrc   r   r   r   rf   rf                 r   rf   c                       e Zd ZdZdS )GPUzOMark the target as GPU, i.e. suitable for compilation on a GPU
    target.
    Nrc   r   r   r   ri   ri      rd   r   ri   c                       e Zd ZdZdS )CUDAzMark the target as CUDA.
    Nrc   r   r   r   rk   rk      rg   r   rk   c                       e Zd ZdZdS )NPyUfunczMark the target as a ufunc
    Nrc   r   r   r   rm   rm      rg   r   rm   genericgpucudanpyufunc)key_typeN)#abcr   r   numba.core.registryr   r   numba.core.decoratorsr   numba.core.errorsr   r	   	threadingr
   tlsr.   r/   r   r   jit_registryobjectr*   r>   rF   rI   rM   rT   rV   r[   rb   rf   ri   rk   rm   rK   
cpu_targetr   r   r   <module>r|      s   # # # # # # # # > > > > > > > > % % % % % %7 7 7 7 7 7 7 7 " " " " " " #%% 	L 	L 	L 	L 	Lo 	L 	L 	L "/##   3 3 3 3 3f 3 3 3G G G  $' ' '
* * *  :    3   & & & & &S & & &    f       '   
    '       3   
    v   
 %	       &
 %ov666  U#
"/ J Z   r   