
    %VjiS                        U d dl mZ d dlmZmZ d dlZd dlmZ	 g dZ
defdZedefd            Zed	ed
edefd            Zedd
edefd            Zedefd            Zedefd            Zdaee	         ed<   ddZdS )    )	lru_cache)OptionalTYPE_CHECKINGN)Library)get_core_countget_nameis_builtis_availableis_macos13_or_neweris_macos_or_newerreturnc                  $    t           j        j        S )zReturn whether PyTorch is built with MPS support.

    Note that this doesn't necessarily mean MPS is available; just that
    if this PyTorch binary were run a machine with working MPS drivers
    and devices, we would be able to use it.
    )torch_C_has_mps     U/root/voice-cloning/.venv/lib/python3.11/site-packages/torch/backends/mps/__init__.pyr	   r	      s     8r   c                  >    t           j                                        S )z7Return a bool indicating if MPS is currently available.)r   r   _mps_is_availabler   r   r   r
   r
      s     8%%'''r   majorminorc                 B    t           j                            | |          S )zHReturn a bool indicating whether MPS is running on given MacOS or newer.r   r   _mps_is_on_macos_or_newer)r   r   s     r   r   r   "   s     8--eU;;;r   c                 B    t           j                            d|           S )zEReturn a bool indicating whether MPS is running on MacOS 13 or newer.   r   )r   s    r   r   r   (   s     8--b%888r   c                  >    t           j                                        S )zReturn Metal device name)r   r   _mps_get_namer   r   r   r   r   .   s     8!!###r   c                  >    t           j                                        S )zReturn GPU core count.

    According to the documentation, one core is comprised of 16 Execution Units.
    One execution Unit has 8 ALUs.
    And one ALU can run 24 threads, i.e. one core is capable of executing 3072 threads concurrently.
    )r   r   _mps_get_core_countr   r   r   r   r   4   s     8'')))r   _libc                      t           t                      sdS ddlm}  ddlm} t          dd          a t                               d|d           t                               d	| d           dS )
z<Register prims as implementation of var_mean and group_norm.Nr   )native_group_norm_backward)native_group_normatenIMPLr%   MPSr$   )r"   r	   torch._decomp.decompositionsr$   torch._refsr%   _Libraryimpl)r$   r%   s     r   _initr-   B   s     xzzGGGGGG------FF##DII!#4e<<<II*,FNNNNNr   )r   )r   N)	functoolsr   
_lru_cachetypingr   r   r   torch.libraryr   r+   __all__boolr	   r
   intr   r   strr   r   r"   __annotations__r-   r   r   r   <module>r7      s   - - - - - - - * * * * * * * *  - - - - - -  $     (d ( ( ( (
 <S < < < < < <
 9 9s 94 9 9 9 9
 $# $ $ $ $
 * * * * *  hx   O O O O O Or   