
    N j                       S SK Jr  S SKrS SKrS SKrS SKJr  S SKJrJ	r	J
r
  S SKJrJr  \
(       a
  S SKrS SKJr  \R"                  R%                  S5      S:X  a  \" S5      S#S	 j5       rOS#S
 jr " S S\5      r " S S\5      r " S S\5      r " S S\5      r " S S\5      r " S S\5      r " S S\5      r " S S\5      r " S S\5      r " S S\5      r " S S \5      r " S! S"\5      r g)$    )annotationsN)	lru_cache)AnyOptionalTYPE_CHECKING)BackendCompilerFailedShortenTraceback)_CudaDevicePropertiesTORCHINDUCTOR_WRITE_MISSING_OPS1c                    [        [        R                  " 5        S3S5       nUR                  [	        U 5      S-   5        S S S 5        g ! , (       d  f       g = f)Nz/missing_ops.txta
)opentempfile
gettempdirwritestr)targetfds     d/root/GenerationalWealth/GenerationalWealth/venv/lib/python3.13/site-packages/torch/_inductor/exc.py_record_missing_opr      sB    X((*++;<cBbHHS[4'( CBBs   A


Ac                    g N )r   s    r   r   r      s        c                  (    \ rS rSr\SS j5       rSrg)OperatorIssue   c           	         SU  3/[        U5       VVs/ s H  u  p4SU SU 3PM     snn-   nU(       a  UR                  SU 35        [        R                  " SR	                  U5      S5      $ s  snnf )Nztarget: zargs[z]: zkwargs: r   z  )	enumerateappendtextwrapindentjoin)r   argskwargsiargliness         r   operator_strOperatorIssue.operator_str   sw    F8$%.7o)
.=FAeA3c#o)
 
 LL8F8,-tyy/66)
s   A/r   N)r   r   r&   	list[Any]r'   dict[str, Any]returnr   )__name__
__module____qualname____firstlineno__staticmethodr+   __static_attributes__r   r   r   r   r      s    7 7r   r   c                  ,   ^  \ rS rSrSU 4S jjrSrU =r$ )MissingOperatorWithoutDecomp)   c                `   > [        U5        [        TU ]	  SU R                  XU5       35        g )Nzmissing lowering
)r   super__init__r+   selfr   r&   r'   	__class__s       r   r;   %MissingOperatorWithoutDecomp.__init__*   s.    6"-d.?.?f.U-VWXr   r   r   r   r&   r-   r'   r.   r/   Noner0   r1   r2   r3   r;   r5   __classcell__r>   s   @r   r7   r7   )   s    Y Yr   r7   c                  ,   ^  \ rS rSrSU 4S jjrSrU =r$ )MissingOperatorWithDecomp/   c                   > [        U5        [        TU ]	  SU R                  XU5       3[        R
                  " SU S35      -   5        g )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   r:   r;   r+   r#   dedentr<   s       r   r;   "MissingOperatorWithDecomp.__init__0   sV    6"%d&7&7f&M%NOoo88>x @
	
r   r   r@   rB   rD   s   @r   rF   rF   /   s    
 
r   rF   c                  H   ^  \ rS rSr S           SU 4S jjjrSrU =r$ )LoweringException?   c           	        > [        U5      R                   SU SU R                  X#U5       3nU(       a	  Xf SU 3-  n[        TU ]  U5        g )N: r   z
Found from : 
 )typer0   r+   r:   r;   )r=   excr   r&   r'   stack_tracemsgr>   s          r   r;   LoweringException.__init__@   sX     c##$Bse2d.?.?f.U-VWU,[M::Cr   r   r   )rQ   	Exceptionr   r   r&   r-   r'   r.   rR   zOptional[str]r/   rA   rB   rD   s   @r   rL   rL   ?   sL     &*  	
  # 
 r   rL   c                      \ rS rSrSrg)SubgraphLoweringExceptionN   r   Nr0   r1   r2   r3   r5   r   r   r   rW   rW   N       r   rW   c                  ,   ^  \ rS rSrSU 4S jjrSrU =r$ )InvalidCxxCompilerR   c                x   > SSK Jn  [        TU ]  SUR                   SUR
                  R                   35        g )N   )configz!No working C++ compiler found in z
.cpp.cxx: ) r`   r:   r;   r0   cppcxx)r=   r`   r>   s     r   r;   InvalidCxxCompiler.__init__S   s1    //@
6::>>JZ[	
r   r   )r/   rA   rB   rD   s   @r   r\   r\   R   s    
 
r   r\   c                  ,   ^  \ rS rSrSU 4S jjrSrU =r$ )CppWrapperCodegenError[   c                *   > [         TU ]  SU 35        g )NzC++ wrapper codegen error: r:   r;   )r=   rS   r>   s     r   r;   CppWrapperCodegenError.__init__\   s    6se<=r   r   )rS   r   r/   rA   rB   rD   s   @r   rf   rf   [   s    > >r   rf   c                  6   ^  \ rS rSrSU 4S jjrSS jrSrU =r$ )CppCompileError`   c                  > [        U[        5      (       a  UR                  S5      nXl        X l        [
        TU ]  [        R                  " S5      R                  5       R                  SR                  U5      US95        g )Nzutf-8z
                    C++ compile error

                    Command:
                    {cmd}

                    Output:
                    {output}
                 cmdoutput)
isinstancebytesdecoderq   rr   r:   r;   r#   rI   stripformatr%   )r=   rq   rr   r>   s      r   r;   CppCompileError.__init__a   se    fe$$]]7+FOO
 UWVfV5	
r   c                J    U R                   U R                  U R                  44$ r   )r>   rq   rr   )r=   s    r   
__reduce__CppCompileError.__reduce__x   s    4;; 788r   rp   )rq   z	list[str]rr   r   r/   rA   )r/   z"tuple[type, tuple[list[str], str]])r0   r1   r2   r3   r;   rz   r5   rC   rD   s   @r   rl   rl   `   s    
.9 9r   rl   c                      \ rS rSrSrg)CUDACompileError|   r   NrY   r   r   r   r}   r}   |   rZ   r   r}   c                  ,   ^  \ rS rSrSU 4S jjrSrU =r$ )TritonMissing   c                "   > [         TU ]  SUS9  g )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first_useful_frameri   )r=   r   r>   s     r   r;   TritonMissing.__init__   s     k  2	 	 	
r   r   )r   Optional[types.FrameType]r/   rA   rB   rD   s   @r   r   r      s    
 
