+
    ړLj                        ^RI Ht ^ RIHt ^ RIHt ]P                  ! R4      tR R ltR R lt	R	 R
 lt
R R lt]P                  ]! . R3OR7      ]
! R4      R4R l4       4       4       t]P                  ]! RR.R7      ]	! R4      ]P                  R4R l4       4       4       4       t]P                  ]! RR.R7      ]	! R4      ]P                  R4R l4       4       4       4       t]P                  ]! RR.R7      ]	! R4      ]P                  R4R l4       4       4       4       t]P                  ]! RR.R7      ]	! R4      ]P                  R4R l4       4       4       4       t]P                  ]! RR.R7      ]	! R4      ]P                  R4R l4       4       4       4       t]P                  ]! RR.R7      ]	! R4      ]P                  R4R l4       4       4       4       t]P                  ]! RR.R7      ]	! R4      ]P                  R4R  l4       4       4       4       t]P                  ]! R.R7      ]	! R!4      ]P                  R4R" l4       4       4       4       t]P                  ]! RR.R7      ]	! R#4      ]P                  R4R$ l4       4       4       4       t]P                  ]P                  ]	! R%4      R4R& l4       4       4       t]P                  ]
! R'4      R5R( l4       4       t]P                  ]! R.R7      ]
! R)4      R4R* l4       4       4       t]P                  ]! RR.R7      ]	! R+4      ]P                  R4R, l4       4       4       4       t]P                  ]! RR.R7      ]	! R-4      ]P                  R4R. l4       4       4       4       t]P                  ]! RR.R7      ]	! R/4      ]P                  R4R0 l4       4       4       4       t]P                  ]! R14      R4R2 l4       4       tR# )6   )corewraps)ListTc                F    V ^8  d   QhR\         \        ,          R\        /# )   dtypesreturn)r   strr   )formats   "@/app/.local/lib/python3.14/site-packages/triton/language/math.py__annotate__r      s      c q     c                   a  V 3R lpV# )aT  
We're following libdevice's convention to check accepted data types for math functions.
It is not a good practice to support all data types as accelerators/GPUs don't support
many float16 and bfloat16 math operations.
We should let the users know that they are using and invoke explicit cast to convert
the data type to the supported one.
c                 4   <a  \        S 4      VV 3R  l4       pV# )c                    < \        V 4      \        VP                  4       4      ,           pV Uu. uF'  p\        V\        P                  4      '       g   K%  VNK)  	  up FW  pVP
                  P                  P                  S9  g   K*  \        R S RVP
                  P                  P                   24      h	  S! V / VB # u upi )zExpected dtype z	 but got )	listvalues
isinstancer   tensortypescalarname
ValueError)argskwargsall_argsaargr
   fns   *,   r   check,_check_dtype.<locals>.wrapper.<locals>.check   s     DzD$99H#+J8az!T[[/I8J88??''v5$vhiH\H\G]%^__ K t&v&& Ks   "CCr   )r!   r"   r
   s   f r   wrapper_check_dtype.<locals>.wrapper   s     	r	' 
	' r    )r
   r$   s   f r   _check_dtyper'      s     Nr   c                h    V ^8  d   QhR\         R\        P                  \        .\        3,          /# r	   r   r   r   r   Callabler   )r   s   "r   r   r   !   s)       qc1f(= r   c                    a  R  V 3R llpV# )c                0    V ^8  d   QhR\         R\         /# r	   funcr   r   )r   s   "r   r   +_add_math_1arg_docstr.<locals>.__annotate__#   s       q r   c                 :   < R pVP                  SR7      V n        V # )zk
    Computes the element-wise {name} of :code:`x`.

    :param x: the input values
    :type x: Block
    r   r   __doc__r/   docstrr   s   & r   
