
    %Vji                    2   d dl mZ d dlZd dlZd dlZd dlmZ d dlmZm	Z	m
Z
 d dlmZmZ e
r
d dlZd dlmZ ej                            d          dk    r ed          d'd            Znd'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 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 dS )(    )annotationsN)	lru_cache)AnyOptionalTYPE_CHECKING)BackendCompilerFailedShortenTraceback)_CudaDevicePropertiesTORCHINDUCTOR_WRITE_MISSING_OPS1targetr   returnNonec                    t          t          j                     dd          5 }|                    t	          |           dz              d d d            d S # 1 swxY w Y   d S )Nz/missing_ops.txta
)opentempfile
gettempdirwritestr)r   fds     M/root/voice-cloning/.venv/lib/python3.11/site-packages/torch/_inductor/exc.py_record_missing_opr      s    X(**<<<cBB 	)bHHS[[4'(((	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	)s   &AAAc                    d S N )r   s    r   r   r      s        c                  &    e Zd Zedd	            Zd
S )OperatorIssuer   r   args	list[Any]kwargsdict[str, Any]r   r   c                    d|  gd t          |          D             z   }|r|                    d|            t          j        d                    |          d          S )Nztarget: c                $    g | ]\  }}d | d| S )zargs[z]: r   ).0iargs      r   
<listcomp>z.OperatorIssue.operator_str.<locals>.<listcomp>!   s:     )
 )
 )
$*AsA#)
 )
 )
r   zkwargs: r   z  )	enumerateappendtextwrapindentjoin)r   r!   r#   liness       r   operator_strzOperatorIssue.operator_str   s|    $F$$% )
 )
.7oo)
 )
 )
 
  	.LL,F,,---tyy//666r   N)r   r   r!   r"   r#   r$   r   r   )__name__
__module____qualname__staticmethodr1   r   r   r   r    r       s2        7 7 7 \7 7 7r   r    c                        e Zd Zd
 fd	Z xZS )MissingOperatorWithoutDecompr   r   r!   r"   r#   r$   r   r   c                    t          |           t                                          d|                     |||                      d S )Nzmissing lowering
)r   super__init__r1   selfr   r!   r#   	__class__s       r   r:   z%MissingOperatorWithoutDecomp.__init__*   sJ    6"""Wd.?.?f.U.UWWXXXXXr   r   r   r!   r"   r#   r$   r   r   r2   r3   r4   r:   __classcell__r=   s   @r   r7   r7   )   sG        Y Y Y Y Y Y Y Y Y Yr   r7   c                        e Zd Zd
 fd	Z xZS )MissingOperatorWithDecompr   r   r!   r"   r#   r$   r   r   c                    t          |           t                                          d|                     |||           t	          j        d| d          z              d S )Nzmissing decomposition
z9

                There is a decomposition available for z in
                torch._decomp.get_decompositions().  Please add this operator to the
                `decompositions` list in torch._inductor.decomposition
                )r   r9   r:   r1   r-   dedentr;   s       r   r:   z"MissingOperatorWithDecomp.__init__0   s    6"""Od&7&7f&M&MOOo8>   
	
 
	
 
	
 
	
 
	
r   r>   r?   rA   s   @r   rC   rC   /   s=        
 
 
 
 
 
 
 
 
 
r   rC   c                        e Zd Zd fdZ xZS )LoweringExceptionexc	Exceptionr   r   r!   r"   r#   r$   r   r   c                    t                                          t          |          j         d| d|                     |||                      d S )N: r   )r9   r:   typer2   r1   )r<   rH   r   r!   r#   r=   s        r   r:   zLoweringException.__init__@   s_     	Cyy!UUSUUD,=,=fdF,S,SUU	
 	
 	
 	
 	
r   )
rH   rI   r   r   r!   r"   r#   r$   r   r   r?   rA   s   @r   rG   rG   ?   =        
 
 
 
 
 
 
 
 
 