r   r   c                  8   ^  \ rS rSr      SU 4S jjrSrU =r$ )GPUTooOldForTriton   c                p   > [         TU ]  SUR                   SUR                   SUR                   3US9  g )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 .r   )r:   r;   namemajorminor)r=   device_propsr   r>   s      r   r;   GPUTooOldForTriton.__init__   sN     	\&&' (55A5G5G4H,J\J\I]_  2	 	 	
r   r   )r   r
   r   r   r/   rA   rB   rD   s   @r   r   r      s+    
 ,
 6	

 

 
r   r   c                  .    \ rS rSrSr      SS jrSrg)InductorError   inductorc                l    Xl         [        R                  " U [        U5      R                   SU 3US9  g )NrO   r   )inner_exceptionr	   r;   rP   r0   )r=   r   r   s      r   r;   InductorError.__init__   s9    
  /!!O$--.b0AB1	
r   )r   N)r   rU   r   r   r/   rA   )r0   r1   r2   r3   backend_namer;   r5   r   r   r   r   r      s(    L

"

 6

 
	

r   r   )r   r   r/   rA   )!
__future__r   osr   r#   	functoolsr   typingr   r   r   torch._dynamo.excr   r	   types
torch.cudar
   environgetr   RuntimeErrorr   r7   rF   rL   rW   r\   rf   rl   r}   r   r   r   r   r   r   <module>r      s    " 	    / / E 0::>>34;t_) )7L 7Y= Y
 
  	 	
 
>\ >
9l 98	 	
$ 

) 

) 
r   