_decorator)_add_math_1arg_docstr.<locals>._decorator#   s#     }}$}/r   r&   r   r8   s   f r   _add_math_1arg_docstrr;   !   s      r   c                h    V ^8  d   QhR\         R\        P                  \        .\        3,          /# r)   r*   )r   s   "r   r   r   0   s)       qc1f(= r   c                    a  R  V 3R llpV# )c                0    V ^8  d   QhR\         R\         /# r.   r0   )r   s   "r   r   +_add_math_2arg_docstr.<locals>.__annotate__2   s     
 
 
q 
r   c                 :   < R pVP                  SR7      V n        V # )z
    Computes the element-wise {name} of :code:`x` and :code:`y`.

    :param x: the input values
    :type x: Block
    :param y: the input values
    :type y: Block
    r3   r4   r6   s   & r   r8   )_add_math_2arg_docstr.<locals>._decorator2   s#     }}$}/r   r&   r:   s   f r   _add_math_2arg_docstrrB   0   s    
 
 r   c                h    V ^8  d   QhR\         R\        P                  \        .\        3,          /# r)   r*   )r   s   "r   r   r   A   s)       qc1f(= r   c                    a  R  V 3R llpV# )c                0    V ^8  d   QhR\         R\         /# r.   r0   )r   s   "r   r   +_add_math_3arg_docstr.<locals>.__annotate__C   s       q r   c                 :   < R pVP                  SR7      V n        V # )z
    Computes the element-wise {name} of :code:`x`, :code:`y`, and :code:`z`.

    :param x: the input values
    :type x: Block
    :param y: the input values
    :type y: Block
    :param z: the input values
    :type z: Block
    r3   r4   r6   s   & r   r8   )_add_math_3arg_docstr.<locals>._decoratorC   s#    	 }}$}/r   r&   r:   s   f r   _add_math_3arg_docstrrI   A   s      r   )r
   z-most significant N bits of the 2N-bit productNc                    VP                  V 4      p VP                  V4      p\        P                  ! WV4      w  r\        P                  ! VP                  P                  V P                  VP                  4      V P                  4      # N)	to_tensorr   binary_op_type_legalizationr   buildercreate_umulhihandler   xy	_semantics   &&&r   umulhirU   T   sh     	AAAA++A)<DA;;y((66qxxJAFFSSr   fp32fp64exponentialc                     VP                  V 4      p \        P                  ! VP                  P	                  V P
                  4      V P                  4      # rK   )rL   r   r   rN   