r   rG   c                      e Zd ZdS )SubgraphLoweringExceptionNr2   r3   r4   r   r   r   rO   rO   H           Dr   rO   c                        e Zd Zd fdZ xZS )InvalidCxxCompilerr   r   c                    ddl m} t                                          d|j         d|j        j                    d S )N   )configz!No working C++ compiler found in z
.cpp.cxx: ) rV   r9   r:   r2   cppcxx)r<   rV   r=   s     r   r:   zInvalidCxxCompiler.__init__M   sT    [[[6:>[[	
 	
 	
 	
 	
r   )r   r   r?   rA   s   @r   rS   rS   L   rM   r   rS   c                        e Zd Zd fdZ xZS )CppWrapperCodegenErrormsgr   r   r   c                P    t                                          d|            d S )NzC++ wrapper codegen error: r9   r:   )r<   r\   r=   s     r   r:   zCppWrapperCodegenError.__init__V   s*    <s<<=====r   )r\   r   r   r   r?   rA   s   @r   r[   r[   U   s=        > > > > > > > > > >r   r[   c                  (     e Zd Zd
 fdZdd	Z xZS )CppCompileErrorcmd	list[str]outputr   r   r   c                R   t          |t                    r|                    d          }|| _        || _        t                                          t          j        d          	                                
                    d                    |          |                     d S )Nzutf-8z
                    C++ compile error

                    Command:
                    {cmd}

                    Output:
                    {output}
                 )ra   rc   )
isinstancebytesdecodera   rc   r9   r:   r-   rE   stripformatr/   )r<   ra   rc   r=   s      r   r:   zCppCompileError.__init__[   s    fe$$ 	,]]7++FO
 
 UWWVfV55	
 	
 	
 	
 	
r   "tuple[type, tuple[list[str], str]]c                ,    | j         | j        | j        ffS r   )r=   ra   rc   )r<   s    r   
__reduce__zCppCompileError.__reduce__r   s    4; 788r   )ra   rb   rc   r   r   r   )r   rk   )r2   r3   r4   r:   rm   r@   rA   s   @r   r`   r`   Z   sQ        
 
 
 
 
 
.9 9 9 9 9 9 9 9r   r`   c                      e Zd ZdS )CUDACompileErrorNrP   r   r   r   ro   ro   v   rQ   r   ro   c                        e Zd Zd fdZ xZS )TritonMissingfirst_useful_frameOptional[types.FrameType]r   r   c                N    t                                          d|           d S )NzCannot find a working triton installation. Either the package is not installed or it is too old. More information on installing Triton can be found at: https://github.com/triton-lang/tritonrr   r^   )r<   rr   r=   s     r   r:   zTritonMissing.__init__{   s9    k  2	 	 	
 	
 	
 	
 	
r   )rr   rs   r   r   r?   rA   s   @r   rq   rq   z   s=        
 
 
 
 
 
 
 
 
 
r   rq   c                        e Zd Zd fdZ xZS )	GPUTooOldForTritondevice_propsr
   rr   rs   r   r   c                ~    t                                          d|j         d|j         d|j         |           d S )NzFound z which is too old to be supported by the triton GPU compiler, which is used as the backend. Triton only supports devices of CUDA Capability >= 7.0, but your device is of CUDA capability .ru   )r9   r:   namemajorminor)r<   rx   rr   r=   s      r   r:   zGPUTooOldForTriton.__init__   sp    
 	_\& _ _5A5G_ _JVJ\_ _  2	 	 	
 	
 	
 	
 	
r   )rx   r
   rr   rs   r   r   r?   rA   s   @r   rw   rw      s=        

 

 

 

 

 

 

 

 

 

r   rw   c                      e Zd ZdZd
dZd	S )InductorErrorinductorinner_exceptionrI   rr   rs   r   r   c                p    || _         t          j        | t          |          j         d| |           d S )NrK   ru   )r   r	   r:   rL   r2   )r<   r   rr   s      r   r:   zInductorError.__init__   sR    
  /!O$$-BBBB1	
 	
 	
 	
 	
 	
r   N)r   rI   rr   rs   r   r   )r2   r3   r4   backend_namer:   r   r   r   r   r      s-        L

 

 

 

 

 

r   r   )r   r   r   r   )!
__future__r   osr   r-   	functoolsr   typingr   r   r   torch._dynamo.excr   r	   types
torch.cudar
   environgetr   RuntimeErrorr    r7   rC   rG   rO   rS   r[   r`   ro   rq   rw   r   r   r   r   <module>r      s   " " " " " " 				         / / / / / / / / / / E E E E E E E E  1LLL000000:>>344;;Yt__) ) ) _) )   7 7 7 7 7L 7 7 7Y Y Y Y Y= Y Y Y
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
	 	 	 	 	 	 	 	
 
 
 
 
 
 
 
> > > > >\ > > >
9 9 9 9 9l 9 9 98	 	 	 	 	 	 	 	
 
 
 
 
$ 
 
 

 
 
 
 
) 
 
 

 
 
 
 
) 
 
 
 
 
r   