create_exprP   r   rR   rT   s   &&r   expr\   ^   >    
 	AA;;y((33AHH=qvvFFr   zexponential (base 2)c                     VP                  V 4      p \        P                  ! VP                  P	                  V P
                  4      V P                  4      # rK   )rL   r   r   rN   create_exp2rP   r   r[   s   &&r   exp2r`   g   >    
 	AA;;y((44QXX>GGr   znatural logarithmc                     VP                  V 4      p \        P                  ! VP                  P	                  V P
                  4      V P                  4      # rK   )rL   r   r   rN   
create_logrP   r   r[   s   &&r   logrd   p   r]   r   zlogarithm (base 2)c                     VP                  V 4      p \        P                  ! VP                  P	                  V P
                  4      V P                  4      # rK   )rL   r   r   rN   create_log2rP   r   r[   s   &&r   log2rg   y   ra   r   cosinec                     VP                  V 4      p \        P                  ! VP                  P	                  V P
                  4      V P                  4      # rK   )rL   r   r   rN   
create_cosrP   r   r[   s   &&r   cosrk      r]   r   sinec                     VP                  V 4      p \        P                  ! VP                  P	                  V P
                  4      V P                  4      # rK   )rL   r   r   rN   
create_sinrP   r   r[   s   &&r   sinro      r]   r   zfast square rootc                     VP                  V 4      p \        P                  ! VP                  P	                  V P
                  4      V P                  4      # rK   )rL   r   r   rN   create_sqrtrP   r   r[   s   &&r   sqrtrr      ra   r   z?precise square root (rounding to nearest wrt the IEEE standard)c                     VP                  V 4      p \        P                  ! VP                  P	                  V P
                  4      V P                  4      # rK   )rL   r   r   rN   create_precise_sqrtrP   r   r[   s   &&r   sqrt_rnru      s>    
 	AA;;y((<<QXXFOOr   zinverse square rootc                     VP                  V 4      p \        P                  ! VP                  P	                  V P
                  4      V P                  4      # rK   )rL   r   r   rN   create_rsqrtrP   r   r[   s   &&r   rsqrtrx      >    
 	AA;;y((55ahh?HHr   zabsolute valuec                    VP                  V 4      p V P                  pVP                  4       '       d   \        P                  ! V P
                  ^\        P                  VR7      p\        P                  ! VP                  P                  V P                  VP                  4      V P                  4      # VP                  4       '       dE   \        P                  ! VP                  P                  V P                  4      V P                  4      # VP                  4       '       dE   \        P                  ! VP                  P                  V P                  4      V P                  4      # VP!                  4       '       d   V # Q RT 24       h)   )rT   zUnexpected dtype )rL   dtypeis_fp8e4b15r   fullshapeint8r   rN   
create_andrP   r   is_floatingcreate_fabsis_int_signedcreate_iabsis_int_unsigned)rR   rT   r|   masks   &&  r   absr      s    	AAGGEyy$		YG{{9,,77$++NPQPVPVWW					{{9,,88BAFFKK					{{9,,88BAFFKK				 	 1)%11ur   zfast divisionc                     \         P                  ! V4      pVP                  V 4      p VP                  V4      pVP                  WV4      # rK   )r   _unwrap_if_constexprrL   fdiv)rR   rS   ieee_roundingrT   s   &&&&r   r   r      sE     --m<MAAAA>>!..r   z<precise division (rounding to nearest wrt the IEEE standard)c                    VP                  V 4      p VP                  V4      p\        P                  ! WV4      w  r\        P                  ! VP                  P                  V P                  VP                  4      V P                  4      # rK   )rL   r   rM   r   rN   create_precise_divfrP   r   rQ   s   &&&r   div_rnr      sk     	AAAA++A)<DA;;y((<<QXXqxxPRSRXRXYYr   zerror functionc                     VP                  V 4      p \        P                  ! VP                  P	                  V P
                  4      V P                  4      # rK   )rL   r   r   rN   
create_erfrP   r   r[   s   &&r   erfr      r]   r   floorc                     VP                  V 4      p \        P                  ! VP                  P	                  V P
                  4      V P                  4      # rK   )rL   r   r   rN   create_floorrP   r   r[   s   &&r   r   r      ry   r   ceilc                     VP                  V 4      p \        P                  ! VP                  P	                  V P
                  4      V P                  4      # rK   )rL   r   r   rN   create_ceilrP   r   r[   s   &&r   r   r      ra   r   zfused multiply-addc                    VP                  V 4      p VP                  V4      pVP                  V4      p\        P                  ! WV4      w  r\        P                  ! W V4      w  r \        P                  ! W!V4      w  r!\        P                  ! VP                  P                  V P                  VP                  VP                  4      V P                  4      # rK   )rL   r   rM   r   rN   
create_fmarP   r   )rR   rS   zrT   s   &&&&r   fmar      s     	AAAAAA++A)<DA++A)<DA++A)<DA;;y((33AHHahhQSTSYSYZZr   )int32int64uint32uint64rK   )FN) r   	functoolsr   typingr   TypeVarr   r'   r;   rB   rI   builtinrU   _tensor_member_fnr\   r`   rd   rg   rk   ro   rr   ru   rx   r   r   r   r   r   r   r   r&   r   r   <module>r      sy     LL2"& ;<FGT H = T ff%&}%G  & ' G
 ff%&-.H  / ' H
 ff%&*+G  , ' G
 ff%&+,H  - ' H
 ff%&x G  ! ' G
 ff%&vG   ' G
 ff%&)*H  + ' H
 fXXYP  Z  P
 ff%&,-I  . ' I
 '(2 )  2  '/ ( / fXUVZ W  Z ff%&'(G  ) ' G
 ff%&wI    ' I
 ff%&vH   ' H
 +,[ - [r   