§
    OŠtjlç ã                  ód  — d dl mZ d dlZd dlmZ d dlmZ d dlmZ d dl	m
Z
mZmZ d dlZd dlmZmZmZmZmZmZmZ d dlmZ d dlZd	d
lmZ d	dlmZ d dlZd	dlmZ d	dlm Z m!Z!m"Z"m#Z#  ed¦  «        Z$dZ%ej&        Z'dëd„Z(dìd„Z)dìd„Z*d„ Z+díd„Z,e)dîd„¦   «         Z- G d„ d¦  «        Z. G d„ d¦  «        Z/ G d„ d¦  «        Z0 G d „ d!e0¦  «        Z1 G d"„ d#e/¦  «        Z2 e2d ¦  «        Z3d$„ Z4d%„ Z5d&„ Z6 G d'„ d(e0¦  «        Z7e7Z8 G d)„ d*e7¦  «        Z9 G d+„ d,e7¦  «        Z: G d-„ d.e0¦  «        Z; G d/„ d0e7¦  «        Z< e7d1¦  «        Z= e7d2¦  «        Z> e7d3¦  «        Z? e7d4¦  «        Z@ e7d5¦  «        ZA e7d6¦  «        ZB e7d7¦  «        ZC e7d8¦  «        ZD e7d9¦  «        ZE e7d:¦  «        ZF e7d;¦  «        ZG e7d<¦  «        ZH e7d=¦  «        ZI e7d>¦  «        ZJ e7d?¦  «        ZK e7d@¦  «        ZL e7dA¦  «        ZM e7dB¦  «        ZN e7dC¦  «        ZO e9eA¦  «        ZPdïdG„ZQ G dH„ dIe/¦  «        ZRdîdJ„ZS G dK„ dLe/¦  «        ZT G dM„ dN¦  «        ZU G dO„ dPe0¦  «        ZV G dQ„ dRe/¦  «        ZW G dS„ dTeV¦  «        ZX G dU„ dVeW¦  «        ZY ed¬W¦  «         G dX„ dYe0¦  «        ¦   «         ZZdZ„ Z[e)dîd[„¦   «         Z\e)dîd\„¦   «         Z]e)dîd]„¦   «         Z^d^e › d_�e^__        d`„ Z`da„ Zae)dîdb„¦   «         Zbe)dîdc„¦   «         Zce*e)dddœde„¦   «         ¦   «         Zde*e)dddœdðdg„¦   «         ¦   «         Zee*e)dddœdh„¦   «         ¦   «         Zfe)dñdj„¦   «         Zge)dîdk„¦   «         Zhdòdl„Zie*e)dòdódn„¦   «         ¦   «         Zje*e)dddœdo„¦   «         ¦   «         Zke*e)dòdp„¦   «         ¦   «         Zle*e)didddqœdr„¦   «         ¦   «         Zmds„ Zne*e)dîdt„¦   «         ¦   «         Zoe*e)dôdõdx„¦   «         ¦   «         Zpe)ddddeNdfdy„¦   «         Zqe)ddiddeNdfdz„¦   «         Zre)	 	 död}„¦   «         Zse)	 dîd÷d�„¦   «         Zte)	 dîdødƒ„¦   «         Zue*e)dùd„„¦   «         ¦   «         Zve)dîdúd†„¦   «         Zw e(d‡¦  «        e*e)dîdˆ„¦   «         ¦   «         ¦   «         Zxe)	 	 dûdüd�„¦   «         Zydýdþd”„Zze*e) ezd•d¬–¦  «        dÿd—„¦   «         ¦   «         ¦   «         Z{e*e) ezd˜¦  «        �d d™„¦   «         ¦   «         ¦   «         Z|e*e) ezdš¦  «        �d d›„¦   «         ¦   «         ¦   «         Z}e*e) ezdœ¦  «        �d d�„¦   «         ¦   «         ¦   «         Z~e*e) ezdž¦  «        �d dŸ„¦   «         ¦   «         ¦   «         Ze*e) ezd ¦  «        �d d¡„¦   «         ¦   «         ¦   «         Z€e*e) ezd¢¦  «        �d d£„¦   «         ¦   «         ¦   «         Z�e*e) ezd¤¦  «        �d d¥„¦   «         ¦   «         ¦   «         Z‚e)dîd¦„¦   «         Zƒe)�d�dd¨„¦   «         Z„e)�d�dd©„¦   «         Z…e)�d�ddª„¦   «         Z†e)e'j‡        df�dd¬„¦   «         Zˆe)e'j‡        df�dd­„¦   «         Z‰e)e'j‡        df�dd®„¦   «         ZŠ	 	 dÿ�dd²„Z‹ed³„ ¦   «         ZŒe*e)�dd´„¦   «         ¦   «         Z�e)dîdµ„¦   «         ZŽe)�dd¶„¦   «         Z�dî�dd·„Z�e*e)�dd¸„¦   «         ¦   «         Z‘e*e)dÿd¹„¦   «         ¦   «         Z’e*e)dîdº„¦   «         ¦   «         Z“e)d»ddd¼œ�ddÀ„¦   «         Z”e)dîdÁ„¦   «         Z•e)dîdÂ„¦   «         Z–e)dîdÃ„¦   «         Z—e)dîdÄ„¦   «         Z˜e)dîdÅ„¦   «         Z™e)dÆdÇddiddÈœ�ddË„¦   «         Zše)�d	dÌ„¦   «         Z›e)diddÍœdÎ„¦   «         Zœe)�d
dÏ„¦   «         Z�e)	 dî�ddÖ„¦   «         Zž G d×„ dØe/¦  «        ZŸ G dÙ„ dÚe/¦  «        Z  G dÛ„ dÜe/¦  «        Z¡�ddã„Z¢e)	 dî�ddä„¦   «         Z£då„ Z¤dæ„ Z¥ e¦¦   «         Z§dç„ Z¨e)e§ddèœdé„¦   «         Z©e)e§ddèœdê„¦   «         ZªdS (  é    )ÚannotationsN)Úwarn)Úcontextmanager)ÚEnum)ÚpartialÚwrapsÚcached_property)ÚUnionÚCallableÚListÚSequenceÚTypeVarÚOptionalÚTuple)Ú	dataclassé   )Úknobs)ÚJITCallable)Úir)ÚTRITON_MAX_TENSOR_NUMELÚvalidate_block_shapeÚget_primitive_bitwidthÚ_tuple_createÚTÚ__triton_builtin__Tc                óJ   ‡ — t          ‰ t          ¦  «        rˆ fd„S |‰ _        ‰ S )z9If the result of this function is unused, throw an error.c                ó$   •— t          | ‰¦  «        S ©N)Úmust_use_result)ÚfnÚxs    €úR/var/www/html/CA-Chatbot/venv/lib/python3.11/site-packages/triton/language/core.pyú<lambda>z!must_use_result.<locals>.<lambda>   s   ø€ �?¨2¨qÑ1Ô1€ ó    )Ú
isinstanceÚstrÚ_must_use_result)r!   Úss   ` r"   r   r      s1   ø€ å�!•SÑÔð 3Ø1Ð1Ð1Ð1Ð2Ø€AÔØ€Hr$   r    Úreturnc                ó¼   ‡ — t          ‰ ¦  «        sJ ‚t          ‰ ¦  «        ˆ fd„¦   «         }t          |t          d¦  «         t	          j        ‰ ¦  «        |_        |S )zMark a function as a builtin.c                 óJ   •— d|vs|d         €t          d¦  «        ‚ ‰| i |¤ŽS )NÚ	_semanticzeDid you forget to add @triton.jit ? (`_semantic` argument must be provided outside of JIT functions.)©Ú
ValueError©ÚargsÚkwargsr    s     €r"   Úwrapperzbuiltin.<locals>.wrapper&   sH   ø€ à˜fÐ$Ð$¨¨{Ô(;Ð(CÝð añ bô bð bàˆr�4Ð"˜6Ð"Ð"Ð"r$   T)Úcallabler   ÚsetattrÚTRITON_BUILTINÚinspectÚ	signature)r    r2   s   ` r"   Úbuiltinr8   "   si   ø€ å�B‰<Œ<ÐÐˆ<å
ˆ2�Y„Yð#ð #ð #ð #ñ „Yð#õ ˆG•^ TÑ*Ô*Ð*ÝÔ)¨"Ñ-Ô-€GÔà€Nr$   c                óÔ  ‡ — t          ‰ ¦  «        sJ ‚t          j        ‰ ¦  «        }t          |j                             ¦   «         ddhz
  ¦  «        dk    }‰ j        sd‰ _        ‰ xj        d‰ j        › d|rdnd› d‰ j        › d	|rd
nd› d�	z  c_        ˆ fd„}t          |j         	                    ¦   «         ¦  «        }|d          
                    d¬¦  «        |d<   | 
                    |¬¦  «        }||_        ||_        d‰ j        › d�|_        t          ‰ ¦  «        rt          |t          d¦  «         t          t          ‰ j        t!          ‰ t"          ¦  «        r‰ n|¦  «         ‰ S )aî  Decorator that adds this free function as a member fn on class tensor.

    When called as a member function on class tensor, the first argument to `fn`
    is `self`, i.e. the tensor object.

    If there are multiple decorators on a function, you probably want this one
    to be the highest one (i.e. furthest from the function's `def`), so it's
    applied last.

    Unfortunately you still need to add a type stub to the body of class tensor
    in order for pytype to know about it.
    r,   Ú
_generatoré   Ú zb
    This function can also be called as a member function on :py:class:`tensor`,
    as :code:`x.ú(z...z)` instead of
    :code:`z(xz, ...z)`.
    c                 ó   •—  ‰| i |¤ŽS r   © r/   s     €r"   r2   z"_tensor_member_fn.<locals>.wrapperM   s   ø€ Øˆr�4Ð"˜6Ð"Ð"Ð"r$   r   Úself©Úname)Ú
parameterszForwards to :py:func:`z` free functionT)r3   r6   r7   ÚlenrC   ÚkeysÚ__doc__Ú__name__ÚlistÚvaluesÚreplaceÚ__signature__Ú
is_builtinr4   r5   Útensorr%   r   )r    Úorig_sigÚhas_argsr2   Ú
new_paramsÚnew_sigs   `     r"   Ú_tensor_member_fnrR   3   s¥  ø€ õ �B‰<Œ<ÐÐˆ<ÝÔ  Ñ$Ô$€Hå�8Ô&×+Ò+Ñ-Ô-°¸lÐ0KÑKÑLÔLÈqÒP€HàŒ:ð ØˆŒ
Ø€J„Jð à”ðð à(0Ð8˜u˜u°bðð ð ŒKðð ð '/Ð6˜7˜7°Bðð ð ñ €J„Jð#ð #ð #ð #ð #õ
 �hÔ)×0Ò0Ñ2Ô2Ñ3Ô3€JØ˜q”M×)Ò)¨vÐ)Ñ6Ô6€Jˆq�MØ×Ò¨*ÐÑ5Ô5€GØ#€GÔØ€GÔØK¨r¬{ÐKÐKÐK€G„Oå�"�~„~ð /Ý��¨Ñ.Ô.Ð.å�F�B”K¥z°"µkÑ'BÔ'BÐ!O  ÈÑPÔPÐPØ€Ir$   c                óˆ   — t          | ¦  «        dk    r.	 t          | d         ¦  «         | d         S # t          $ r Y nw xY w| S )z7Returns x[0] if x has one element and x[0] is iterable.r;   r   )rD   ÚiterÚ	TypeError©r!   s    r"   Ú_unwrap_iterablerW   `   sU   € å
ˆ1�v„v�‚{€{ð	Ý��1”‰JŒJˆJØ�Q”4ˆKøÝð 	ð 	ð 	ØˆDð	øøøð €Hs   •2 ²
?¾?Úboolc                ó.   — t          | t          d¦  «        S )z-Is this a registered triton builtin function?F)Úgetattrr5   ©r    s    r"   rL   rL   v   s   € å�2•~ uÑ-Ô-Ð-r$   c                ó,   — |                      | ¦  «        S r   ©Ú	to_tensor)r!   r,   s     r"   r^   r^   {   s   € à×Ò˜qÑ!Ô!Ð!r$   c                  ó   — e Zd ZdZdS )Úconsta~  
    This class is used as a type annotation to mark pointers to constant data.
    The `store` function cannot be called with a pointer to const. Constness
    is part of the pointer type and the usual Triton type consistency rules
    apply. For example you cannot have a function that returns constant pointer
    in one return statement and non-constant pointer in another.
    N)rG   Ú
__module__Ú__qualname__rF   r?   r$   r"   r`   r`   …   s   € € € € € ðð ð 	€Dr$   r`   c                  ó&   — e Zd ZU dZded<   d
d„Zd	S )Ú
base_valuezLBase class of values that exist in the triton IR (i.e. not constexprs).
    Ú	base_typeÚtypeÚhandlesúList[ir.value]r)   ÚNonec                ó   — t           ‚)znFlatten frontend value into a sequence of mlir handles, which are appended
        to the output list
        ©ÚNotImplementedError©r@   rg   s     r"   Ú_flatten_irzbase_value._flatten_ir•   s
   € õ "Ð!r$   N©rg   rh   r)   ri   )rG   ra   rb   rF   Ú__annotations__rn   r?   r$   r"   rd   rd   �   s=   € € € € € € ðð à€O€O�Oð"ð "ð "ð "ð "ð "r$   rd   c                  ó6   — e Zd Zdd„Zdd„Zdd
„Zdd„Zdd„ZdS )re   r)   rX   c                ó    — t          d¦  «        ‚)NzTypes must implement __eq__rk   ©r@   Úothers     r"   Ú__eq__zbase_type.__eq__ž   s   € Ý!Ð"?Ñ@Ô@Ð@r$   c                ó   — | |k     S r   r?   rs   s     r"   Ú__ne__zbase_type.__ne__¡   ó   € Ø˜E’MÐ"Ð"r$   rg   rh   ÚcursorÚintúTuple[base_value, int]c                ó   — t           ‚)a  Build a frontend value with the current dtype, wrapping a list of existing handles.
        cursor is the index of the first handle relevant to this value, and the function
        should return the updated cursor position after any handles consumed by the created value.
        rk   ©r@   rg   ry   s      r"   Ú_unflatten_irzbase_type._unflatten_ir¤   s
   € õ
 "Ð!r$   r&   c                ó0   — t          d| j        › �¦  «        ‚)NzNYI: Type mangling for type )rl   Ú	__class__©r@   s    r"   Úmanglezbase_type.mangle«   s   € Ý!Ð"QÀÄÐ"QÐ"QÑRÔRÐRr$   Úbuilderú
ir.builderÚoutúList[ir.type]ri   c                ó   — t           ‚r   rk   ©r@   rƒ   r…   s      r"   Ú_flatten_ir_typeszbase_type._flatten_ir_types®   s   € Ý!Ð!r$   N©r)   rX   ©rg   rh   ry   rz   r)   r{   ©r)   r&   ©rƒ   r„   r…   r†   r)   ri   )rG   ra   rb   ru   rw   r~   r‚   r‰   r?   r$   r"   re   re   œ   s€   € € € € € ðAð Að Að Að#ð #ð #ð #ð"ð "ð "ð "ðSð Sð Sð Sð"ð "ð "ð "ð "ð "r$   re   c                  ó@   — e Zd Zd„ Zd„ Zdd„Zd„ Zdd„Zdd„Zdd„Z	dS )Úconstexpr_typec                ó   — || _         d S r   ©Úvalue©r@   r’   s     r"   Ú__init__zconstexpr_type.__init__´   s   € ØˆŒ
ˆ
ˆ
r$   c                óL   — t          |t          ¦  «        o| j        |j        k    S r   )r%   r�   r’   rs   s     r"   ru   zconstexpr_type.__eq__·   s    € Ý˜%¥Ñ0Ô0ÐN°T´ZÀ5Ä;Ò5NÐNr$   r)   r&   c                ó   — d| j         › d�S )Nzconstexpr_type[ú]r‘   r�   s    r"   Ú__repr__zconstexpr_type.__repr__º   s   € Ø. ¤Ð.Ð.Ð.Ð.r$   c                ó*   — t          | j        ¦  «        S r   )Úhashr’   r�   s    r"   Ú__hash__zconstexpr_type.__hash__½   ó   € Ý�D”JÑÔÐr$   c                ó’   — t          | j        d¦  «        r| j                             ¦   «         }nt          | j        ¦  «        }d|› �S )Nr‚   Úc)Úhasattrr’   r‚   Úrepr)r@   Úvals     r"   r‚   zconstexpr_type.mangleÀ   sF   € Ý�4”:˜xÑ(Ô(ð 	#Ø”*×#Ò#Ñ%Ô%ˆCˆCå�t”zÑ"Ô"ˆCØ�3ˆyˆyÐr$   rƒ   r„   r…   r†   ri   c                ó   — d S r   r?   rˆ   s      r"   r‰   z constexpr_type._flatten_ir_typesÇ   ó   € Øˆr$   rg   rh   ry   rz   r{   c                ó.   — t          | j        ¦  «        |fS r   ©Ú	constexprr’   r}   s      r"   r~   zconstexpr_type._unflatten_irÊ   s   € Ý˜œÑ$Ô$ fÐ,Ð,r$   NrŒ   r�   r‹   )
rG   ra   rb   r”   ru   r˜   r›   r‚   r‰   r~   r?   r$   r"   r�   r�   ²   s”   € € € € € ðð ð ðOð Oð Oð/ð /ð /ð /ð ð  ð  ðð ð ð ðð ð ð ð-ð -ð -ð -ð -ð -r$   r�   c                  ó  — e Zd ZdZd„ Zd3d„Zd„ Zd4d
„Zd„ Zd„ Z	d„ Z
d„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd „ Zd!„ Zd"„ Zd#„ Z d$„ Z!d%„ Z"d&„ Z#d'„ Z$d(„ Z%d)„ Z&d*„ Z'd+„ Z(d,„ Z)d-„ Z*d.„ Z+d/„ Z,d0„ Z-d1„ Z.d2S )5r¦   zL
    This class is used to store a value that is known at compile-time.
    c                óž   — t          |t          ¦  «        r|j        }t          |t          ¦  «        °|| _        t          |¦  «        | _        d S r   )r%   r¦   r’   r�   rf   r“   s     r"   r”   zconstexpr.__init__Ó   sI   € Ý˜¥	Ñ*Ô*ð 	 Ø”KˆEõ ˜¥	Ñ*Ô*ð 	 àˆŒ
Ý" 5Ñ)Ô)ˆŒ	ˆ	ˆ	r$   r)   r&   c                ó   — d| j         › d�S )Nz
constexpr[r—   r‘   r�   s    r"   r˜   zconstexpr.__repr__Ù   s   € Ø)˜DœJÐ)Ð)Ð)Ð)r$   c                ó8   — t          | j        | j        f¦  «        S r   )rš   r’   rf   r�   s    r"   r›   zconstexpr.__hash__Ü   s   € Ý�T”Z ¤Ð+Ñ,Ô,Ð,r$   rg   rh   ri   c                ó   — d S r   r?   rm   s     r"   rn   zconstexpr._flatten_irß   r£   r$   c                ó   — | j         S r   r‘   r�   s    r"   Ú	__index__zconstexpr.__index__â   ó
   € ØŒzÐr$   c                óJ   — t          | j        t          |¦  «        z   ¦  «        S r   ©r¦   r’   Ú_unwrap_if_constexprrs   s     r"   Ú__add__zconstexpr.__add__é   ó    € Ý˜œÕ&:¸5Ñ&AÔ&AÑAÑBÔBÐBr$   c                óJ   — t          t          |¦  «        | j        z   ¦  «        S r   ©r¦   r±   r’   rs   s     r"   Ú__radd__zconstexpr.__radd__ì   ó    € ÝÕ-¨eÑ4Ô4°t´zÑAÑBÔBÐBr$   c                óJ   — t          | j        t          |¦  «        z
  ¦  «        S r   r°   rs   s     r"   Ú__sub__zconstexpr.__sub__ï   r³   r$   c                óJ   — t          t          |¦  «        | j        z
  ¦  «        S r   rµ   rs   s     r"   Ú__rsub__zconstexpr.__rsub__ò   r·   r$   c                óJ   — t          | j        t          |¦  «        z  ¦  «        S r   r°   rs   s     r"   Ú__mul__zconstexpr.__mul__õ   r³   r$   c                óJ   — t          | j        t          |¦  «        z  ¦  «        S r   r°   rs   s     r"   Ú__mod__zconstexpr.__mod__ø   r³   r$   c                óJ   — t          t          |¦  «        | j        z  ¦  «        S r   rµ   rs   s     r"   Ú__rmul__zconstexpr.__rmul__û   r·   r$   c                óJ   — t          | j        t          |¦  «        z  ¦  «        S r   r°   rs   s     r"   Ú__truediv__zconstexpr.__truediv__þ   r³   r$   c                óJ   — t          t          |¦  «        | j        z  ¦  «        S r   rµ   rs   s     r"   Ú__rtruediv__zconstexpr.__rtruediv__  r·   r$   c                óJ   — t          | j        t          |¦  «        z  ¦  «        S r   r°   rs   s     r"   Ú__floordiv__zconstexpr.__floordiv__  ó    € Ý˜œÕ';¸EÑ'BÔ'BÑBÑCÔCÐCr$   c                óJ   — t          t          |¦  «        | j        z  ¦  «        S r   rµ   rs   s     r"   Ú__rfloordiv__zconstexpr.__rfloordiv__  s    € ÝÕ-¨eÑ4Ô4¸¼
ÑBÑCÔCÐCr$   c                óL   — t          | j        t          |¦  «        k    ¦  «        S r   r°   rs   s     r"   Ú__gt__zconstexpr.__gt__
  ó    € Ý˜œÕ&:¸5Ñ&AÔ&AÒAÑBÔBÐBr$   c                óL   — t          t          |¦  «        | j        k    ¦  «        S r   rµ   rs   s     r"   Ú__rgt__zconstexpr.__rgt__  ó    € ÝÕ-¨eÑ4Ô4°t´zÒAÑBÔBÐBr$   c                óL   — t          | j        t          |¦  «        k    ¦  «        S r   r°   rs   s     r"   Ú__ge__zconstexpr.__ge__  ó    € Ý˜œÕ';¸EÑ'BÔ'BÒBÑCÔCÐCr$   c                óL   — t          t          |¦  «        | j        k    ¦  «        S r   rµ   rs   s     r"   Ú__rge__zconstexpr.__rge__  ó    € ÝÕ-¨eÑ4Ô4¸¼
ÒBÑCÔCÐCr$   c                óL   — t          | j        t          |¦  «        k     ¦  «        S r   r°   rs   s     r"   Ú__lt__zconstexpr.__lt__  rÍ   r$   c                óL   — t          t          |¦  «        | j        k     ¦  «        S r   rµ   rs   s     r"   Ú__rlt__zconstexpr.__rlt__  rÐ   r$   c                óL   — t          | j        t          |¦  «        k    ¦  «        S r   r°   rs   s     r"   Ú__le__zconstexpr.__le__  rÓ   r$   c                óL   — t          t          |¦  «        | j        k    ¦  «        S r   rµ   rs   s     r"   Ú__rle__zconstexpr.__rle__  rÖ   r$   c                óL   — t          | j        t          |¦  «        k    ¦  «        S r   r°   rs   s     r"   ru   zconstexpr.__eq__"  rÓ   r$   c                óL   — t          | j        t          |¦  «        k    ¦  «        S r   r°   rs   s     r"   rw   zconstexpr.__ne__%  rÓ   r$   c                ó*   — t          | j        ¦  «        S r   )rX   r’   r�   s    r"   Ú__bool__zconstexpr.__bool__(  rœ   r$   c                ó,   — t          | j         ¦  «        S r   r¥   r�   s    r"   Ú__neg__zconstexpr.__neg__+  ó   € Ý˜$œ*˜Ñ%Ô%Ð%r$   c                óJ   — t          | j        t          |¦  «        z  ¦  «        S r   r°   rs   s     r"   Ú__and__zconstexpr.__and__.  r³   r$   c                óH   — t          | j        ot          |¦  «        ¦  «        S r   r°   rs   s     r"   Úlogical_andzconstexpr.logical_and1  s    € Ý˜œÐCÕ(<¸UÑ(CÔ(CÑDÔDÐDr$   c                óJ   — t          | j        t          |¦  «        z  ¦  «        S r   r°   rs   s     r"   Ú__or__zconstexpr.__or__4  r³   r$   c                óJ   — t          | j        t          |¦  «        z  ¦  «        S r   r°   rs   s     r"   Ú__xor__zconstexpr.__xor__7  r³   r$   c                óH   — t          | j        pt          |¦  «        ¦  «        S r   r°   rs   s     r"   Ú
logical_orzconstexpr.logical_or:  s    € Ý˜œÐBÕ';¸EÑ'BÔ'BÑCÔCÐCr$   c                ó,   — t          | j        
 ¦  «        S r   r¥   r�   s    r"   Ú__pos__zconstexpr.__pos__=  rå   r$   c                ó,   — t          | j         ¦  «        S r   r¥   r�   s    r"   Ú
__invert__zconstexpr.__invert__@  rå   r$   c                óJ   — t          | j        t          |¦  «        z  ¦  «        S r   r°   rs   s     r"   Ú__pow__zconstexpr.__pow__C  s    € Ý˜œÕ%9¸%Ñ%@Ô%@Ñ@ÑAÔAÐAr$   c                óJ   — t          t          |¦  «        | j        z  ¦  «        S r   rµ   rs   s     r"   Ú__rpow__zconstexpr.__rpow__F  s    € ÝÕ-¨eÑ4Ô4°d´jÑ@ÑAÔAÐAr$   c                óJ   — t          | j        t          |¦  «        z	  ¦  «        S r   r°   rs   s     r"   Ú
__rshift__zconstexpr.__rshift__I  rÈ   r$   c                óJ   — t          | j        t          |¦  «        z  ¦  «        S r   r°   rs   s     r"   Ú
__lshift__zconstexpr.__lshift__L  rÈ   r$   c                ó,   — t          | j         ¦  «        S r   r¥   r�   s    r"   Ú__not__zconstexpr.__not__O  s   € Ý˜TœZ˜Ñ(Ô(Ð(r$   c                ó*   — t          | j        ¦  «        S r   )rT   r’   r�   s    r"   Ú__iter__zconstexpr.__iter__R  rœ   r$   c                ó   —  | j         |i |¤ŽS r   r‘   )r@   r0   Úkwdss      r"   Ú__call__zconstexpr.__call__U  s   € ØˆtŒz˜4Ð( 4Ð(Ð(Ð(r$   c                óR   — d„ t          |¦  «        D ¦   «         } | j        j        |Ž S )Nc              3  ó4   K  — | ]}t          |¦  «        V — Œd S r   ©r±   ©Ú.0r!   s     r"   ú	<genexpr>z(constexpr.__getitem__.<locals>.<genexpr>Y  s+   è è € ÐHÐH¨AÕ$ QÑ'Ô'ÐHÐHÐHÐHÐHÐHr$   )Ú_normalize_tupler’   Ú__getitem__)r@   r0   s     r"   r
  zconstexpr.__getitem__X  s0   € ØHÐHÕ1AÀ$Ñ1GÔ1GÐHÑHÔHˆØ%ˆtŒzÔ% tÐ,Ð,r$   NrŒ   ro   )/rG   ra   rb   rF   r”   r˜   r›   rn   r­   r²   r¶   r¹   r»   r½   r¿   rÁ   rÃ   rÅ   rÇ   rÊ   rÌ   rÏ   rÒ   rÕ   rØ   rÚ   rÜ   rÞ   ru   rw   râ   rä   rç   ré   rë   rí   rï   rñ   ró   rõ   r÷   rù   rû   rý   rÿ   r  r
  r?   r$   r"   r¦   r¦   Î   s  € € € € € ðð ð*ð *ð *ð*ð *ð *ð *ð-ð -ð -ðð ð ð ðð ð ðCð Cð CðCð Cð CðCð Cð CðCð Cð CðCð Cð CðCð Cð CðCð Cð CðCð Cð CðCð Cð CðDð Dð DðDð Dð DðCð Cð CðCð Cð CðDð Dð DðDð Dð DðCð Cð CðCð Cð CðDð Dð DðDð Dð DðDð Dð DðDð Dð Dð ð  ð  ð&ð &ð &ðCð Cð CðEð Eð EðCð Cð CðCð Cð CðDð Dð Dð&ð &ð &ð&ð &ð &ðBð Bð BðBð Bð BðDð Dð DðDð Dð Dð)ð )ð )ð ð  ð  ð)ð )ð )ð-ð -ð -ð -ð -r$   r¦   c                óP  — t          | t          ¦  «        rd„ | D ¦   «         S t          | t          j        ¦  «        rt	          | d„ | D ¦   «         ¦  «        S t          | t          ¦  «        rt          d„ | D ¦   «         | j        ¦  «        S t          | t          ¦  «        r| j        n| S )Nc                ó,   — g | ]}t          |¦  «        ‘ŒS r?   r  r  s     r"   ú
<listcomp>z(_unwrap_if_constexpr.<locals>.<listcomp>b  s!   € Ð3Ð3Ð3¨AÕ$ QÑ'Ô'Ð3Ð3Ð3r$   c                ó,   — g | ]}t          |¦  «        ‘ŒS r?   r  r  s     r"   r  z(_unwrap_if_constexpr.<locals>.<listcomp>d  s!   € Ð DÐ DÐ D¸QÕ!5°aÑ!8Ô!8Ð DÐ DÐ Dr$   c                ó,   — g | ]}t          |¦  «        ‘ŒS r?   r  r  s     r"   r  z(_unwrap_if_constexpr.<locals>.<listcomp>f  s!   € Ð9Ð9Ð9°!Õ*¨1Ñ-Ô-Ð9Ð9Ð9r$   )r%   rH   ÚbuiltinsÚtupler   rf   r¦   r’   )Úos    r"   r±   r±   `  s«   € Ý�!•TÑÔð 4Ø3Ð3°Ð3Ñ3Ô3Ð3Ý�!•X”^Ñ$Ô$ð FÝ˜QÐ DÐ DÀ!Ð DÑ DÔ DÑEÔEÐEÝ�!•UÑÔð CÝÐ9Ð9°qÐ9Ñ9Ô9¸1¼6ÑBÔBÐBÝ  ¥IÑ.Ô.Ð5ˆ1Œ7ˆ7°AÐ5r$   c                ó„   — t          | ¦  «        }t          |t          t          j        f¦  «        rt	          |¦  «        }|S r   )r±   r%   rH   r  r  )ÚtÚnormalized_tuples     r"   r	  r	  j  s?   € Ý+¨AÑ.Ô.ÐÝÐ"¥T­8¬>Ð$:Ñ;Ô;ð 3Ý Ð!1Ñ2Ô2ÐØÐr$   c           	     óä   — t          | t          ¦  «        rVt          |t          ¦  «        rC| j        j        j        }|j        |k    r)t          d|j        › d|› d| j        › d�¦  «         d S d S d S d S )NzValue z exceeds the maximum bitwidth (z) for type 'z)'. This may result in undefined behavior.)	r%   rM   r¦   rf   ÚscalarÚprimitive_bitwidthr’   r   Údtype)r’   Úshift_valueÚbitwidths      r"   Úcheck_bit_widthr  q  s³   € Ý�%�Ñ Ô ð ¥Z°½YÑ%GÔ%Gð Ø”:Ô$Ô7ˆØÔ Ò(Ð(Ýð X˜Ô*ð  Xð  XÈ8ð  Xð  XÐafÔalð  Xð  Xð  Xñô ð ð ð ðð ð ð à(Ð(r$   c                  ó  ‡ — e Zd Zg d¢Zg d¢Zg d¢Zg d¢ZdgZ G d„ de¦  «        Z	 G d„ d	e¦  «        Z
d
„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Z d „ Z!d!„ Z"d"„ Z#d#„ Z$d$„ Z%d%„ Z&d&„ Z'e(d'„ ¦   «         Z)e(d(„ ¦   «         Z*e(d)„ ¦   «         Z+e(d*„ ¦   «         Z,e(d+„ ¦   «         Z-dGd.„Z.d/„ Z/e0d0„ ¦   «         Z1dHd6„Z2dId8„Z3d9„ Z4d:„ Z5e0dJd<„¦   «         Z6d=„ Z7dKdC„Z8dJˆ fdD„Z9dLdF„Z:ˆ xZ;S )Mr  )Úint8Úint16Úint32Úint64)Úint1Úuint8Úuint16Úuint32Úuint64)	Úfp8e4b15Úfp8e4nvÚfp8e4b8Úfp8e5Úfp8e5b16Úfp16Úbf16Úfp32Úfp64)r,  r-  r.  r/  Úvoidc                  ó   — e Zd ZdZdZdS )údtype.SIGNEDNESSr   r;   N)rG   ra   rb   ÚSIGNEDÚUNSIGNEDr?   r$   r"   Ú
SIGNEDNESSr2  †  s   € € € € € ØˆØˆˆˆr$   r5  c                  ó   — e Zd ZdZdZdZdS )ú
dtype.KINDr   r;   r   N)rG   ra   rb   ÚBOOLEANÚINTEGRALÚFLOATINGr?   r$   r"   ÚKINDr7  Š  s   € € € € € ØˆØˆØˆˆˆr$   r;  c                óŠ  — t          |¦  «        }|| _        |t          j        t          j        z   t          j        z   t          j        z   v s
J |¦   «         ‚t          |¦  «        | _        | j        dz  | _	        |t          j        v r$t          j
        j        | _        | j        | _        d S |t          j        v r$t          j
        j        | _        | j        | _        d S |t          j        v rØ|dk    rd| _        d| _        d S |dk    rd| _        d| _        d S |dk    rd| _        d| _        d S |dk    rd	| _        d| _        d S |d
k    rd	| _        d| _        d S |dk    rd| _        d| _        d S |dk    rd| _        d| _        d S |dk    rd| _        d| _        d S |dk    rd| _        d| _        d S t#          d|› �¦  «        ‚d S )Né   r'  é   é   r(  é   r)  r*  r   r+  é   r,  é
   r-  é   r.  é   r/  é4   iÿ  z Unsupported floating-point type )r±   rB   r  Ú
SINT_TYPESÚ
UINT_TYPESÚFP_TYPESÚOTHER_TYPESr   r  Úitemsizer5  r3  Úint_signednessÚint_bitwidthr4  Úfp_mantissa_widthÚexponent_biasÚRuntimeError)r@   rB   s     r"   r”   zdtype.__init__�  s  € Ý# DÑ)Ô)ˆØˆŒ	Ø•uÔ'­%Ô*:Ñ:½U¼^ÑKÍeÔN_Ñ_Ð_Ð_Ð_ÐaeÑ_Ô_Ð_Ý"8¸Ñ">Ô">ˆÔØÔ/°1Ñ4ˆŒØ•5Ô#Ð#Ð#Ý"'Ô"2Ô"9ˆDÔØ $Ô 7ˆDÔÐÐØ•UÔ%Ð%Ð%Ý"'Ô"2Ô";ˆDÔØ $Ô 7ˆDÔÐÐØ•U”^Ð#Ð#Ø�zÒ!Ð!Ø)*�Ô&Ø%'�Ô"Ð"Ð"Ø˜Ò"Ð"Ø)*�Ô&Ø%&�Ô"Ð"Ð"Ø˜Ò"Ð"Ø)*�Ô&Ø%&�Ô"Ð"Ð"Ø˜’�Ø)*�Ô&Ø%'�Ô"Ð"Ð"Ø˜Ò#Ð#Ø)*�Ô&Ø%'�Ô"Ð"Ð"Ø˜’�Ø)+�Ô&Ø%'�Ô"Ð"Ð"Ø˜’�Ø)*�Ô&Ø%(�Ô"Ð"Ð"Ø˜’�Ø)+�Ô&Ø%(�Ô"Ð"Ð"Ø˜’�Ø)+�Ô&Ø%)�Ô"Ð"Ð"å"Ð#LÀdÐ#LÐ#LÑMÔMÐMð; $Ð#r$   c                ó   — d| j         v S )NÚfp8rA   r�   s    r"   Úis_fp8zdtype.is_fp8º  s   € Ø˜œ	Ð!Ð!r$   c                ó   — | j         dk    S )Nr(  rA   r�   s    r"   Ú
is_fp8e4nvzdtype.is_fp8e4nv½  ó   € ØŒy˜IÒ%Ð%r$   c                ó   — | j         dk    S )Nr)  rA   r�   s    r"   Ú
is_fp8e4b8zdtype.is_fp8e4b8À  rU  r$   c                ó   — | j         dk    S )Nr'  rA   r�   s    r"   Úis_fp8e4b15zdtype.is_fp8e4b15Ã  ó   € ØŒy˜JÒ&Ð&r$   c                ó   — | j         dk    S )Nr*  rA   r�   s    r"   Úis_fp8e5zdtype.is_fp8e5Æ  ó   € ØŒy˜GÒ#Ð#r$   c                ó   — | j         dk    S )Nr+  rA   r�   s    r"   Úis_fp8e5b16zdtype.is_fp8e5b16É  rZ  r$   c                ó   — | j         dk    S )Nr,  rA   r�   s    r"   Úis_fp16zdtype.is_fp16Ì  ó   € ØŒy˜FÒ"Ð"r$   c                ó   — | j         dk    S )Nr-  rA   r�   s    r"   Úis_bf16zdtype.is_bf16Ï  rb  r$   c                ó   — | j         dk    S )Nr.  rA   r�   s    r"   Úis_fp32zdtype.is_fp32Ò  rb  r$   c                ó   — | j         dk    S )Nr/  rA   r�   s    r"   Úis_fp64zdtype.is_fp64Õ  rb  r$   c                ó   — | j         dk    S )Nr"  rA   r�   s    r"   Úis_int1zdtype.is_int1Ø  rb  r$   c                ó   — | j         dk    S )Nr  rA   r�   s    r"   Úis_int8zdtype.is_int8Û  rb  r$   c                ó   — | j         dk    S )Nr  rA   r�   s    r"   Úis_int16zdtype.is_int16Þ  r]  r$   c                ó   — | j         dk    S )Nr   rA   r�   s    r"   Úis_int32zdtype.is_int32á  r]  r$   c                ó   — | j         dk    S )Nr!  rA   r�   s    r"   Úis_int64zdtype.is_int64ä  r]  r$   c                ó   — | j         dk    S )Nr#  rA   r�   s    r"   Úis_uint8zdtype.is_uint8ç  r]  r$   c                ó   — | j         dk    S )Nr$  rA   r�   s    r"   Ú	is_uint16zdtype.is_uint16ê  ó   € ØŒy˜HÒ$Ð$r$   c                ó   — | j         dk    S )Nr%  rA   r�   s    r"   Ú	is_uint32zdtype.is_uint32í  rw  r$   c                ó   — | j         dk    S )Nr&  rA   r�   s    r"   Ú	is_uint64zdtype.is_uint64ð  rw  r$   c                ó(   — | j         t          j        v S r   )rB   r  rH  r�   s    r"   Úis_floatingzdtype.is_floatingó  s   € ØŒy�EœNÐ*Ð*r$   c                ó(   — | j         t          j        v S r   )rB   r  ÚSTANDARD_FP_TYPESr�   s    r"   Úis_standard_floatingzdtype.is_standard_floatingö  s   € ØŒy�EÔ3Ð3Ð3r$   c                ó(   — | j         t          j        v S r   )rB   r  rF  r�   s    r"   Úis_int_signedzdtype.is_int_signedù  ó   € ØŒy�EÔ,Ð,Ð,r$   c                ó(   — | j         t          j        v S r   )rB   r  rG  r�   s    r"   Úis_int_unsignedzdtype.is_int_unsignedü  rƒ  r$   c                óB   — | j         t          j        t          j        z   v S r   )rB   r  rF  rG  r�   s    r"   Úis_intzdtype.is_intÿ  s   € ØŒy�EÔ,­uÔ/?Ñ?Ð?Ð?r$   c                ó*   — |                       ¦   «         S r   )rj  r�   s    r"   Úis_boolzdtype.is_bool  ó   € Ø�|Š|‰~Œ~Ðr$   c                óä   — |                       ¦   «         rt          j        j        S |                      ¦   «         rt          j        j        S |                      ¦   «         sJ ‚t          j        j        S r   )r‰  r  r;  r8  r‡  r9  r}  r:  r�   s    r"   Úkindz
dtype.kind  s[   € à�<Š<‰>Œ>ð 	'Ý”:Ô%Ð%Ø�[Š[‰]Œ]ð 	'Ý”:Ô&Ð&à×#Ò#Ñ%Ô%Ð%Ð%Ð%Ý”:Ô&Ð&r$   c                ó�   — |                       ¦   «         rd| j        dz
  z  dz
  S |                      ¦   «         rd| j        z  dz
  S J ‚)Nr   r;   ©r‚  rL  r…  r�   s    r"   Úget_int_max_valuezdtype.get_int_max_value  sZ   € Ø×ÒÑÔð 	2Ø�tÔ(¨1Ñ,Ñ-°Ñ1Ð1Ø×ÒÑ!Ô!ð 	,Ø�dÔ'Ñ'¨!Ñ+Ð+Øˆur$   c                óv   — |                       ¦   «         rd| j        dz
  z   S |                      ¦   «         rdS J ‚)Nr   r;   r   rŽ  r�   s    r"   Úget_int_min_valuezdtype.get_int_min_value  sJ   € Ø×ÒÑÔð 	/Ø˜Ô)¨AÑ-Ñ.Ð.Ð.Ø×ÒÑ!Ô!ð 	Ø�1Øˆur$   c                ól   — | t           j        t           j        z   t           j        z   t           j        z   v S r   )r  rF  rG  rH  rI  )Útype_strs    r"   Úis_dtypezdtype.is_dtype  s(   € à�5Ô+­eÔ.>Ñ>ÅÄÑOÕRWÔRcÑcÐcÐcr$   c                 ó    — t          d¦  «        ‚)NzNot implemented©rO  r?   r$   r"   Úis_voidzdtype.is_void!  s   € åÐ,Ñ-Ô-Ð-r$   c                 ó   — dS ©NFr?   r?   r$   r"   Úis_blockzdtype.is_block%  ó   € àˆur$   c                 ó   — dS r™  r?   r?   r$   r"   Úis_ptrzdtype.is_ptr)  r›  r$   c                 ó   — dS r™  r?   r?   r$   r"   Úis_constzdtype.is_const-  r›  r$   r)   rX   c                ón   — t          |¦  «        }t          |t          ¦  «        sdS | j        |j        k    S r™  )r±   r%   r  rB   rs   s     r"   ru   zdtype.__eq__1  s5   € Ý$ UÑ+Ô+ˆÝ˜%¥Ñ'Ô'ð 	Ø�5ØŒy˜EœJÒ&Ð&r$   c                ó,   — t          | j        f¦  «        S r   )rš   rB   r�   s    r"   r›   zdtype.__hash__7  s   € Ý�T”Y�MÑ"Ô"Ð"r$   c                ó   — | S r   r?   r�   s    r"   r  zdtype.scalar:  ó   € àˆr$   rƒ   r„   r…   r†   ri   c                óV   — |                      |                      |¦  «        ¦  «         d S r   )ÚappendÚto_irrˆ   s      r"   r‰   zdtype._flatten_ir_types>  s&   € Ø�
Š
�4—:’:˜gÑ&Ô&Ñ'Ô'Ð'Ð'Ð'r$   úir.typec                ór  — | j                              d¦  «        rBt          |d¦  «        r2| j         |j        j        vrt          d| › d|j        j        › �¦  «        ‚| j         dk    r|                     ¦   «         S | j         dk    r|                     ¦   «         S | j         dv r|                     ¦   «         S | j         dv r| 	                    ¦   «         S | j         d	v r| 
                    ¦   «         S | j         d
v r|                     ¦   «         S | j         dk    r|                     ¦   «         S | j         dk    r|                     ¦   «         S | j         dk    r|                     ¦   «         S | j         dk    r|                     ¦   «         S | j         dk    r|                     ¦   «         S | j         dk    r|                     ¦   «         S | j         dk    r|                     ¦   «         S | j         dk    r|                     ¦   «         S | j         dk    r|                     ¦   «         S t          d| › d�¦  «        ‚)NrQ  Úoptionsztype zB not supported in this architecture. The supported fp8 dtypes are r0  r"  )r  r#  )r  r$  )r   r%  )r!  r&  r*  r+  r(  r)  r'  r,  r-  r.  r/  zfail to convert z to ir type)rB   Ú
startswithrŸ   r©  Úsupported_fp8_dtypesr.   Úget_void_tyÚget_int1_tyÚget_int8_tyÚget_int16_tyÚget_int32_tyÚget_int64_tyÚget_fp8e5_tyÚget_fp8e5b16_tyÚget_fp8e4nv_tyÚget_fp8e4b8_tyÚget_fp8e4b15_tyÚget_half_tyÚget_bf16_tyÚget_float_tyÚget_double_ty©r@   rƒ   s     r"   r¦  zdtype.to_irA  sm  € ØŒ9×Ò Ñ&Ô&ð 	iÝ�w 	Ñ*Ô*ð i¨t¬yÀÄÔ@dÐ/dÐ/dÝ ð "h¨ð "hð "hØAHÄÔAeð"hð "hñ iô ið ið Œ9˜ÒÐØ×&Ò&Ñ(Ô(Ð(ØŒY˜&Ò Ð Ø×&Ò&Ñ(Ô(Ð(ØŒYÐ+Ð+Ð+Ø×&Ò&Ñ(Ô(Ð(ØŒYÐ-Ð-Ð-Ø×'Ò'Ñ)Ô)Ð)ØŒYÐ-Ð-Ð-Ø×'Ò'Ñ)Ô)Ð)ØŒYÐ-Ð-Ð-Ø×'Ò'Ñ)Ô)Ð)ØŒY˜'Ò!Ð!Ø×'Ò'Ñ)Ô)Ð)ØŒY˜*Ò$Ð$Ø×*Ò*Ñ,Ô,Ð,ØŒY˜)Ò#Ð#Ø×)Ò)Ñ+Ô+Ð+ØŒY˜)Ò#Ð#Ø×)Ò)Ñ+Ô+Ð+ØŒY˜*Ò$Ð$Ø×*Ò*Ñ,Ô,Ð,ØŒY˜&Ò Ð Ø×&Ò&Ñ(Ô(Ð(ØŒY˜&Ò Ð Ø×&Ò&Ñ(Ô(Ð(ØŒY˜&Ò Ð Ø×'Ò'Ñ)Ô)Ð)ØŒY˜&Ò Ð Ø×(Ò(Ñ*Ô*Ð*ÝÐ=¨DÐ=Ð=Ð=Ñ>Ô>Ð>r$   c                ó   — | j         S r   rA   r�   s    r"   Ú__str__zdtype.__str__g  ó
   € ØŒyÐr$   c                óÀ   — | j                              d¦  «        rd| j         dd …         z   S | j                              d¦  «        rd| j         dd …         z   S | j         S )NÚfpÚfloatr   ÚbfÚbfloat)rB   rª  r�   s    r"   Úcodegen_namezdtype.codegen_namej  sd   € ØŒ9×Ò Ñ%Ô%ð 	Ø˜TœY q r rœ]Ñ*Ð*ØŒY×!Ò! $Ñ'Ô'ð 	Ø˜dœi¨¨¨œmÑ+Ð+à”9Ðr$   r&   c                ó   — | j         S )z"See cache_key_part() in triton.cc.rA   r�   s    r"   Úcache_key_partzdtype.cache_key_partr  s   € ð ŒyÐr$   c                ó0   — d|                       ¦   «         › �S )z4Output of repr needs to be an evaluatable expressionztriton.language.)rÄ  r�   s    r"   r˜   zdtype.__repr__w  s   € à7 $×"3Ò"3Ñ"5Ô"5Ð7Ð7Ð7r$   rg   rh   ry   rz   r{   c                ó8   — t          ||         | ¦  «        |dz   fS ©Nr;   )rM   r}   s      r"   r~   zdtype._unflatten_ir{  s   € Ý�g˜f”o tÑ,Ô,¨f°q©jÐ8Ð8r$   c                óL  •— |                       ¦   «         r7t          j        j        }| j        |k    rdnd}|t          | j        ¦  «        z   S |                      ¦   «         rt          | ¦  «        S |                      ¦   «         rdS t          ¦   «          
                    ¦   «         S )NÚiÚuÚV)r‡  r  r5  r3  rK  r&   rL  r}  r—  Úsuperr‚   )r@   r3  Úprefixr€   s      €r"   r‚   zdtype.mangle~  s“   ø€ Ø�;Š;‰=Œ=ð 	3ÝÔ%Ô,ˆFØ Ô/°6Ò9Ð9�S�S¸sˆFØ�C Ô 1Ñ2Ô2Ñ2Ð2Ø×ÒÑÔð 	Ý�t‘9”9ÐØ�<Š<‰>Œ>ð 	Ø�3Ý‰wŒw�~Š~ÑÔÐr$   Ú
element_tyc                ó2   — |                       ¦   «         rJ ‚|S r   )rš  )r@   rÐ  s     r"   Úwith_element_tyzdtype.with_element_ty‰  s   € Ø—=’=‘?”?Ð"Ð"Ð"ØÐr$   rŠ   r�   )rƒ   r„   r)   r§  rŒ   r‹   )rÐ  r  )<rG   ra   rb   rF  rG  rH  r  rI  r   r5  r;  r”   rR  rT  rW  rY  r\  r_  ra  rd  rf  rh  rj  rl  rn  rp  rr  rt  rv  ry  r{  r}  r€  r‚  r…  r‡  r‰  rŒ  r�  r‘  Ústaticmethodr”  r—  rš  r�  rŸ  ru   r›   Úpropertyr  r‰   r¦  r½  rÄ  rÆ  r˜   r~   r‚   rÒ  Ú__classcell__©r€   s   @r"   r  r    så  ø€ € € € € Ø4Ð4Ð4€JØ@Ð@Ð@€JØfÐfÐf€HØ8Ð8Ð8ÐØ�(€Kðð ð ð ð �Tñ ô ð ðð ð ð ð ˆtñ ô ð ð
)Nð )Nð )NðV"ð "ð "ð&ð &ð &ð&ð &ð &ð'ð 'ð 'ð$ð $ð $ð'ð 'ð 'ð#ð #ð #ð#ð #ð #ð#ð #ð #ð#ð #ð #ð#ð #ð #ð#ð #ð #ð$ð $ð $ð$ð $ð $ð$ð $ð $ð$ð $ð $ð%ð %ð %ð%ð %ð %ð%ð %ð %ð+ð +ð +ð4ð 4ð 4ð-ð -ð -ð-ð -ð -ð@ð @ð @ðð ð ð'ð 'ð 'ðð ð ðð ð ð ðdð dñ „\ðdð ð.ð .ñ „\ð.ð ðð ñ „\ðð ðð ñ „\ðð ðð ñ „\ðð'ð 'ð 'ð 'ð#ð #ð #ð ðð ñ „Xðð(ð (ð (ð (ð$?ð $?ð $?ð $?ðLð ð ðð ð ð ðð ð ñ „Xðð8ð 8ð 8ð9ð 9ð 9ð 9ð	 ð 	 ð 	 ð 	 ð 	 ð 	 ðð ð ð ð ð ð ð r$   r  c                  ó^   — e Zd Zddd	„Zdd„Zd„ Zd„ Zd„ Zd„ Zdd„Z	e
d„ ¦   «         Zdd„ZdS )Úpointer_typer;   FrÐ  r  Úaddress_spacerz   r`   rX   c                óè   — t          |¦  «        }t          |t          ¦  «        s%t          dt	          |¦  «        j        › d�¦  «        ‚|| _        || _        || _        |sd|› d�nd|› d�| _	        d S )Nzelement_ty has type `z`; expected `dtype`.zpointer<ú>zconst_pointer<)
r±   r%   r  rU   rf   rG   rÐ  rÙ  r`   rB   )r@   rÐ  rÙ  r`   s       r"   r”   zpointer_type.__init__–  s‹   € Ý)¨*Ñ5Ô5ˆ
Ý˜*¥eÑ,Ô,ð 	eÝÐcµD¸Ñ4DÔ4DÔ4MÐcÐcÐcÑdÔdÐdØ$ˆŒØ*ˆÔØˆŒ
Ø49Ð]Ð,˜zÐ,Ð,Ð,Ð,Ð?]ÐPZÐ?]Ð?]Ð?]ˆŒ	ˆ	ˆ	r$   rƒ   r„   r)   úir.pointer_typec                óh   — |                      | j                             |¦  «        | j        ¦  «        S r   )Ú
get_ptr_tyrÐ  r¦  rÙ  r»  s     r"   r¦  zpointer_type.to_irŸ  s+   € Ø×!Ò! $¤/×"7Ò"7¸Ñ"@Ô"@À$ÔBTÑUÔUÐUr$   c                ó   — | j         S r   rA   r�   s    r"   r½  zpointer_type.__str__¢  r¾  r$   c                ó*   — |                       ¦   «         S r   ©r½  r�   s    r"   r˜   zpointer_type.__repr__¥  rŠ  r$   c                ó   — dS ©NTr?   r�   s    r"   r�  zpointer_type.is_ptr¨  ó   € Øˆtr$   c                ó   — | j         S r   )r`   r�   s    r"   rŸ  zpointer_type.is_const«  r®   r$   c                ó®   — t          |¦  «        }t          |t          ¦  «        sdS | j        |j        k    o| j        |j        k    o| j        |j        k    S r™  )r±   r%   rØ  rÐ  rÙ  r`   rs   s     r"   ru   zpointer_type.__eq__®  sX   € Ý$ UÑ+Ô+ˆÝ˜%¥Ñ.Ô.ð 	Ø�5ØŒ %Ô"2Ò2Ð~°tÔ7IÈUÔM`Ò7`Ð~ÐeiÔeoÐsxÔs~Òe~Ð~r$   c                ó   — | S r   r?   r�   s    r"   r  zpointer_type.scalar´  r£  r$   r&   c                ó:   — d| j                              ¦   «         › �S )NÚP)rÐ  r‚   r�   s    r"   r‚   zpointer_type.mangle¸  s   € Ø-�4”?×)Ò)Ñ+Ô+Ð-Ð-Ð-r$   N)r;   F)rÐ  r  rÙ  rz   r`   rX   )rƒ   r„   r)   rÜ  rŠ   rŒ   )rG   ra   rb   r”   r¦  r½  r˜   r�  rŸ  ru   rÔ  r  r‚   r?   r$   r"   rØ  rØ  ”  sÍ   € € € € € ð^ð ^ð ^ð ^ð ^ðVð Vð Vð Vðð ð ðð ð ðð ð ðð ð ðð ð ð ð ðð ñ „Xðð.ð .ð .ð .ð .ð .r$   rØ  c                  ó|   — e Zd Zdd„Zdd
„Zd„ Zd„ Zd„ Zdd„Zdd„Z	dd„Z
ed„ ¦   «         Zed„ ¦   «         Zdd„ZdS )Ú
block_typerÐ  r  Úshaper   c                ó   — || _         t          |t          t          f¦  «        sJ ‚t          t	          |¦  «        ¦  «        | _        | j        st          d¦  «        ‚t          | j        ¦  «        | _        d| j        › d| j         › d�| _	        d S )Nz0d block_type is forbiddenú<ú, rÛ  )
rÐ  r%   rH   r  Ú_unwrap_shaperì  rU   r   ÚnumelrB   )r@   rÐ  rì  s      r"   r”   zblock_type.__init__¾  sŠ   € Ø$ˆŒõ ˜5¥4­ -Ñ0Ô0Ð1Ð1Ð0õ �=¨Ñ/Ô/Ñ0Ô0ˆŒ
ØŒzð 	:ÝÐ8Ñ9Ô9Ð9å)¨$¬*Ñ5Ô5ˆŒ
Ø8˜œ
Ð8Ð8 d¤oÐ8Ð8Ð8ˆŒ	ˆ	ˆ	r$   rƒ   r„   r)   úir.block_typec                óh   — |                      | j                             |¦  «        | j        ¦  «        S r   )Úget_block_tyrÐ  r¦  rì  r»  s     r"   r¦  zblock_type.to_irÍ  s*   € Ø×#Ò# D¤O×$9Ò$9¸'Ñ$BÔ$BÀDÄJÑOÔOÐOr$   c                ó   — | j         S r   rA   r�   s    r"   r½  zblock_type.__str__Ð  r¾  r$   c                ó*   — |                       ¦   «         S r   rá  r�   s    r"   r˜   zblock_type.__repr__Ó  rŠ  r$   c                ó   — dS rã  r?   r�   s    r"   rš  zblock_type.is_blockÖ  rä  r$   ú
Tuple[int]c                ó   — | j         S r   ©rì  r�   s    r"   Úget_block_shapeszblock_type.get_block_shapesÙ  r®   r$   Ú	scalar_tyc                ó,   — t          || j        ¦  «        S r   )rë  rì  )r@   rü  s     r"   rÒ  zblock_type.with_element_tyÜ  s   € Ý˜) T¤ZÑ0Ô0Ð0r$   rX   c                óp   — t          |t          ¦  «        sdS | j        |j        k    o| j        |j        k    S r™  )r%   rë  rÐ  rì  rs   s     r"   ru   zblock_type.__eq__ß  s7   € Ý˜%¥Ñ,Ô,ð 	Ø�5ØŒ %Ô"2Ò2ÐP°t´zÀUÄ[Ò7PÐPr$   c                ó   — | j         S r   )rÐ  r�   s    r"   r  zblock_type.scalarä  s
   € àŒÐr$   c                ó0   — | j         | j        j        dz  z  S )Nr=  )rñ  rÐ  r  r�   s    r"   Únbyteszblock_type.nbytesè  s   € àŒz˜Tœ_Ô?À1ÑDÑEÐEr$   r&   c                óž   — | j                              ¦   «         }d                     t          t          | j        ¦  «        ¦  «        }|› d|› d�S )NÚ_ÚS)r  r‚   ÚjoinÚmapr&   rì  )r@   Úeltrì  s      r"   r‚   zblock_type.mangleì  sI   € ØŒk× Ò Ñ"Ô"ˆØ—’��S $¤*Ñ-Ô-Ñ.Ô.ˆØÐ Ð ˜Ð Ð Ð Ð r$   N)rÐ  r  rì  r   )rƒ   r„   r)   rò  )r)   rø  )rü  r  r)   rë  rŠ   rŒ   )rG   ra   rb   r”   r¦  r½  r˜   rš  rû  rÒ  ru   rÔ  r  r  r‚   r?   r$   r"   rë  rë  ¼  sú   € € € € € ð9ð 9ð 9ð 9ðPð Pð Pð Pðð ð ðð ð ðð ð ðð ð ð ð1ð 1ð 1ð 1ðQð Qð Qð Qð
 ðð ñ „Xðð ðFð Fñ „XðFð!ð !ð !ð !ð !ð !r$   rë  c                  ó\   — e Zd Zdd„Zed„ ¦   «         Zd„ Zd„ Zdd
„Zdd„Z	d„ Z
dd„Zd„ ZdS )Ú
tuple_typeNc                ó"   — || _         || _        d S r   )ÚtypesÚfields)r@   r  r  s      r"   r”   ztuple_type.__init__ô  s   € ØˆŒ
ØˆŒˆˆr$   c                óÞ   — | j         €*dd                     d„ | j        D ¦   «         ¦  «        z   dz   S dd                     d„ t          | j         | j        ¦  «        D ¦   «         ¦  «        z   dz   S )Nú[ú,c              3  ó4   K  — | ]}t          |¦  «        V — Œd S r   ©r&   )r  Úvs     r"   r  z"tuple_type.name.<locals>.<genexpr>û  s(   è è € Ð!=Ð!=¨Q¥# a¡&¤&Ð!=Ð!=Ð!=Ð!=Ð!=Ð!=r$   r—   c                ó"   — g | ]\  }}|› d |› �‘ŒS )ú:r?   )r  Úkr  s      r"   r  z#tuple_type.name.<locals>.<listcomp>ü  s&   € ÐSÐSÐS©d¨a° !˜z˜z a˜z˜zÐSÐSÐSr$   )r  r  r  Úzipr�   s    r"   rB   ztuple_type.nameø  sq   € àŒ;ÐØ˜ŸšÐ!=Ð!=°$´*Ð!=Ñ!=Ô!=Ñ=Ô=Ñ=ÀÑCÐCØ�S—X’XÐSÐSµc¸$¼+ÀtÄzÑ6RÔ6RÐSÑSÔSÑTÔTÑTÐWZÑZÐZr$   c                ó   — | j         S r   rA   r�   s    r"   r½  ztuple_type.__str__þ  r¾  r$   c                ó*   — t          | j        ¦  «        S r   )rT   r  r�   s    r"   rÿ   ztuple_type.__iter__  rœ   r$   rƒ   r„   r…   r†   c                óF   — | j         D ]}|                     ||¦  «         Œd S r   )r  r‰   )r@   rƒ   r…   Útys       r"   r‰   ztuple_type._flatten_ir_types  s6   € Ø”*ð 	/ð 	/ˆBØ× Ò  ¨#Ñ.Ô.Ð.Ð.ð	/ð 	/r$   Úindexrz   r)   r  c                ó   — | j         |         S r   )r  )r@   r  s     r"   r
  ztuple_type.__getitem__  s   € ØŒz˜%Ô Ð r$   c                ó~   — t          | ¦  «        t          |¦  «        u o| j        |j        k    o| j        |j        k    S r   )rf   r  r  rs   s     r"   ru   ztuple_type.__eq__  s7   € Ý�D‰zŒz�T %™[œ[Ð(Ðf¨T¬Z¸5¼;Ò-FÐfÈ4Ì;ÐZ_ÔZfÒKfÐfr$   rg   rh   ry   úTuple[tuple, int]c                óš   — g }| j         D ]0}|                     ||¦  «        \  }}|                     |¦  «         Œ1t          || ¦  «        |fS r   )r  r~   r¥  r  )r@   rg   ry   rI   r  r’   s         r"   r~   ztuple_type._unflatten_ir  s[   € ØˆØ”*ð 	!ð 	!ˆBØ×,Ò,¨W°fÑ=Ô=‰MˆE�6Ø�MŠM˜%Ñ Ô Ð Ð Ý�V˜TÑ"Ô" FÐ*Ð*r$   c                óV   — dd                      d„ | j        D ¦   «         ¦  «        z   dz   S )Nr   r  c              3  ó>   K  — | ]}|                      ¦   «         V — Œd S r   ©r‚   )r  r  s     r"   r  z$tuple_type.mangle.<locals>.<genexpr>  s*   è è € Ð?Ð?¨b˜bŸiši™kœkÐ?Ð?Ð?Ð?Ð?Ð?r$   )r  r  r�   s    r"   r‚   ztuple_type.mangle  s/   € Ø�S—X’XÐ?Ð?°D´JÐ?Ñ?Ô?Ñ?Ô?Ñ?À#ÑEÐEr$   r   )rƒ   r„   r…   r†   )r  rz   r)   r  )rg   rh   ry   rz   r)   r  )rG   ra   rb   r”   r	   rB   r½  rÿ   r‰   r
  ru   r~   r‚   r?   r$   r"   r	  r	  ò  sÆ   € € € € € ðð ð ð ð ð[ð [ñ „_ð[ð
ð ð ð ð  ð  ð/ð /ð /ð /ð!ð !ð !ð !ðgð gð gð+ð +ð +ð +ðFð Fð Fð Fð Fr$   r	  c                  ó   — e Zd Zd„ ZdS )Ú
slice_typec                ó   — d| _         d S )Nr$  rA   r�   s    r"   r”   zslice_type.__init__  s   € Ø ˆŒ	ˆ	ˆ	r$   N©rG   ra   rb   r”   r?   r$   r"   r$  r$    s#   € € € € € ð!ð !ð !ð !ð !r$   r$  r0  r"  r  r  r   r!  r#  r$  r%  r&  r*  r+  r(  r)  r'  r,  r-  r.  r/  r  rz   Úsignedc                ó6  — | dk    rt           S | dk    r	|rt          S | dk    r	|st          S | dk    r	|rt          S | dk    r	|st          S | dk    r	|rt
          S | dk    r	|st          S | dk    r	|rt          S | dk    r	|st          S t          d| › d|› �¦  «        ‚)Nr;   r=  rA  é    é@   zUnsupported bitwidth z and signedness )
r"  r  r#  r  r$  r   r%  r!  r&  r.   )r  r'  s     r"   Úget_int_dtyper+  7  s¿   € Ø�1‚}€}ÝˆØ	�QŠˆ˜6ˆÝˆØ	�QŠˆ˜vˆÝˆØ	�RŠˆ˜FˆÝˆØ	�RŠˆ ˆÝˆØ	�RŠˆ˜FˆÝˆØ	�RŠˆ ˆÝˆØ	�RŠˆ˜FˆÝˆØ	�RŠˆ ˆÝˆåÐS°ÐSÐSÈ6ÐSÐSÑTÔTÐTr$   c                  ó¸  ‡ — e Zd ZdZdpˆ fd„Zdqd	„Zdrd„Zedsd„¦   «         Zedsd„¦   «         Z	edsd„¦   «         Z
edsd„¦   «         Zedsd„¦   «         Zedsd„¦   «         Zedsd„¦   «         Zedsd„¦   «         Zedsd„¦   «         Zedsd„¦   «         Zedsd„¦   «         Zedsd„¦   «         Zedsd„¦   «         Zedsd„¦   «         Zedsd„¦   «         Zedsd„¦   «         Zedsd„¦   «         Zedsd„¦   «         Zedsd„¦   «         Zedsd „¦   «         Zedsd!„¦   «         Zedsd"„¦   «         Zedsd#„¦   «         Zedsd$„¦   «         Zedsd%„¦   «         Z edsd&„¦   «         Z!edsd'„¦   «         Z"edsd(„¦   «         Z#edsd)„¦   «         Z$edsd*„¦   «         Z%edsd+„¦   «         Z&edsd,„¦   «         Z'edsd-„¦   «         Z(edsd.„¦   «         Z)edsd/„¦   «         Z*edsd0„¦   «         Z+edsd1„¦   «         Z,edsd2„¦   «         Z-edsd3„¦   «         Z.edsd4„¦   «         Z/e0d5„ ¦   «         Z1edtdud;„¦   «         Z2dvd<„Z3dvd=„Z4dvd>„Z5dwd@„Z6dvdA„Z7dvdB„Z8dvdC„Z9dxdvdD„Z:dydvdG„Z;dvdH„Z<dzdvdI„Z=d{dvdJ„Z>d{dvdK„Z?d{dvdL„Z@d{dvdM„ZAd{dvdN„ZBd{dvdO„ZCd{dvdP„ZDdvdQ„ZEdvdR„ZFdvdS„ZGdvdT„ZHdvdU„ZIdvdV„ZJdvdW„ZKd|dvdX„ZLd|dvdY„ZMdvdZ„ZNdvd[„ZOdvd\„ZPdvd]„ZQd}dvd^„ZRdvd_„ZSd~dvda„ZTddvdb„ZUd~dvdc„ZVddvdd„ZWdtdvde„ZXdxdvdf„ZYdxdvdg„ZZd€dvdi„Z[d€dvdj„Z\de]fd�dn„Z^dsdvdo„Z_ˆ xZ`S )‚rM   a  Represents an N-dimensional array of values or pointers.

    :code:`tensor` is the fundamental data structure in Triton programs.  Most
    functions in :py:mod:`triton.language` operate on and return tensors.

    Most of the named member functions here are duplicates of the free functions
    in :code:`triton.language`.  For example, :code:`triton.language.sqrt(x)` is
    equivalent to :code:`x.sqrt()`.

    :code:`tensor` also defines most of the magic/dunder methods, so you can
    write :code:`x+y`, :code:`x << 2`, etc.

    .. rubric:: Constructors
    ..
       For some reason Sphinx includes __init__ before printing the full table
       of methods.  Not what I want, but I can't figure out how to fix it.  Give
       it its own section so it looks intentional. :)
    rf   r  c                ó\  •— t          ¦   «                              ¦   «          || _        |                     ¦   «         r|j        nd| _        t          t          j        | j        ¦  «        ¦  «        | _        || _	        |j
        | _        t          d„ | j        D ¦   «         ¦  «        | _        dS )úNot called by user code.r?   c                ó,   — g | ]}t          |¦  «        ‘ŒS r?   ©r¦   ©r  r(   s     r"   r  z#tensor.__init__.<locals>.<listcomp>r  s   € Ð=Ð=Ð=¨Q�I a™LœLÐ=Ð=Ð=r$   N)rÎ  r”   Úhandlerš  rì  r¦   ÚmathÚprodrñ  rf   r  r  r  )r@   r2  rf   r€   s      €r"   r”   ztensor.__init__g  s‰   ø€ å‰Œ×ÒÑÔÐàˆŒà#'§=¢=¡?¤?Ð:�T”Z�Z¸ˆŒ
Ý�tœy¨¬Ñ4Ô4Ñ5Ô5ˆŒ
ØˆŒ	à”[ˆŒ
ÝÐ=Ð=°$´*Ð=Ñ=Ô=Ñ>Ô>ˆŒ
ˆ
ˆ
r$   rg   rh   r)   ri   c                ó:   — |                      | j        ¦  «         d S r   ©r¥  r2  rm   s     r"   rn   ztensor._flatten_irt  ó   € Ø�Š�t”{Ñ#Ô#Ð#Ð#Ð#r$   r&   c                ó€   — t          | j        ¦  «        dz   d                     d„ | j        D ¦   «         ¦  «        z   dz   S )Nr  rï  c              3  ó4   K  — | ]}t          |¦  «        V — Œd S r   r  r1  s     r"   r  z!tensor.__str__.<locals>.<genexpr>y  s(   è è € Ð0LÐ0L¸Aµ°Q±´Ð0LÐ0LÐ0LÐ0LÐ0LÐ0Lr$   r—   )r&   r  r  rì  r�   s    r"   r½  ztensor.__str__w  s<   € å�4”:‰Œ Ñ$ t§y¢yÐ0LÐ0LÀÄÐ0LÑ0LÔ0LÑ'LÔ'LÑLÈsÑRÐRr$   Nc                ó(   — t          | |d|¬¦  «        S ©NT)Úsanitize_overflowr,   ©Úadd©r@   rt   r,   s      r"   r²   ztensor.__add__{  ó   € å�4˜°$À)ÐLÑLÔLÐLr$   c                ó(   — t          || d|¬¦  «        S r;  r=  r?  s      r"   r¶   ztensor.__radd__  ó   € å�5˜$°$À)ÐLÑLÔLÐLr$   c                ó(   — t          | |d|¬¦  «        S r;  ©Úsubr?  s      r"   r¹   ztensor.__sub__ƒ  r@  r$   c                ó(   — t          || d|¬¦  «        S r;  rD  r?  s      r"   r»   ztensor.__rsub__‡  rB  r$   c                ó(   — t          | |d|¬¦  «        S r;  ©Úmulr?  s      r"   r½   ztensor.__mul__‹  r@  r$   c                ó(   — t          || d|¬¦  «        S r;  rH  r?  s      r"   rÁ   ztensor.__rmul__�  rB  r$   c                óL   — t          |¦  «        }|                     | |¦  «        S r   ©r±   Útruedivr?  s      r"   rÃ   ztensor.__truediv__“  s%   € å$ UÑ+Ô+ˆØ× Ò   uÑ-Ô-Ð-r$   c                óL   — t          |¦  «        }|                     || ¦  «        S r   rL  r?  s      r"   rÅ   ztensor.__rtruediv__˜  s%   € å$ UÑ+Ô+ˆØ× Ò  ¨Ñ-Ô-Ð-r$   c                óL   — t          |¦  «        }|                     | |¦  «        S r   ©r±   Úfloordivr?  s      r"   rÇ   ztensor.__floordiv__�  s%   € å$ UÑ+Ô+ˆØ×!Ò! $¨Ñ.Ô.Ð.r$   c                óL   — t          |¦  «        }|                     || ¦  «        S r   rP  r?  s      r"   rÊ   ztensor.__rfloordiv__¢  s%   € å$ UÑ+Ô+ˆØ×!Ò! %¨Ñ.Ô.Ð.r$   c                óL   — t          |¦  «        }|                     | |¦  «        S r   ©r±   Úmodr?  s      r"   r¿   ztensor.__mod__§  ó#   € å$ UÑ+Ô+ˆØ�}Š}˜T 5Ñ)Ô)Ð)r$   c                óL   — t          |¦  «        }|                     || ¦  «        S r   rT  r?  s      r"   Ú__rmod__ztensor.__rmod__¬  ó#   € å$ UÑ+Ô+ˆØ�}Š}˜U DÑ)Ô)Ð)r$   c                ó,   — |                      | ¦  «        S r   )Úminus©r@   r,   s     r"   rä   ztensor.__neg__²  s   € à�Š˜tÑ$Ô$Ð$r$   c                ó,   — |                      | ¦  «        S r   )Úinvertr\  s     r"   ró   ztensor.__invert__¶  s   € à×Ò Ñ%Ô%Ð%r$   c                óL   — t          |¦  «        }|                     | |¦  «        S r   ©r±   Úand_r?  s      r"   rç   ztensor.__and__¼  ó#   € å$ UÑ+Ô+ˆØ�~Š~˜d EÑ*Ô*Ð*r$   c                óL   — t          |¦  «        }|                     || ¦  «        S r   r`  r?  s      r"   Ú__rand__ztensor.__rand__Á  ó#   € å$ UÑ+Ô+ˆØ�~Š~˜e TÑ*Ô*Ð*r$   c                óL   — t          |¦  «        }|                     | |¦  «        S r   ©r±   Úor_r?  s      r"   rë   ztensor.__or__Æ  rV  r$   c                óL   — t          |¦  «        }|                     || ¦  «        S r   rg  r?  s      r"   Ú__ror__ztensor.__ror__Ë  rY  r$   c                óL   — t          |¦  «        }|                     | |¦  «        S r   ©r±   Úxor_r?  s      r"   rí   ztensor.__xor__Ð  rb  r$   c                óL   — t          |¦  «        }|                     || ¦  «        S r   rl  r?  s      r"   Ú__rxor__ztensor.__rxor__Õ  re  r$   c                ól   — t          | |¦  «         t          |¦  «        }|                     | |¦  «        S r   ©r  r±   Úshlr?  s      r"   rû   ztensor.__lshift__Ú  s3   € å˜˜eÑ$Ô$Ð$Ý$ UÑ+Ô+ˆØ�}Š}˜T 5Ñ)Ô)Ð)r$   c                ól   — t          || ¦  «         t          |¦  «        }|                     || ¦  «        S r   rq  r?  s      r"   Ú__rlshift__ztensor.__rlshift__à  s3   € å˜˜tÑ$Ô$Ð$Ý$ UÑ+Ô+ˆØ�}Š}˜U DÑ)Ô)Ð)r$   c                óÊ   — t          | |¦  «         t          |¦  «        }| j                             ¦   «         r|                     | |¦  «        S |                     | |¦  «        S r   ©r  r±   r  r‚  ÚashrÚlshrr?  s      r"   rù   ztensor.__rshift__æ  s]   € å˜˜eÑ$Ô$Ð$Ý$ UÑ+Ô+ˆØŒ:×#Ò#Ñ%Ô%ð 	/Ø—>’> $¨Ñ.Ô.Ð.à—>’> $¨Ñ.Ô.Ð.r$   c                óÊ   — t          || ¦  «         t          |¦  «        }| j                             ¦   «         r|                     || ¦  «        S |                     || ¦  «        S r   rv  r?  s      r"   Ú__rrshift__ztensor.__rrshift__ï  s]   € å˜˜tÑ$Ô$Ð$Ý$ UÑ+Ô+ˆØŒ:×#Ò#Ñ%Ô%ð 	/Ø—>’> %¨Ñ.Ô.Ð.à—>’> %¨Ñ.Ô.Ð.r$   c                óX   — |                      |¦  «        }|                     | |¦  «        S r   ©r^   Úgreater_thanr?  s      r"   rÌ   ztensor.__gt__ù  s+   € à×#Ò# EÑ*Ô*ˆØ×%Ò% d¨EÑ2Ô2Ð2r$   c                óX   — |                      |¦  «        }|                     || ¦  «        S r   r|  r?  s      r"   rÏ   ztensor.__rgt__þ  s+   € à×#Ò# EÑ*Ô*ˆØ×%Ò% e¨TÑ2Ô2Ð2r$   c                óX   — |                      |¦  «        }|                     | |¦  «        S r   ©r^   Úgreater_equalr?  s      r"   rÒ   ztensor.__ge__  s+   € à×#Ò# EÑ*Ô*ˆØ×&Ò& t¨UÑ3Ô3Ð3r$   c                óX   — |                      |¦  «        }|                     || ¦  «        S r   r€  r?  s      r"   rÕ   ztensor.__rge__	  s+   € à×#Ò# EÑ*Ô*ˆØ×&Ò& u¨dÑ3Ô3Ð3r$   c                óX   — |                      |¦  «        }|                     | |¦  «        S r   ©r^   Ú	less_thanr?  s      r"   rØ   ztensor.__lt__  ó+   € à×#Ò# EÑ*Ô*ˆØ×"Ò" 4¨Ñ/Ô/Ð/r$   c                óX   — |                      |¦  «        }|                     || ¦  «        S r   r„  r?  s      r"   rÚ   ztensor.__rlt__  ó+   € à×#Ò# EÑ*Ô*ˆØ×"Ò" 5¨$Ñ/Ô/Ð/r$   c                óX   — |                      |¦  «        }|                     | |¦  «        S r   ©r^   Ú
less_equalr?  s      r"   rÜ   ztensor.__le__  ó+   € à×#Ò# EÑ*Ô*ˆØ×#Ò# D¨%Ñ0Ô0Ð0r$   c                óX   — |                      |¦  «        }|                     || ¦  «        S r   rŠ  r?  s      r"   rÞ   ztensor.__rle__  s+   € à×#Ò# EÑ*Ô*ˆØ×#Ò# E¨4Ñ0Ô0Ð0r$   c                óX   — |                      |¦  «        }|                     | |¦  «        S r   ©r^   Úequalr?  s      r"   ru   ztensor.__eq__%  s)   € à×#Ò# EÑ*Ô*ˆØ�Š˜t UÑ+Ô+Ð+r$   c                óX   — |                      |¦  «        }|                     || ¦  «        S r   r�  r?  s      r"   Ú__req__ztensor.__req__*  s)   € à×#Ò# EÑ*Ô*ˆØ�Š˜u dÑ+Ô+Ð+r$   c                óX   — |                      |¦  «        }|                     | |¦  «        S r   ©r^   Ú	not_equalr?  s      r"   rw   ztensor.__ne__/  r†  r$   c                óX   — |                      |¦  «        }|                     || ¦  «        S r   r”  r?  s      r"   Ú__rne__ztensor.__rne__4  rˆ  r$   c                óX   — |                      |¦  «        }|                     | |¦  «        S r   )r^   ré   r?  s      r"   ré   ztensor.logical_and9  s+   € à×#Ò# EÑ*Ô*ˆØ×$Ò$ T¨5Ñ1Ô1Ð1r$   c                óX   — |                      |¦  «        }|                     | |¦  «        S r   )r^   rï   r?  s      r"   rï   ztensor.logical_or>  rŒ  r$   c                ó,   — |                      | ¦  «        S r   )Únot_r\  s     r"   rý   ztensor.__not__E  s   € à�~Š~˜dÑ#Ô#Ð#r$   c                óÌ  — t          |t          j        t          t          f¦  «        s|€|g}t          |t          ¦  «        r|j        }| }t          |¦  «        D ]‰\  }}t          |¦  «        €|                     ||¦  «        }Œ+t          |t          j        t          f¦  «        r,t          d„ |j
        |j        |j        fD ¦   «         ¦  «        rŒxt          d|› �¦  «        ‚|S )Nc              3  ó8   K  — | ]}t          |¦  «        d u V — Œd S r   r  )r  Úargs     r"   r  z%tensor.__getitem__.<locals>.<genexpr>S  sQ   è è € ð A_ð A_Ø:=Õ(¨Ñ-Ô-°Ð5ðA_ð A_ð A_ð A_ð A_ð A_r$   zunsupported tensor index: )r%   r  Úslicer¦   r  rI   Ú	enumerater±   Úexpand_dimsÚallÚstartÚstopÚstepr.   )r@   Úslicesr,   ÚretÚdimÚsls         r"   r
  ztensor.__getitem__I  s
  € å�f�xœ~­uµiÐ@ÑAÔAð 	ÀVÀ^Ø�XˆFÝ�f�eÑ$Ô$ð 	#Ø”]ˆFØˆÝ  Ñ(Ô(ð 	Dð 	D‰GˆC�Ý# BÑ'Ô'Ð/Ø×+Ò+¨C°Ñ5Ô5��Ý˜B¥¤µÐ 7Ñ8Ô8ð D½Sð A_ð A_ØBDÄ(ÈBÌGÐUWÔU\ÐA]ðA_ñ A_ô A_ñ >_ô >_ð Dàå Ð!B¸bÐ!BÐ!BÑCÔCÐCØˆ
r$   c                ó   — J d¦   «         ‚)zTransposes a 2D tensor.Fz0Transposition must be created by the AST Visitorr?   r�   s    r"   r   ztensor.TZ  s   € ð 	IÐHÑHÔHˆur$   FÚfp_downcast_roundingúOptional[str]ÚbitcastrX   c                ó*   — t          | ||||¬¦  «        S )z3
        Alias for :py:func:`tensor.cast`.
        ©r,   )Úcast)r@   r  r«  r­  r,   s        r"   Útoz	tensor.to_  s   € õ
 �D˜%Ð!5°wÈ)ÐTÑTÔTÐTr$   c                ó   — d S r   r?   ©r@   rì  s     r"   Úbroadcast_toztensor.broadcast_tok  ó   € Øˆr$   c                ó   — d S r   r?   ©r@   Údimss     r"   Útransztensor.transn  rµ  r$   c                ó   — d S r   r?   r·  s     r"   Úpermuteztensor.permuteq  rµ  r$   útuple[tensor, tensor]c                ó   — d S r   r?   r�   s    r"   Úsplitztensor.splitt  rµ  r$   c                ó   — d S r   r?   r³  s     r"   Úviewztensor.vieww  rµ  r$   c                ó   — d S r   r?   r³  s     r"   Úreshapeztensor.reshapez  rµ  r$   c                ó   — d S r   r?   )r@   Úaxiss     r"   r¡  ztensor.expand_dims}  rµ  r$   c                ó   — d S r   r?   )r@   r  r«  r­  s       r"   r°  ztensor.cast€  rµ  r$   r?   r<   c                ó   — d S r   r?   )r@   r’   ÚmaskÚboundary_checkÚcache_modifierÚeviction_policys         r"   Ústoreztensor.storeƒ  rµ  r$   c                ó   — d S r   r?   )r@   Úoffsetss     r"   Úadvanceztensor.advance†  rµ  r$   c                ó   — d S r   r?   )r@   Úcmpr¡   ÚsemÚscopes        r"   Ú
atomic_casztensor.atomic_cas‰  rµ  r$   c                ó   — d S r   r?   ©r@   r¡   rÇ  rÑ  rÒ  s        r"   Úatomic_xchgztensor.atomic_xchgŒ  rµ  r$   c                ó   — d S r   r?   rÕ  s        r"   Ú
atomic_addztensor.atomic_add�  rµ  r$   c                ó   — d S r   r?   rÕ  s        r"   Ú
atomic_maxztensor.atomic_max’  rµ  r$   c                ó   — d S r   r?   rÕ  s        r"   Ú
atomic_minztensor.atomic_min•  rµ  r$   c                ó   — d S r   r?   rÕ  s        r"   Ú
atomic_andztensor.atomic_and˜  rµ  r$   c                ó   — d S r   r?   rÕ  s        r"   Ú	atomic_orztensor.atomic_or›  rµ  r$   c                ó   — d S r   r?   rÕ  s        r"   Ú
atomic_xorztensor.atomic_xorž  rµ  r$   c                ó   — d S r   r?   r�   s    r"   Úexpz
tensor.exp¡  rµ  r$   c                ó   — d S r   r?   r�   s    r"   Úlogz
tensor.log¤  rµ  r$   c                ó   — d S r   r?   r�   s    r"   Úcosz
tensor.cos§  rµ  r$   c                ó   — d S r   r?   r�   s    r"   Úsinz
tensor.sinª  rµ  r$   c                ó   — d S r   r?   r�   s    r"   Úsqrtztensor.sqrt­  rµ  r$   c                ó   — d S r   r?   r�   s    r"   Úrsqrtztensor.rsqrt°  rµ  r$   c                ó   — d S r   r?   r�   s    r"   Úabsz
tensor.abs³  rµ  r$   c                ó   — d S r   r?   )r@   rÄ  Ú
combine_fnÚ	keep_dimss       r"   Úreduceztensor.reduce¶  rµ  r$   c                ó   — d S r   r?   )r@   rÄ  rò  Úreverses       r"   Úassociative_scanztensor.associative_scan¹  rµ  r$   c                ó   — d S r   r?   )r@   ÚindicesrÄ  s      r"   Úgatherztensor.gather¼  rµ  r$   c                ó   — d S r   r?   )r@   Únum_binss     r"   Ú	histogramztensor.histogram¿  rµ  r$   c                ó   — d S r   r?   )r@   Údivs     r"   Úcdivztensor.cdivÂ  rµ  r$   c                ó   — d S r   r?   r�   s    r"   Úsigmoidztensor.sigmoidÅ  rµ  r$   c                ó   — d S r   r?   )r@   r¨  ró  Úieee_roundings       r"   Úsoftmaxztensor.softmaxÈ  rµ  r$   c                ó   — d S r   r?   r�   s    r"   Úravelztensor.ravelË  rµ  r$   Tc                ó   — d S r   r?   ©r@   rÄ  Úreturn_indicesÚreturn_indices_tie_break_leftró  s        r"   Úmaxz
tensor.maxÎ  rµ  r$   c                ó   — d S r   r?   ©r@   rÄ  Útie_break_leftró  s       r"   Úargmaxztensor.argmaxÑ  rµ  r$   c                ó   — d S r   r?   r	  s        r"   Úminz
tensor.minÔ  rµ  r$   c                ó   — d S r   r?   r  s       r"   Úargminztensor.argmin×  rµ  r$   c                ó   — d S r   r?   )r@   rÄ  ró  r  s       r"   Úsumz
tensor.sumÚ  rµ  r$   c                ó   — d S r   r?   ©r@   rÄ  ró  s      r"   Úxor_sumztensor.xor_sumÝ  rµ  r$   c                ó   — d S r   r?   r  s      r"   Ú	reduce_orztensor.reduce_orà  rµ  r$   r   c                ó   — d S r   r?   ©r@   rÄ  rö  s      r"   Úcumsumztensor.cumsumã  rµ  r$   c                ó   — d S r   r?   r  s      r"   Úcumprodztensor.cumprodæ  rµ  r$   r¨  r¦   Ú
descendingc                ó   — d S r   r?   )r@   r¨  r!  s      r"   Úsortztensor.sorté  rµ  r$   c                ó   — d S r   r?   )r@   r¨  s     r"   Úflipztensor.flipì  rµ  r$   )rf   r  ro   rŒ   r   ©NFN©r  r  r«  r¬  r­  rX   ©r)   rM   ©r)   r¼  r™  )Nr?   r<   r<   ©NN©NNN©F)NFF)NFTF)TF)r   F)r¨  r¦   r!  r¦   r)   rM   )arG   ra   rb   rF   r”   rn   r½  r8   r²   r¶   r¹   r»   r½   rÁ   rÃ   rÅ   rÇ   rÊ   r¿   rX  rä   ró   rç   rd  rë   rj  rí   ro  rû   rt  rù   rz  rÌ   rÏ   rÒ   rÕ   rØ   rÚ   rÜ   rÞ   ru   r’  rw   r—  ré   rï   rý   r
  rÔ  r   r±  r´  r¹  r»  r¾  rÀ  rÂ  r¡  r°  rË  rÎ  rÓ  rÖ  rØ  rÚ  rÜ  rÞ  rà  râ  rä  ræ  rè  rê  rì  rî  rð  rô  r÷  rú  rý  r   r  r  r  r  r  r  r  r  r  r  r  r   ÚCONSTEXPR_0r#  r%  rÕ  rÖ  s   @r"   rM   rM   S  sÂ	  ø€ € € € € ðð ð&?ð ?ð ?ð ?ð ?ð ?ð$ð $ð $ð $ðSð Sð Sð Sð ðMð Mð Mñ „WðMð ðMð Mð Mñ „WðMð ðMð Mð Mñ „WðMð ðMð Mð Mñ „WðMð ðMð Mð Mñ „WðMð ðMð Mð Mñ „WðMð ð.ð .ð .ñ „Wð.ð ð.ð .ð .ñ „Wð.ð ð/ð /ð /ñ „Wð/ð ð/ð /ð /ñ „Wð/ð ð*ð *ð *ñ „Wð*ð ð*ð *ð *ñ „Wð*ð
 ð%ð %ð %ñ „Wð%ð ð&ð &ð &ñ „Wð&ð
 ð+ð +ð +ñ „Wð+ð ð+ð +ð +ñ „Wð+ð ð*ð *ð *ñ „Wð*ð ð*ð *ð *ñ „Wð*ð ð+ð +ð +ñ „Wð+ð ð+ð +ð +ñ „Wð+ð ð*ð *ð *ñ „Wð*ð
 ð*ð *ð *ñ „Wð*ð
 ð/ð /ð /ñ „Wð/ð ð/ð /ð /ñ „Wð/ð ð3ð 3ð 3ñ „Wð3ð ð3ð 3ð 3ñ „Wð3ð
 ð4ð 4ð 4ñ „Wð4ð ð4ð 4ð 4ñ „Wð4ð
 ð0ð 0ð 0ñ „Wð0ð ð0ð 0ð 0ñ „Wð0ð
 ð1ð 1ð 1ñ „Wð1ð ð1ð 1ð 1ñ „Wð1ð
 ð,ð ,ð ,ñ „Wð,ð ð,ð ,ð ,ñ „Wð,ð ð0ð 0ð 0ñ „Wð0ð ð0ð 0ð 0ñ „Wð0ð ð2ð 2ð 2ñ „Wð2ð ð1ð 1ð 1ñ „Wð1ð ð$ð $ð $ñ „Wð$ð ðð ð ñ „Wðð  ðIð Iñ „XðIð ðUð Uð Uð Uñ „WðUðð ð ð ðð ð ð ðð ð ð ðð ð ð ðð ð ð ðð ð ð ðð ð ð ðð ð ð ð ðð ð ð ð ðð ð ð ðð ð ð ð ðð ð ð ð ðð ð ð ð ðð ð ð ð ðð ð ð ð ðð ð ð ð ðð ð ð ð ðð ð ð ð ðð ð ð ðð ð ð ðð ð ð ðð ð ð ðð ð ð ðð ð ð ðð ð ð ðð ð ð ð ðð ð ð ð ðð ð ð ðð ð ð ðð ð ð ðð ð ð ðð ð ð ð ðð ð ð ðð ð ð ð ðð ð ð ð ðð ð ð ð ðð ð ð ð ðð ð ð ð ðð ð ð ð ðð ð ð ð ðð ð ð ð ðð ð ð ð ð %)À+ð ð ð ð ð ðð ð ð ð ð ð ð ð r$   rM   c                ó6   — t          d„ | D ¦   «         |¦  «        S )Nc                ó~   — g | ]:}t          |t          t          t          f¦  «        rt	          |¦  «        n|j        ‘Œ;S r?   )r%   rz   rÁ  r  r�   rf   r  s     r"   r  z*_type_for_tuple_values.<locals>.<listcomp>ñ  s@   € ÐkÐkÐkÐ_`­J°q½3ÅÅuÐ:MÑ,NÔ,NÐZ•~ aÑ(Ô(Ð(ÐTUÔTZÐkÐkÐkr$   )r	  )rI   r  s     r"   Ú_type_for_tuple_valuesr0  ð  s#   € ÝÐkÐkÐdjÐkÑkÔkÐmsÑtÔtÐtr$   c                  ód   — e Zd Zddd„Zdd	„Zd
„ Zd„ Zd„ Zd„ Zd„ Z	d„ Z
d„ Zd„ Zd„ Zdd„Zd„ ZdS )r  Nr0   r   rf   úOptional[tuple_type]c                óÆ   — d„ |D ¦   «         | _         t          |t          ¦  «        r	|| _        d S |�t          |¦  «        | _        d S t	          | j         ¦  «        | _        d S )Nc                ó   — g | ]}|‘ŒS r?   r?   )r  rË  s     r"   r  z"tuple.__init__.<locals>.<listcomp>÷  s   € Ð'Ð'Ð'˜Q�qÐ'Ð'Ð'r$   )rI   r%   r	  rf   r0  )r@   r0   rf   s      r"   r”   ztuple.__init__ö  sb   € Ø'Ð' $Ð'Ñ'Ô'ˆŒÝ�d�JÑ'Ô'ð 	<ØˆDŒIˆIˆIØÐÝ" 4Ñ(Ô(ˆDŒIˆIˆIå.¨t¬{Ñ;Ô;ˆDŒIˆIˆIr$   Úidxr¦   c                ó,  — t          |t          ¦  «        rt          |¦  «        }t          |t          ¦  «        r| j        |         S t          |t          t
          j        f¦  «        sJ ‚t          | j        |j        |j        |j	        …         ¦  «        S r   )
r%   rz   r¦   rI   rŸ  r  r  r£  r¤  r¥  )r@   r5  s     r"   r
  ztuple.__getitem__ÿ  s~   € Ý�c�3ÑÔð 	!Ý˜C‘.”.ˆCÝ�c�9Ñ%Ô%ð 	CØ”;˜sÔ#Ð#å˜c¥E­8¬>Ð#:Ñ;Ô;Ð;Ð;Ð;Ý˜œ S¤Y¨s¬x¸¼Ð%@ÔAÑBÔBÐBr$   c                óŠ   — | j         j        }|�||vrt          d|› �¦  «        ‚| j        |                     |¦  «                 S )Nz 'tuple' object has no attribute )rf   r  ÚAttributeErrorrI   r  ©r@   rB   r  s      r"   Ú__getattr__ztuple.__getattr__  sK   € Ø”Ô!ˆØˆ>˜T¨Ð/Ð/Ý Ð!JÀDÐ!JÐ!JÑKÔKÐKØŒ{˜6Ÿ<š<¨Ñ-Ô-Ô.Ð.r$   c                ó®   — t          |¦  «        }t          |t          ¦  «        sJ ‚|| j        |<   t	          | j        | j        j        ¦  «        | _        d S r   )r±   r%   rz   rI   r0  rf   r  )r@   r5  r’   s      r"   Ú_setitemztuple._setitem  sM   € Ý" 3Ñ'Ô'ˆÝ˜#�sÑ#Ô#Ð#Ð#Ð#Ø ˆŒ�CÑÝ*¨4¬;¸¼	Ô8HÑIÔIˆŒ	ˆ	ˆ	r$   c                óX   — t          |¦  «        }t          | j        |j        z   ¦  «        S r   )r	  r  rI   rs   s     r"   r²   ztuple.__add__  s&   € Ý  Ñ'Ô'ˆÝ�T”[ 5¤<Ñ/Ñ0Ô0Ð0r$   c                óh   — t          |t          ¦  «        sJ ‚t          | j        |j        z  ¦  «        S r   )r%   r¦   r  rI   r’   rs   s     r"   r½   ztuple.__mul__  s/   € Ý˜%¥Ñ+Ô+Ð+Ð+Ð+Ý�T”[ 5¤;Ñ.Ñ/Ô/Ð/r$   c                óZ   — t          |¦  «        }t          | j        |j        k    ¦  «        S r   )r	  r¦   rI   rs   s     r"   ru   ztuple.__eq__  s&   € Ý  Ñ'Ô'ˆÝ˜œ¨¬Ò4Ñ5Ô5Ð5r$   c                óN   — t          t          j        | j        ¦  «        ¦  «        S r   )rš   r  r  rI   r�   s    r"   r›   ztuple.__hash__"  s   € Ý•H”N 4¤;Ñ/Ô/Ñ0Ô0Ð0r$   c                ó>   — t          d„ | j        D ¦   «         ¦  «        S )Nc                ó,   — g | ]}t          |¦  «        ‘ŒS r?   r  r  s     r"   r  z!tuple.__str__.<locals>.<listcomp>&  s   € Ð0Ð0Ð0˜q•C˜‘F”FÐ0Ð0Ð0r$   )r&   rI   r�   s    r"   r½  ztuple.__str__%  s!   € ÝÐ0Ð0 D¤KÐ0Ñ0Ô0Ñ1Ô1Ð1r$   c                ó*   — t          | j        ¦  «        S r   )rT   rI   r�   s    r"   rÿ   ztuple.__iter__(  s   € Ý�D”KÑ Ô Ð r$   c                ó*   — t          | j        ¦  «        S r   )rD   rI   r�   s    r"   Ú__len__ztuple.__len__+  s   € Ý�4”;ÑÔÐr$   rg   rh   c                óD   — | j         D ]}|                     |¦  «         Œd S r   )rI   rn   )r@   rg   r  s      r"   rn   ztuple._flatten_ir.  s2   € Ø”ð 	#ð 	#ˆAØ�MŠM˜'Ñ"Ô"Ð"Ð"ð	#ð 	#r$   c                óR   — dd                      d„ | j        D ¦   «         ¦  «        › d�S )Nr=   rï  c              3  ó4   K  — | ]}t          |¦  «        V — Œd S r   )r    r  s     r"   r  z!tuple.__repr__.<locals>.<genexpr>3  s(   è è € Ð:Ð:¨�T !™WœWÐ:Ð:Ð:Ð:Ð:Ð:r$   ú))r  rI   r�   s    r"   r˜   ztuple.__repr__2  s0   € Ø=�4—9’9Ð:Ð:¨d¬kÐ:Ñ:Ô:Ñ:Ô:Ð=Ð=Ð=Ð=r$   r   )r0   r   rf   r2  )r5  r¦   )rg   rh   )rG   ra   rb   r”   r
  r:  r<  r²   r½   ru   r›   r½  rÿ   rE  rn   r˜   r?   r$   r"   r  r  ô  sò   € € € € € ð<ð <ð <ð <ð <ðCð Cð Cð Cð/ð /ð /ðJð Jð Jð1ð 1ð 1ð
0ð 0ð 0ð6ð 6ð 6ð1ð 1ð 1ð2ð 2ð 2ð!ð !ð !ð ð  ð  ð#ð #ð #ð #ð>ð >ð >ð >ð >r$   r  c                  ó   — e Zd Zd„ ZdS )rŸ  c                óV   — || _         || _        || _        t          ¦   «         | _        d S r   )r£  r¤  r¥  r$  rf   )r@   r£  r¤  r¥  s       r"   r”   zslice.__init__8  s&   € ØˆŒ
ØˆŒ	ØˆŒ	Ý‘L”LˆŒ	ˆ	ˆ	r$   Nr&  r?   r$   r"   rŸ  rŸ  6  s#   € € € € € ð!ð !ð !ð !ð !r$   rŸ  c                  óF   — e Zd Zdd„Zdd	„Zdd„Zdd„Zdd„Zdd„Zdd„Z	dS )Útensor_descriptor_base_typerë  c                ó   — || _         d S r   ©rë  )r@   rë  s     r"   r”   z$tensor_descriptor_base_type.__init__A  s   € Ø$ˆŒˆˆr$   rg   rh   ry   rz   r)   ú"Tuple[tensor_descriptor_base, int]c                óF   — t          ||         | j        ¦  «        }||dz   fS rÉ  )Útensor_descriptor_baserë  )r@   rg   ry   r’   s       r"   r~   z)tensor_descriptor_base_type._unflatten_irD  s&   € Ý& w¨v¤¸¼ÑHÔHˆØ�f˜q‘jÐ Ð r$   rƒ   r„   r…   r†   ri   c                óÄ   — | j         j                             ¦   «         }|                     |                     | j                              |¦  «        |¦  «        ¦  «         d S r   )rë  rÐ  r‚  r¥  Úcreate_tensor_descriptor_typer¦  )r@   rƒ   r…   Ú	is_signeds       r"   r‰   z-tensor_descriptor_base_type._flatten_ir_typesH  sQ   € Ø”OÔ.×<Ò<Ñ>Ô>ˆ	Ø�
Š
�7×8Ò8¸¼×9NÒ9NÈwÑ9WÔ9WÐYbÑcÔcÑdÔdÐdÐdÐdr$   r&   c                ó   — d| j         › d�S )Nztensor_descriptor<rÛ  rO  r�   s    r"   r½  z#tensor_descriptor_base_type.__str__L  s   € à6 D¤OÐ6Ð6Ð6Ð6r$   rX   c                ób   — t          |¦  «        t          | ¦  «        urdS | j        |j        k    S r™  ©rf   rë  rs   s     r"   ru   z"tensor_descriptor_base_type.__eq__P  s.   € Ý�‰;Œ;�d 4™jœjÐ(Ð(Ø�5ØŒ %Ô"2Ò2Ð2r$   c                ó   — | |k     S r   r?   rs   s     r"   Ú__neq__z#tensor_descriptor_base_type.__neq__U  rx   r$   c                ó:   — d| j                              ¦   «         › �S )NÚTD)rë  r‚   r�   s    r"   r‚   z"tensor_descriptor_base_type.mangleX  s   € Ø.�D”O×*Ò*Ñ,Ô,Ð.Ð.Ð.r$   N©rë  rë  ©rg   rh   ry   rz   r)   rP  r�   rŒ   rŠ   )
rG   ra   rb   r”   r~   r‰   r½  ru   rZ  r‚   r?   r$   r"   rM  rM  ?  s¤   € € € € € ð%ð %ð %ð %ð!ð !ð !ð !ðeð eð eð eð7ð 7ð 7ð 7ð3ð 3ð 3ð 3ð
#ð #ð #ð #ð/ð /ð /ð /ð /ð /r$   rM  c                  ó‚  ‡ — e Zd ZdZdˆ fd„Zdd„Zed	„ ¦   «         Zed
„ ¦   «         Zed„ ¦   «         Z	d d„Z
ed!d"d„¦   «         Zed!d#d„¦   «         Zed!d#d„¦   «         Zed!d#d„¦   «         Zed!d#d„¦   «         Zed!d#d„¦   «         Zed!d#d„¦   «         Zed!d#d„¦   «         Zeddœd$d„¦   «         Zeddœd$d„¦   «         Zˆ xZS )%rR  z="
    A tensor descriptor with unknown shape and strides
    rë  c                ó~   •— t          ¦   «                              ¦   «          || _        t          |¦  «        | _        dS )r.  N)rÎ  r”   r2  rM  rf   )r@   r2  rë  r€   s      €r"   r”   ztensor_descriptor_base.__init__a  s3   ø€ å‰Œ×ÒÑÔÐàˆŒÝ/°
Ñ;Ô;ˆŒ	ˆ	ˆ	r$   rg   rh   r)   ri   c                ó:   — |                      | j        ¦  «         d S r   r6  rm   s     r"   rn   z"tensor_descriptor_base._flatten_irh  r7  r$   c                ó   — | j         j        S r   rX  r�   s    r"   rë  z!tensor_descriptor_base.block_typek  s   € àŒyÔ#Ð#r$   c                ó$   — | j         j        j        S r   )rf   rë  rì  r�   s    r"   Úblock_shapez"tensor_descriptor_base.block_shapeo  s   € àŒyÔ#Ô)Ð)r$   c                ó$   — | j         j        j        S r   )rf   rë  rÐ  r�   s    r"   r  ztensor_descriptor_base.dtypes  s   € àŒyÔ#Ô.Ð.r$   r&   c                ó*   — t          | j        ¦  «        S r   )r&   rf   r�   s    r"   r½  ztensor_descriptor_base.__str__w  s   € Ý�4”9‰~Œ~Ðr$   NrÍ  úSequence[constexpr | tensor]rM   c                ó2   — |                      | |dd¦  «        S )zÎLoad a block from the descriptor starting at the given element offsets.

        Values outside of the tensor bounds will be filled with zeros.

        :note: Offset must be a multiple of 16-bytes
        r<   )Údescriptor_load)r@   rÍ  r,   s      r"   Úloadztensor_descriptor_base.loadz  s   € ð ×(Ò(¨¨w¸¸BÑ?Ô?Ð?r$   r’   c                ó0   — |                      | ||¦  «        S )zÅStore a block from the descriptor starting at the given element offsets.

        Values outside of the tensor bounds will be ignored.

        :note: Offset must be a multiple of 16-bytes
        )Údescriptor_store©r@   rÍ  r’   r,   s       r"   rË  ztensor_descriptor_base.store„  s   € ð ×)Ò)¨$°°wÑ?Ô?Ð?r$   c                ó0   — |                      | ||¦  «        S r   )Údescriptor_atomic_addrm  s       r"   rØ  z!tensor_descriptor_base.atomic_addŽ  ó   € à×.Ò.¨t°U¸GÑDÔDÐDr$   c                ó0   — |                      | ||¦  «        S r   )Údescriptor_atomic_minrm  s       r"   rÜ  z!tensor_descriptor_base.atomic_min’  rp  r$   c                ó0   — |                      | ||¦  «        S r   )Údescriptor_atomic_maxrm  s       r"   rÚ  z!tensor_descriptor_base.atomic_max–  rp  r$   c                ó0   — |                      | ||¦  «        S r   )Údescriptor_atomic_andrm  s       r"   rÞ  z!tensor_descriptor_base.atomic_andš  rp  r$   c                ó0   — |                      | ||¦  «        S r   )Údescriptor_atomic_orrm  s       r"   rà  z tensor_descriptor_base.atomic_orž  s   € à×-Ò-¨d°E¸7ÑCÔCÐCr$   c                ó0   — |                      | ||¦  «        S r   )Údescriptor_atomic_xorrm  s       r"   râ  z!tensor_descriptor_base.atomic_xor¢  rp  r$   r¯  c               ó®   — t          |¦  «        dk    sJ dt          |¦  «        › �¦   «         ‚|d         }|d         }|                     | ||dd¦  «        S )z)Gather multiple descriptors worth of datar   z5descriptor gather only supports 2D indexing, but got r   r;   r<   )rD   Údescriptor_gather)r@   r,   r0   Ú	x_offsetsÚy_offsets        r"   rú  ztensor_descriptor_base.gather¦  s^   € õ �4‰yŒy˜AŠ~ˆ~ˆ~ÐbÕWZÐ[_ÑW`ÔW`ÐbÐb‰~Œ~ˆ~Ø˜”Gˆ	Ø˜”7ˆØ×*Ò*¨4°¸HÀbÈ"ÑMÔMÐMr$   c               ó¬   — t          |¦  «        dk    sJ dt          |¦  «        › �¦   «         ‚|d         }|d         }|                     | |||¦  «        S )z*Scatter multiple descriptors worth of datar   z6descriptor scatter only supports 2D indexing, but got r   r;   )rD   Údescriptor_scatter)r@   r’   r,   r0   r}  r~  s         r"   Úscatterztensor_descriptor_base.scatter®  s\   € õ �4‰yŒy˜AŠ~ˆ~ˆ~ÐcÕX[Ð\`ÑXaÔXaÐcÐc‰~Œ~ˆ~Ø˜”Gˆ	Ø˜”7ˆØ×+Ò+¨D°%¸ÀHÑMÔMÐMr$   r]  ro   rŒ   r   )rÍ  rg  r)   rM   )rÍ  rg  r’   rM   r)   rM   r(  )rG   ra   rb   rF   r”   rn   rÔ  rë  rd  r  r½  r8   rj  rË  rØ  rÜ  rÚ  rÞ  rà  râ  rú  r�  rÕ  rÖ  s   @r"   rR  rR  \  sz  ø€ € € € € ðð ð<ð <ð <ð <ð <ð <ð$ð $ð $ð $ð ð$ð $ñ „Xð$ð ð*ð *ñ „Xð*ð ð/ð /ñ „Xð/ðð ð ð ð ð@ð @ð @ð @ñ „Wð@ð ð@ð @ð @ð @ñ „Wð@ð ðEð Eð Eð Eñ „WðEð ðEð Eð Eð Eñ „WðEð ðEð Eð Eð Eñ „WðEð ðEð Eð Eð Eñ „WðEð ðDð Dð Dð Dñ „WðDð ðEð Eð Eð Eñ „WðEð Ø&*ð Nð Nð Nð Nð Nñ „WðNð Ø.2ð Nð Nð Nð Nð Nñ „WðNð Nð Nð Nð Nr$   rR  c                  ó:   ‡ — e Zd Zdd„Zdd„Zdˆ fd„Zˆ fd„Zˆ xZS )Útensor_descriptor_typerë  Ú
shape_typer	  Ústrides_typec                ó0   — || _         || _        || _        d S r   )rë  r„  r…  )r@   rë  r„  r…  s       r"   r”   ztensor_descriptor_type.__init__¹  s   € Ø$ˆŒØ$ˆŒØ(ˆÔÐÐr$   rg   rh   ry   rz   r)   rP  c                óæ   — ||         }|dz  }| j                              ||¦  «        \  }}| j                             ||¦  «        \  }}|j        }|j        }t	          |||| j        ¦  «        }||fS rÉ  )r„  r~   r…  rI   Útensor_descriptorrë  )r@   rg   ry   r2  rì  Ústridesr’   s          r"   r~   z$tensor_descriptor_type._unflatten_ir¾  sx   € Ø˜”ˆØ�!‰ˆØœ×5Ò5°g¸vÑFÔF‰ˆˆvØÔ+×9Ò9¸'À6ÑJÔJ‰ˆ�Ø”ˆØ”.ˆÝ! &¨%°¸$¼/ÑJÔJˆØ�fˆ}Ðr$   rƒ   r„   r…   r†   ri   c                ó¸   •— t          ¦   «                              ||¦  «         | j                             ||¦  «         | j                             ||¦  «         d S r   )rÎ  r‰   r„  r…  )r@   rƒ   r…   r€   s      €r"   r‰   z(tensor_descriptor_type._flatten_ir_typesÈ  sT   ø€ Ý‰Œ×!Ò! '¨3Ñ/Ô/Ð/ØŒ×)Ò)¨'°3Ñ7Ô7Ð7ØÔ×+Ò+¨G°SÑ9Ô9Ð9Ð9Ð9r$   c                ó†   •— t          ¦   «                              |¦  «        o| j        |j        k    o| j        |j        k    S r   )rÎ  ru   r„  r…  )r@   rt   r€   s     €r"   ru   ztensor_descriptor_type.__eq__Í  sG   ø€ Ý‰wŒw�~Š~˜eÑ$Ô$ð k¨$¬/¸UÔ=MÒ*Mð kÐTXÔTeØW\ÔWiòUjð 	kr$   )rë  rë  r„  r	  r…  r	  r^  r�   )rG   ra   rb   r”   r~   r‰   ru   rÕ  rÖ  s   @r"   rƒ  rƒ  ·  s‡   ø€ € € € € ð)ð )ð )ð )ð
ð ð ð ð:ð :ð :ð :ð :ð :ð
kð kð kð kð kð kð kð kð kr$   rƒ  c                  ó,   ‡ — e Zd ZdZdˆ fd„Zdd„Zˆ xZS )rˆ  z9A descriptor representing a tensor in global memory.
    rì  úList[tensor]r‰  rë  c                óò   •— t          ¦   «                              ||¦  «         t          |¦  «        | _        t          |¦  «        | _        t          || j        j        | j        j        ¬¦  «        | _        dS )r.  )r„  r…  N)rÎ  r”   r  rì  r‰  rƒ  rf   )r@   r2  rì  r‰  rë  r€   s        €r"   r”   ztensor_descriptor.__init__Ö  se   ø€ õ 	‰Œ×Ò˜ Ñ,Ô,Ð,å˜5‘\”\ˆŒ
Ý˜W‘~”~ˆŒÝ*ØØ”z”ØœÔ*ð
ñ 
ô 
ˆŒ	ˆ	ˆ	r$   rg   rh   r)   ri   c                ó¢   — |                      | j        ¦  «         | j                             |¦  «         | j                             |¦  «         d S r   )r¥  r2  rì  rn   r‰  rm   s     r"   rn   ztensor_descriptor._flatten_irã  sH   € Ø�Š�t”{Ñ#Ô#Ð#ØŒ
×Ò˜wÑ'Ô'Ð'ØŒ× Ò  Ñ)Ô)Ð)Ð)Ð)r$   )rì  r�  r‰  r�  rë  rë  ro   )rG   ra   rb   rF   r”   rn   rÕ  rÖ  s   @r"   rˆ  rˆ  Ò  s[   ø€ € € € € ðð ð
ð 
ð 
ð 
ð 
ð 
ð*ð *ð *ð *ð *ð *ð *ð *r$   rˆ  )Úfrozenc                  ó@   — e Zd ZU dZded<   ded<   dd„Zdd„Zdd„ZdS )Ú_aggregate_typez¿A generic base type for all Triton aggregate types.

    This class contains a reference to the original user-defined Python class
    and a list of class fields with their Triton types.
    rf   Úbase_clszList[Tuple[str, base_type]]r  rg   rh   ry   rz   r)   úTuple[ir.value, int]c                óª   — | j                              ¦   «         }| j        D ]/\  }}|                     ||¦  «        \  }}t	          |||¦  «         Œ0||fS r   )r“  Ú_get_instancer  r~   r4   )r@   rg   ry   ÚinstancerB   r  r’   s          r"   r~   z_aggregate_type._unflatten_irù  sc   € Ø”=×.Ò.Ñ0Ô0ˆØœð 	+ð 	+‰HˆD�"Ø×,Ò,¨W°fÑ=Ô=‰MˆE�6Ý�H˜d EÑ*Ô*Ð*Ð*Ø˜ÐÐr$   rƒ   r„   r…   r†   ri   c                óL   — | j         D ]\  }}|                     ||¦  «         Œd S r   )r  r‰   )r@   rƒ   r…   rB   r  s        r"   r‰   z!_aggregate_type._flatten_ir_types   s:   € Øœð 	/ð 	/‰HˆD�"Ø× Ò  ¨#Ñ.Ô.Ð.Ð.ð	/ð 	/r$   r&   c                ó�   — | j         j        › d| j         j        › �}d„ | j        D ¦   «         }|› dd                     |¦  «        › d�S )Nú.c                ó<   — g | ]\  }}|                      ¦   «         ‘ŒS r?   r"  )r  rB   r  s      r"   r  z*_aggregate_type.mangle.<locals>.<listcomp>  s$   € Ð<Ð<Ð<¡* 4¨�"—)’)‘+”+Ð<Ð<Ð<r$   rî  rï  rÛ  )r“  ra   rb   r  r  r9  s      r"   r‚   z_aggregate_type.mangle  sW   € Ø”-Ô*ÐIÐI¨T¬]Ô-GÐIÐIˆØ<Ð<°´Ð<Ñ<Ô<ˆØÐ-Ð-˜Ÿš 6Ñ*Ô*Ð-Ð-Ð-Ð-r$   N)rg   rh   ry   rz   r)   r”  r�   rŒ   )rG   ra   rb   rF   rp   r~   r‰   r‚   r?   r$   r"   r’  r’  î  ss   € € € € € € ðð ð €N€N�NØ'Ð'Ð'Ñ'ð ð  ð  ð  ð/ð /ð /ð /ð.ð .ð .ð .ð .ð .r$   r’  c                óº  ‡ ‡—  G ˆˆ fd„dt           ¦  «        Š‰ j        g}t          j        ‰ ¦  «        D ]n\  }}t          j        |¦  «        s)t          j        |¦  «        st          |t          ¦  «        r,|dk    r&t          ‰||¦  «         | 	                    |¦  «         Œo|‰_
        ‰ j        ‰_        ‰ j        ‰_        ‰ j        ‰_        ‰ j        ‰_        ‰S )Nc                  ó~   •‡ — e Zd ZdZdZeˆ fd„¦   «         Zdddœˆfd„
Zˆ ˆfd„Zdˆfd„Z	e
ˆˆfd„¦   «         Zˆ xZS )ú#_aggregate.<locals>.aggregate_valueTc                óF   •— t          ¦   «                              | ¦  «        S r   )rÎ  Ú__new__)Úthis_clsr€   s    €r"   r–  z1_aggregate.<locals>.aggregate_value._get_instance  s   ø€ å‘7”7—?’? 8Ñ,Ô,Ð,r$   N©r,   r:   c               ó²  •— |                       ¦   «         }i }t          ‰j        t          ¦  «        rnJdt	          j        ‰j        ¦  «        j        v r||d<   dt	          j        ‰j        ¦  «        j        v r||d<    ‰j        |g|¢R i |¤|¤Ž ‰j                             ¦   «         D ]-}t          ||¦  «        st          d‰j        › d|› d�¦  «        ‚Œ.|S )Nr,   r:   zconstructor for z did not initialize attribute 'ú')r–  r%   r”   r   r6   r7   rC   rp   rE   rŸ   r8  rG   )	r¡  r,   r:   r0   r1   r—  Úextra_kwargsrB   Úclss	           €r"   r   z+_aggregate.<locals>.aggregate_value.__new__  s  ø€ à×-Ò-Ñ/Ô/ˆHØˆLÝ˜#œ,­Ñ4Ô4ð <àà¥'Ô"3°C´LÑ"AÔ"AÔ"LÐLÐLØ09�L Ñ-Ø¥7Ô#4°S´\Ñ#BÔ#BÔ#MÐMÐMØ1;�L Ñ.ØˆCŒL˜ÐC DÐCÐCÐC¨LÐC¸FÐCÐCÐCð Ô+×0Ò0Ñ2Ô2ð rð r�Ý˜x¨Ñ.Ô.ð rÝ(Ð)p¸C¼LÐ)pÐ)pÐimÐ)pÐ)pÐ)pÑqÔqÐqðrð ˆOr$   c           
     ó(  •— |‰j         vrt          ‰j        › d|› d�¦  «        ‚t          |‰j         |         ¦  «        s0t	          d‰j         |         › d|› dt          |¦  «        › �¦  «        ‚t          ¦   «                              ||¦  «         d S )Nz has no attribute 'r¤  z	Expected z for attribute 'z', got )rp   r8  rG   r%   rU   rf   rÎ  Ú__setattr__)r@   rB   r’   r€   r¦  s      €€r"   r¨  z/_aggregate.<locals>.aggregate_value.__setattr__+  s§   ø€ Ø˜3Ô.Ð.Ð.Ý$¨¬Ð%PÐ%PÈÐ%PÐ%PÐ%PÑQÔQÐQÝ˜e SÔ%8¸Ô%>Ñ?Ô?ð sÝÐ q¨CÔ,?ÀÔ,EÐ qÐ qÐW[Ð qÐ qÕdhÐinÑdoÔdoÐ qÐ qÑrÔrÐrÝ‰GŒG×Ò  eÑ,Ô,Ð,Ð,Ð,r$   rg   rh   r)   ri   c                ó†   •— ‰j                              ¦   «         D ]%}t          | |¦  «                             |¦  «         Œ&d S r   )rp   rE   rZ   rn   )r@   rg   rB   r¦  s      €r"   rn   z/_aggregate.<locals>.aggregate_value._flatten_ir2  sL   ø€ ØÔ+×0Ò0Ñ2Ô2ð 9ð 9�Ý˜˜dÑ#Ô#×/Ò/°Ñ8Ô8Ð8Ð8ð9ð 9r$   c                ól   •‡ — t          ‰ˆ fd„‰j                             ¦   «         D ¦   «         ¦  «        S )Nc                ó>   •— g | ]}|t          ‰|¦  «        j        f‘ŒS r?   )rZ   rf   )r  rB   r@   s     €r"   r  z<_aggregate.<locals>.aggregate_value.type.<locals>.<listcomp>9  s+   ø€ Ð#lÐ#lÐ#lÈ T­7°4¸Ñ+>Ô+>Ô+CÐ$DÐ#lÐ#lÐ#lr$   )r’  rp   rE   )r@   Úaggregate_valuer¦  s   `€€r"   rf   z(_aggregate.<locals>.aggregate_value.type6  sB   øø€ å" ?Ø#lÐ#lÐ#lÐ#lÐQTÔQd×QiÒQiÑQkÔQkÐ#lÑ#lÔ#lñnô nð nr$   ro   )rG   ra   rb   r   Ú__triton_aggregate__Úclassmethodr–  r   r¨  rn   rÔ  rf   rÕ  )r€   r¬  r¦  s   @€€r"   r¬  rž    sé   øø€ € € € € Ø!ÐØ#Ðà	ð	-ð 	-ð 	-ð 	-ñ 
Œð	-ð 04Àð 	ð 	ð 	ð 	ð 	ð 	ð 	ð,	-ð 	-ð 	-ð 	-ð 	-ð 	-ð	9ð 	9ð 	9ð 	9ð 	9ð 	9ð 
ð	nð 	nð 	nð 	nð 	nñ 
Œð	nð 	nð 	nð 	nð 	nr$   r¬  r”   )rd   r”   r6   Ú
getmembersÚ
isfunctionÚismethodr%   r   r4   r¥  Ú
hash_attrsrG   ra   rb   rF   )r¦  r²  rB   Úmemberr¬  s   `   @r"   Ú
_aggregater´  
  s  øø€ ð,nð ,nð ,nð ,nð ,nð ,nð ,nð ,n�*ñ ,nô ,nð ,nð\ ”,�€Jå!Ô,¨SÑ1Ô1ð *ð *‰ˆˆvÝÔ˜fÑ%Ô%ð 	*­Ô)9¸&Ñ)AÔ)Að 	*ÅZÐPVÕXcÑEdÔEdð 	*Ø�zÒ!Ð!Ý˜¨¨vÑ6Ô6Ð6Ø×!Ò! &Ñ)Ô)Ð)øà!+€OÔØ"œ|€OÔØ!$¤€OÔØ#&Ô#3€OÔ Ø!œk€OÔàÐr$   c                óJ   — t          | ¦  «        } |                     | ¦  «        S )z¯
    Returns the id of the current program instance along the given :code:`axis`.

    :param axis: The axis of the 3D launch grid. Must be 0, 1 or 2.
    :type axis: int
    )r±   Ú
program_id©rÄ  r,   s     r"   r¶  r¶  Q  s%   € õ   Ñ%Ô%€DØ×Ò Ñ%Ô%Ð%r$   c                óJ   — t          | ¦  «        } |                     | ¦  «        S )z±
    Returns the number of program instances launched along the given :code:`axis`.

    :param axis: The axis of the 3D launch grid. Must be 0, 1 or 2.
    :type axis: int
    )r±   Únum_programsr·  s     r"   r¹  r¹  d  s%   € õ   Ñ%Ô%€DØ×!Ò! $Ñ'Ô'Ð'r$   c                ój   — t          | ¦  «        } t          |¦  «        }|                     | |¦  «        S r   )r±   Úarange)r£  Úendr,   s      r"   r»  r»  u  s2   € å  Ñ'Ô'€EÝ
˜sÑ
#Ô
#€CØ×Ò˜E 3Ñ'Ô'Ð'r$   z¯
    Returns contiguous values within the half-open interval :code:`[start,
    end)`.  :code:`end - start` must be less than or equal to
    :code:`TRITON_MAX_TENSOR_NUMEL = zÐ`

    :param start: Start of the interval. Must be a power of two.
    :type start: int32
    :param end: End of the interval. Must be a power of two greater than
        :code:`start`.
    :type end: int32
c                ó8   — t          | ¦  «        } d„ | D ¦   «         S )Nc                ó,   — g | ]}t          |¦  «        ‘ŒS r?   r  r1  s     r"   r  z!_unwrap_shape.<locals>.<listcomp>‹  s!   € Ð3Ð3Ð3¨Õ  Ñ#Ô#Ð3Ð3Ð3r$   r  rú  s    r"   rð  rð  ‰  s#   € Ý  Ñ'Ô'€EØ3Ð3¨UÐ3Ñ3Ô3Ð3r$   c                óB   — t          | ¦  «        } t          | ¦  «         | S r   )rð  r   rú  s    r"   Ú_shape_check_implrÀ  Ž  s"   € Ý˜%Ñ Ô €EÝ˜ÑÔÐØ€Lr$   c                óŠ   — t          | ¦  «        } t          |¦  «        }t          |¦  «        }|                     | ||¦  «        S )ax  
    Returns a tensor filled with the scalar value for the given :code:`shape` and :code:`dtype`.

    :param shape: Shape of the new array, e.g., (8, 16) or (8, )
    :type shape: tuple of ints
    :param value: A scalar value to fill the array with
    :type value: scalar
    :param dtype: Data type of the new array, e.g., :code:`tl.float16`
    :type dtype: tl.dtype
    )rÀ  r±   Úfull)rì  r’   r  r,   s       r"   rÂ  rÂ  ”  sA   € õ ˜eÑ$Ô$€EÝ  Ñ'Ô'€EÝ  Ñ'Ô'€EØ�>Š>˜% ¨Ñ.Ô.Ð.r$   c                ó.   — |                      | |¦  «        S )zÓ
    Tries to broadcast the two given blocks to a common compatible shape.

    :param input: The first input tensor.
    :type input: Block
    :param other: The second input tensor.
    :type other: Block
    )Úbroadcast_impl_value)Úinputrt   r,   s      r"   Ú	broadcastrÆ  «  s   € ð ×)Ò)¨%°Ñ7Ô7Ð7r$   r¯  c               óf   — t          t          |¦  «        ¦  «        }|                     | |¦  «        S )ae  
    Tries to broadcast the given tensor to a new :code:`shape`.

    :param input: The input tensor.
    :type input: Block
    :param shape: The desired shape.
    :type shape:

    :code:`shape` can be passed as a tuple or as individual parameters: ::

        # These are equivalent
        broadcast_to(x, (32, 32))
        broadcast_to(x, 32, 32)
    )rÀ  rW   Úbroadcast_impl_shape©rÅ  r,   rì  s      r"   r´  r´  ¸  s0   € õ" Õ.¨uÑ5Ô5Ñ6Ô6€EØ×)Ò)¨%°Ñ7Ô7Ð7r$   rÅ  c               ó   — t          |¦  «        }|sXt          | j        ¦  «        }|dk     rt          d¦  «        ‚t	          t          j        |dz
  ¦  «        ¦  «        |dz
  |dz
  gz   }|                     | |¦  «        S )aª  
    Permutes the dimensions of a tensor.

    If the parameter :code:`dims` is not specified, the function defaults to
    swapping the last two axes, thereby performing an (optionally batched)
    2D transpose.

    :param input: The input tensor.
    :param dims: The desired ordering of dimensions.  For example,
        :code:`(2, 1, 0)` reverses the order dims in a 3D tensor.

    :code:`dims` can be passed as a tuple or as individual parameters: ::

        # These are equivalent
        trans(x, (2, 1, 0))
        trans(x, 2, 1, 0)

    :py:func:`permute` is equivalent to this function, except it doesn't
    have the special case when no permutation is specified.
    r   z2tl.trans invoked with a 0- or 1-dimensional tensorr;   )rW   rD   rì  r.   rH   r  Úranger»  )rÅ  r,   r¸  Úns       r"   r¹  r¹  Í  s‚   € õ. ˜DÑ!Ô!€DØð <Ý�”ÑÔˆØˆqŠ5ˆ5ÝÐQÑRÔRÐRÝ•H”N 1 q¡5Ñ)Ô)Ñ*Ô*¨a°!©e°Q¸±U¨^Ñ;ˆØ×Ò˜U DÑ)Ô)Ð)r$   c               óL   — t          |¦  «        }|                     | |¦  «        S )a  
    Permutes the dimensions of a tensor.

    :param input: The input tensor.
    :type input: Block
    :param dims: The desired ordering of dimensions.  For example,
        :code:`(2, 1, 0)` reverses the order dims in a 3D tensor.

    :code:`dims` can be passed as a tuple or as individual parameters: ::

        # These are equivalent
        permute(x, (2, 1, 0))
        permute(x, 2, 1, 0)

    :py:func:`trans` is equivalent to this function, except when
    :code:`dims` is empty, it tries to swap the last two axes.
    )rW   r»  )rÅ  r,   r¸  s      r"   r»  r»  í  s'   € õ( ˜DÑ!Ô!€DØ×Ò˜U DÑ)Ô)Ð)r$   Fc                óæ  ‡ ‡‡— |r|                      ‰ ‰|¦  «        S t          ‰ j        ¦  «        }|t          ‰j        ¦  «        k    s"J d|› dt          ‰j        ¦  «        › �¦   «         ‚t          t	          ‰¦  «        |¦  «        Št          ˆˆ ˆfd„t          j        |¦  «        D ¦   «         ¦  «        sJ d‰› d‰ j        › d‰j        › �¦   «         ‚t          ‰ ‰|¬¦  «        }t          t          j        |¦  «        ¦  «        }| 
                    ‰|¦  «         t          |||¬¦  «        }t          ‰ j        ¦  «        }‰ j        ‰         ‰j        ‰         z   |‰<   t          |||¬¦  «        S )a  
    Concatenate the given blocks

    :param input: The first input tensor.
    :type input: Tensor
    :param other: The second input tensor.
    :type other: Tensor
    :param can_reorder: Compiler hint. If true, the compiler is
        allowed to reorder elements while concatenating inputs.  Only use if the
        order does not matter (e.g., result is only used in reduction ops).
    :type can_reorder: bool
    :param dim: The dimension to concatenate along (used when can_reorder is False).
    :type dim: int
    z%tensors must have the same rank, got z and c              3  ó\   •K  — | ]&}|‰k    ¯‰j         |         ‰j         |         k    V — Œ'd S r   rú  )r  rË  r¨  rÅ  rt   s     €€€r"   r  zcat.<locals>.<genexpr>  sZ   øè è € ð ð °AÐQRØòRð RˆuŒ{˜1Œ~ ¤¨Q¤Ò/ð Rð Rð Rð Rð ð r$   z6tensor dims must match except in the concat dimension ú, got r¯  )ÚcatrD   rì  Ú
_wrap_axisr±   r¢  r  rË  r  rH   Úinsertr»  rÂ  )	rÅ  rt   Úcan_reorderr¨  r,   Úrankrž   ÚorderÚ	new_shapes	   `` `     r"   rÑ  rÑ    s¨  øøø€ ð  ð 8Ø�}Š}˜U E¨;Ñ7Ô7Ð7åˆuŒ{ÑÔ€DØ•3�u”{Ñ#Ô#Ò#Ð#Ð#Ð%jÈTÐ%jÐ%jÕX[Ð\aÔ\gÑXhÔXhÐ%jÐ%jÑ#Ô#Ð#Ý
Õ)¨#Ñ.Ô.°Ñ
5Ô
5€CÝð ð ð ð ð ð ½¼ÈÑ9MÔ9Mð ñ ô ñ ô ð yð yØxÈcÐxÐxÐY^ÔYdÐxÐxÐkpÔkvÐxÐxñyô yð õ 	ˆU�E YÐ/Ñ/Ô/€AÝ•” Ñ%Ô%Ñ&Ô&€EØ	‡L‚L��dÑÔÐÝ��5 IÐ.Ñ.Ô.€AÝ�U”[Ñ!Ô!€IØ”[ Ô%¨¬°CÔ(8Ñ8€Iˆc�NÝ�1�i¨9Ð5Ñ5Ô5Ð5r$   c                ó.   — |                      | |¦  «        S )aZ  
    Join the given tensors in a new, minor dimension.

    For example, given two tensors of shape (4,8), produces a new tensor of
    shape (4,8,2).  Given two scalars, returns a tensor of shape (2).

    The two inputs are broadcasted to be the same shape.

    If you want to join more than two elements, you can use multiple calls to
    this function.  This reflects the constraint in Triton that tensors must
    have power-of-two sizes.

    join is the inverse of split.

    :param a: The first input tensor.
    :type a: Tensor
    :param b: The second input tensor.
    :type b: Tensor
    )r  )ÚaÚbr,   s      r"   r  r  (  s   € ð* �>Š>˜!˜QÑÔÐr$   c                ó¢   — t          | j        ¦  «        dk    r| S d}| j        D ]}||z  }Œ|dk    s
J d¦   «         ‚|                     | ¦  «        S )z6
    Convert a single-element tensor to a scalar.
    r   r;   z'can only unsplat single-element tensors)rD   rì  Úunsplat)r!   r,   r:   rñ  Úds        r"   Ú_unsplatrÞ  @  se   € õ ˆ1Œ7�|„|�qÒÐØˆØ€EØŒWð ð ˆØ�‰
ˆˆØ�AŠ:ˆ:ˆ:Ð@‰:Œ:ˆ:Ø×Ò˜QÑÔÐr$   r¼  c                óæ   — t          | j        ¦  «        dk    }|r|                     | d¦  «        } |                     | ¦  «        \  }}|r$t	          |||¬¦  «        }t	          |||¬¦  «        }||fS )a  
    Split a tensor in two along its last dim, which must have size 2.

    For example, given a tensor of shape (4,8,2), produces two tensors of shape
    (4,8).  Given a tensor of shape (2), returns two scalars.

    If you want to split into more than two pieces, you can use multiple calls
    to this function (probably plus calling reshape).  This reflects the
    constraint in Triton that tensors must have power-of-two sizes.

    split is the inverse of join.

    :param a: The tensor to split.
    :type a: Tensor
    r;   r   r¢  )rD   rì  r¡  r¾  rÞ  )rÙ  r,   r:   Ú
was_rank_1Úout_lhsÚout_rhss         r"   r¾  r¾  M  s…   € õ* �Q”W‘” Ò"€JØð (Ø×!Ò! ! QÑ'Ô'ˆà —’ qÑ)Ô)Ñ€GˆWàð På˜7¨iÀJÐOÑOÔOˆÝ˜7¨iÀJÐOÑOÔOˆà�GÐÐr$   c               óˆ   — t          d¦  «         t          t          |¦  «        ¦  «        }|                     | |d¬¦  «        S )a†  
    Returns a tensor with the same elements as `input` but a different shape.
    The order of the elements may not be preserved.

    :param input: The input tensor.
    :type input: Block
    :param shape: The desired shape.

    :code:`shape` can be passed as a tuple or as individual parameters: ::

        # These are equivalent
        view(x, (32, 32))
        view(x, 32, 32)
    zCview is deprecated, please use reshape with can_reorder being true.T©rÔ  )r   rÀ  rW   rÂ  rÉ  s      r"   rÀ  rÀ  p  sD   € õ" 	Ð	NÑOÔOÐOÝÕ.¨uÑ5Ô5Ñ6Ô6€EØ×Ò˜U E°tÐÑ<Ô<Ð<r$   c                ó&   — t          | ||¬¦  «        S )z9
    Converts a single-element tensor into a scalar.
    r¢  )rÞ  )rÅ  r,   r:   s      r"   Úitemræ  †  s   € õ �E Y¸:ÐFÑFÔFÐFr$   )rÔ  r,   r:   c               ó²   — t          t          |¦  «        ¦  «        }t          |¦  «        dk    rt          | ||¬¦  «        S |                     | ||¦  «        S )af  
    Returns a tensor with the same number of elements as input but with the
    provided shape.

    :param input: The input tensor.
    :type input: Block
    :param shape: The new shape.

    :code:`shape` can be passed as a tuple or as individual parameters: ::

        # These are equivalent
        reshape(x, (32, 32))
        reshape(x, 32, 32)
    r   r¢  )rÀ  rW   rD   rÞ  rÂ  )rÅ  rÔ  r,   r:   rì  s        r"   rÂ  rÂ  �  sV   € õ" Õ.¨uÑ5Ô5Ñ6Ô6€EÝ
ˆ5�z„z�Q‚€Ý˜¨¸zÐJÑJÔJÐJØ×Ò˜U E¨;Ñ7Ô7Ð7r$   c                ón   — | | cxk    r|k     sn t          d| › d| › d|› �¦  «        ‚| dk    r| n| |z   S )Nzinvalid axis z. Expected z <= axis < r   r-   )rÄ  Úndims     r"   rÒ  rÒ  ¦  sb   € ØˆE�TÐ Ð Ò Ð ˜DÒ Ð Ð Ð ÝÐR¨ÐRÐR¸4¸%ÐRÐRÈDÐRÐRÑSÔSÐSà˜1’9�9ˆ4ˆ4 $¨¡+Ð-r$   c                óâ  ‡— |                      | ¦  «        } t          |¦  «        }t          |t          t          f¦  «        rt          |¦  «        n|g}t          | j        ¦  «        t          |¦  «        z   Šˆfd„|D ¦   «         }t          t          |¦  «        ¦  «        t          |¦  «        k    rt          d|› �¦  «        ‚| }t          |¦  «        D ]}|                     ||¦  «        }Œ|S )aR  
    Expand the shape of a tensor, by inserting new length-1 dimensions.

    Axis indices are with respect to the resulting tensor, so
    ``result.shape[axis]`` will be 1 for each axis.

    :param input: The input tensor.
    :type input: tl.tensor
    :param axis: The indices to add new axes
    :type axis: int | Sequence[int]

    c                óJ   •— g | ]}t          t          |¦  «        ‰¦  «        ‘Œ S r?   )rÒ  r±   )r  rÝ  Únew_ndims     €r"   r  zexpand_dims.<locals>.<listcomp>À  s,   ø€ ÐHÐHÐH¸a�JÕ+¨AÑ.Ô.°Ñ9Ô9ÐHÐHÐHr$   z7expand_dims received duplicate axes, normalized axes = )r^   r±   r%   r   r  rH   rD   rì  Úsetr.   Úsortedr¡  )rÅ  rÄ  r,   Úaxesr§  rÙ  rì  s         @r"   r¡  r¡  ­  sè   ø€ ð ×Ò Ñ&Ô&€EÝ Ñ%Ô%€DÝ# D­8µUÐ*;Ñ<Ô<ÐH�4�‰:Œ:ˆ:À4À&€DÝ�5”;ÑÔ¥# d¡)¤)Ñ+€HØHÐHÐHÐHÀ4ÐHÑHÔH€Då
�3ˆt‰9Œ9�~„~�˜T™œÒ"Ð"ÝÐYÐSWÐYÐYÑZÔZÐZà
€CÝ�D‰\Œ\ð ,ð ,ˆØ×#Ò# C¨Ñ+Ô+ˆˆØ€Jr$   r«  r¬  r­  c                óä   — |                      | ¦  «        } t          |¦  «        }t          |¦  «        }t          |¦  «        }|r|                     | |¦  «        S |                     | ||¦  «        S )a©  
    Casts a tensor to the given :code:`dtype`.

    :param dtype: The target data type.
    :type dtype: tl.dtype
    :param fp_downcast_rounding: The rounding mode for downcasting
        floating-point values. This parameter is only used when self is a
        floating-point tensor and dtype is a floating-point type with a
        smaller bitwidth. Supported values are :code:`"rtne"` (round to
        nearest, ties to even) and :code:`"rtz"` (round towards zero).
    :type fp_downcast_rounding: str, optional
    :param bitcast: If true, the tensor is bitcasted to the given
        :code:`dtype`, instead of being numerically casted.
    :type bitcast: bool, optional
    )r^   r±   r­  r°  )rÅ  r  r«  r­  r,   s        r"   r°  r°  Ë  su   € ð$ ×Ò Ñ&Ô&€EÝ  Ñ'Ô'€EÝ/Ð0DÑEÔEÐÝ" 7Ñ+Ô+€GØð /Ø× Ò  ¨Ñ.Ô.Ð.Ø�>Š>˜% Ð(<Ñ=Ô=Ð=r$   c                ó   — |�|�
J d¦   «         ‚|€.d|j         j        j        v }t          j        j        p	|r|s|€dnd}t          |¦  «        }t          |¦  «        }t          |¦  «        }t          |¦  «        }t          | j        ¦  «        }	t          |j        ¦  «        }
t          |	¦  «        t          |
¦  «        cxk    rdk    sn J d¦   «         ‚|	dd…         |
dd…         k    s
J d¦   «         ‚|	d	         |
d         k    s
J d
¦   «         ‚|	dd	…         |
d	         gz   }|�"t          |j        ¦  «        |k    s
J d¦   «         ‚t          |¦  «        }|dk    r•d}t          j        |dz
  ¦  «        D ]}|||         z  }Œ|                     | |g|	dd…         z   d¬¦  «        } |                     ||g|
dd…         z   d¬¦  «        }|�$|                     ||g|dd…         z   d¬¦  «        }|                     | |||||¦  «        }|dk    r|                     ||d¬¦  «        }t          |j        ¦  «        |k    s
J d¦   «         ‚|S )a\  
    Returns the matrix product of two blocks.

    The two blocks must both be two-dimensional or three-dimensional and have compatible inner dimensions.
    For three-dimensional blocks, `tl.dot` performs the batched matrix product,
    where the first dimension of each block represents the batch dimension.

    .. warning::
      When using TF32 precision, the float32 inputs may be truncated to TF32 format (19-bit floating point)
      without rounding which may bias the result. For best results, you must round to TF32 explicitly, or load
      the data using `TensorDescriptor` with `round_f32_to_tf32=True`.

    :param input: The first tensor to be multiplied.
    :type input: 2D or 3D tensor of scalar-type in {:code:`int8`, :code:`float8_e5m2`, :code:`float16`, :code:`bfloat16`, :code:`float32`}
    :param other: The second tensor to be multiplied.
    :type other: 2D or 3D tensor of scalar-type in {:code:`int8`, :code:`float8_e5m2`, :code:`float16`, :code:`bfloat16`, :code:`float32`}
    :param acc: The accumulator tensor. If not None, the result is added to this tensor.
    :type acc: 2D or 3D tensor of scalar-type in {:code:`float16`, :code:`float32`, :code:`int32`}
    :param input_precision: How to exercise the Tensor Cores for f32 x f32. If
      the device does not have Tensor Cores or the inputs are not of dtype f32,
      this option is ignored. For devices that do have tensor cores, the
      default precision is tf32.
    :type input_precision: string. Available options for nvidia: :code:`"tf32"`, :code:`"tf32x3"`, :code:`"ieee"`. Default: :code:`"tf32"`. Available options for amd: :code:`"ieee"`, (CDNA3 only) :code:`"tf32"`.
    :param allow_tf32: *Deprecated.* If true, input_precision is set to "tf32".
      Only one of :code:`input_precision` and :code:`allow_tf32` can be
      specified (i.e. at least one must be :code:`None`).
    Nz;Only one of input_precision and allow_tf32 can be specifiedÚtf32Úieeer   z*input and other must have equal ranks >= 2éþÿÿÿz,input and other must have equal batch shapeséÿÿÿÿz4input and other must have equal reduction dimensionsz!accumulator shape is incompatibleé   r;   Frä  zoutput shape is unexpected)rƒ   r©  Úallowed_dot_input_precisionsr   ÚlanguageÚfp32_defaultr±   rH   rì  rD   r  rË  rÂ  Údot)rÅ  rt   ÚaccÚinput_precisionÚ
allow_tf32Úmax_num_imprecise_accÚ	out_dtyper,   Úsupports_tf32Úa_shapeÚb_shapeÚc_shaperÕ  Ú
batch_sizerË  Úress                   r"   rú  rú  ë  s»  € ð< Ð" jÐ&8Ð&8Ð:wÑ&8Ô&8Ð8ØÐØ )Ô"3Ô";Ô"XÐXˆÝœ.Ô5ð vÀ]ð ;uØFPð;uØT^ÐTfð ;A¸&Øntð 	õ +¨?Ñ;Ô;€OÝ$ YÑ/Ô/€IÝ0Ð1FÑGÔGÐÝ
˜sÑ
#Ô
#€Cõ �5”;ÑÔ€GÝ�5”;ÑÔ€GÝˆw‰<Œ<�3˜w™<œ<Ð,Ð,Ò,Ð,¨1Ò,Ð,Ð,Ð,Ð,Ð.ZÑ,Ô,Ð,Ø�3�B�3Œ<˜7 3 B 3œ<Ò'Ð'Ð'Ð)WÑ'Ô'Ð'Ø�2Œ;˜' "œ+Ò%Ð%Ð%Ð']Ñ%Ô%Ð%ð �c�r�cŒl˜g bœk˜]Ñ*€GØ
€Ý�C”I‰Œ 'Ò)Ð)Ð)Ð+NÑ)Ô)Ð)Ýˆw‰<Œ<€Dàˆq‚y€yØˆ
Ý”  q¡Ñ)Ô)ð 	%ð 	%ˆAØ˜' !œ*Ñ$ˆJˆJØ×!Ò! %¨*¨¸ÀÀÀ¼Ñ)DÐRWÐ!ÑXÔXˆØ×!Ò! %¨*¨¸ÀÀÀ¼Ñ)DÐRWÐ!ÑXÔXˆØˆ?Ø×#Ò# C¨*¨¸ÀÀÀ¼Ñ)DÐRWÐ#ÑXÔXˆCà
�-Š-˜˜u c¨?Ð<QÐS\Ñ
]Ô
]€Càˆq‚y€yØ×Ò  W¸%ÐÑ@Ô@ˆå�”	‰?Œ?˜gÒ%Ð%Ð%Ð'CÑ%Ô%Ð%Ø€Jr$   c                ó¦   — t          |
¦  «        }
t          |¦  «        }|
t          k    s
J d¦   «         ‚|                     | |||||||||	|
¦  «        S )a:	  
    Returns the matrix product of two blocks in microscaling format.

    lhs and rhs use microscaling formats described here:
    https://www.opencompute.org/documents/ocp-microscaling-formats-mx-v1-0-spec-final-pdf

    Software emulation enables targeting hardware architectures without native microscaling
    operation support. Right now for such case, microscaled lhs/rhs are upcasted to
    :code:`bf16` element type beforehand for dot computation, with one exception:
    for AMD CDNA3 specifically, if one of the inputs is of :code:`fp16` element type,
    the other input is also upcasted to :code:`fp16` element type instead.
    This behavior is experimental and may be subject to change in the future.

    :param lhs: The first tensor to be multiplied.
    :type lhs: 2D tensor representing fp4, fp8 or bf16 elements. Fp4 elements are packed into uint8 inputs with the first element in lower bits. Fp8 are stored as uint8 or the corresponding fp8 type.
    :param lhs_scale: Scale factor for lhs tensor. Shape should be [M, K//group_size] when lhs is [M, K], where group_size is 32 if scales type are `e8m0`.
    :type lhs_scale: e8m0 type represented as an uint8 tensor, or None.
    :param lhs_format: format of the lhs tensor. Available formats: {:code:`e2m1`, :code:`e4m3`, :code:`e5m2`, :code:`bf16`, :code:`fp16`}.
    :type lhs_format: str
    :param rhs: The second tensor to be multiplied.
    :type rhs: 2D tensor representing fp4, fp8 or bf16 elements. Fp4 elements are packed into uint8 inputs with the first element in lower bits. Fp8 are stored as uint8 or the corresponding fp8 type.
    :param rhs_scale: Scale factor for rhs tensor. Shape should be [N, K//group_size] where rhs is [K, N].
                      Important: Do NOT transpose rhs_scale
    :type rhs_scale: e8m0 type represented as an uint8 tensor, or None.
    :param rhs_format: format of the rhs tensor. Available formats: {:code:`e2m1`, :code:`e4m3`, :code:`e5m2`, :code:`bf16`, :code:`fp16`}.
    :type rhs_format: str
    :param acc: The accumulator tensor. If not None, the result is added to this tensor.
    :param lhs_k_pack: If false, the lhs tensor is packed into uint8 along M dimension.
    :type lhs_k_pack: bool, optional
    :param rhs_k_pack: If false, the rhs tensor is packed into uint8 along N dimension.
    :type rhs_k_pack: bool, optional
    z5Only float32 is supported for out_dtype at the moment)r±   Úfloat32Ú
dot_scaled)ÚlhsÚ	lhs_scaleÚ
lhs_formatÚrhsÚ	rhs_scaleÚ
rhs_formatrû  Ú	fast_mathÚ
lhs_k_packÚ
rhs_k_packrÿ  r,   s               r"   r  r  3  sk   € õF % YÑ/Ô/€IÝ
˜sÑ
#Ô
#€CØ�ÒÐÐÐ!XÑÔÐØ×Ò  Y°
¸CÀÈJÐX[Ð]fÐhrØ *¨Iñ7ô 7ð 7r$   r?   r<   c	           
     óJ  — t          |¦  «        }t          |¦  «        }|�|                     |¦  «        }|�|                     |¦  «        }t          |¦  «        }t          |¦  «        }t          |¦  «        }t          |¦  «        }|                     | |||||||¦  «        S )uz	  
    Return a tensor of data whose values are loaded from memory at location defined by `pointer`:

        (1) If `pointer` is a single element pointer, a scalar is be loaded.  In
            this case:

            - `mask` and `other` must also be scalars,
            - `other` is implicitly typecast to `pointer.dtype.element_ty`, and
            - `boundary_check` and `padding_option` must be empty.

        (2) If `pointer` is an N-dimensional tensor of pointers, an
            N-dimensional tensor is loaded.  In this case:

            - `mask` and `other` are implicitly broadcast to `pointer.shape`,
            - `other` is implicitly typecast to `pointer.dtype.element_ty`, and
            - `boundary_check` and `padding_option` must be empty.

        (3) If `pointer` is a block pointer defined by `make_block_ptr`, a
            tensor is loaded.  In this case:

            - `mask` and `other` must be `None`, and
            - `boundary_check` and `padding_option` can be specified to control the behavior of out-of-bound access.

    :param pointer: Pointer to the data to be loaded
    :type pointer: `triton.PointerType`, or block of `dtype=triton.PointerType`
    :param mask: if `mask[idx]` is false, do not load the data at address `pointer[idx]`
        (must be `None` with block pointers)
    :type mask: Block of `triton.int1`, optional
    :param other: if `mask[idx]` is false, return `other[idx]`
    :type other: Block, optional
    :param boundary_check: tuple of integers, indicating the dimensions which should do the boundary check
    :type boundary_check: tuple of ints, optional
    :param padding_option: should be one of {"", "zero", "nan"}, the padding value to use while out of bounds. "" means an undefined value.
    :param cache_modifier: changes cache option in NVIDIA PTX
    :type cache_modifier: str, optional, should be one of {"", ".ca", ".cg", ".cv"}, where ".ca" stands for
        cache at all levels, ".cg" stands for cache at global level (cache in L2 and below, not L1),
        and ".cv" means donâ€™t cache and fetch again. see
        `cache operator <https://docs.nvidia.com/cuda/parallel-thread-execution/index.html#cache-operators>`_ for more details.
    :param eviction_policy: changes eviction policy in NVIDIA PTX
    :type eviction_policy: str, optional
    :param volatile: changes volatile option in NVIDIA PTX
    :type volatile: bool, optional
    )r±   r^   rj  )	ÚpointerrÇ  rt   rÈ  Úpadding_optionrÉ  rÊ  Úvolatiler,   s	            r"   rj  rj  b  s®   € õ^   Ñ%Ô%€DÝ  Ñ'Ô'€EØÐØ×"Ò" 4Ñ(Ô(ˆØÐØ×#Ò# EÑ*Ô*ˆÝ)¨.Ñ9Ô9€NÝ)¨.Ñ9Ô9€NÝ*¨?Ñ;Ô;€OÝ# HÑ-Ô-€HØ�>Š>˜' 4¨°ÀÐP^Ð`oØ"ñ$ô $ð $r$   ÚdescrÍ  rg  c                ó0   — |                       ||¬¦  «        S )z.Load a block of data from a tensor descriptor.r¯  )rj  )r  rÍ  r,   s      r"   Úload_tensor_descriptorr  Ÿ  s   € ð �9Š9�W¨	ˆ9Ñ2Ô2Ð2r$   r’   c                ó2   — |                       |||¬¦  «        S )z-Store a block of data to a tensor descriptor.r¯  )rË  )r  rÍ  r’   r,   s       r"   Ústore_tensor_descriptorr  ¦  s   € ð �:Š:�g˜u°	ˆ:Ñ:Ô:Ð:r$   c                óè   — |                      |¦  «        }t          |¦  «        }|�|                      |¦  «        }t          |¦  «        }t          |¦  «        }|                     | |||||¦  «        S )aý  
    Store a tensor of data into memory locations defined by `pointer`.

        (1) If `pointer` is a single element pointer, a scalar is stored.  In
            this case:

            - `mask` must also be scalar, and
            - `boundary_check` and `padding_option` must be empty.

        (2) If `pointer` is an N-dimensional tensor of pointers, an
            N-dimensional block is stored.  In this case:

            - `mask` is implicitly broadcast to `pointer.shape`, and
            - `boundary_check` must be empty.

        (3) If `pointer` is a block pointer defined by `make_block_ptr`, a block
            of data is stored.  In this case:

            - `mask` must be None, and
            - `boundary_check` can be specified to control the behavior of out-of-bound access.

    `value` is implicitly broadcast to `pointer.shape` and typecast to `pointer.dtype.element_ty`.

    :param pointer: The memory location where the elements of `value` are stored
    :type pointer: `triton.PointerType`, or block of `dtype=triton.PointerType`
    :param value: The tensor of elements to be stored
    :type value: Block
    :param mask: If `mask[idx]` is false, do not store `value[idx]` at `pointer[idx]`
    :type mask: Block of triton.int1, optional
    :param boundary_check: tuple of integers, indicating the dimensions which should do the boundary check
    :type boundary_check: tuple of ints, optional
    :param cache_modifier: changes cache option in NVIDIA PTX
    :type cache_modifier: str, optional, should be one of {"", ".wb", ".cg", ".cs", ".wt"}, where ".wb" stands for
        cache write-back all coherent levels, ".cg" stands for cache global, ".cs" stands for cache streaming, ".wt"
        stands for cache write-through, see `cache operator <https://docs.nvidia.com/cuda/parallel-thread-execution/index.html#cache-operators>`_ for more details.
    :param eviction_policy: changes eviction policy in NVIDIA PTX
    :type eviction_policy: str, optional, should be one of {"", "evict_first", "evict_last"}
    )r^   r±   rË  )r  r’   rÇ  rÈ  rÉ  rÊ  r,   s          r"   rË  rË  ­  su   € ðT ×Ò Ñ&Ô&€EÝ Ñ%Ô%€DØÐØ×"Ò" 4Ñ(Ô(ˆÝ)¨.Ñ9Ô9€NÝ*¨?Ñ;Ô;€OØ�?Š?˜7 E¨4°ÀÐQ`ÑaÔaÐar$   Úbasec                óT   — t          d¦  «         |                     | |||||¦  «        S )ak  
    Returns a pointer to a block in a parent tensor

    :param base: The base pointer to the parent tensor
    :param shape: The shape of the parent tensor
    :param strides: The strides of the parent tensor
    :param offsets: The offsets to the block
    :param block_shape: The shape of the block
    :param order: The order of the original data format
    z[tl.make_block_ptr is deprecated. Use TensorDescriptor or tl.make_tensor_descriptor instead.)r   Úmake_block_ptr)r  rì  r‰  rÍ  rd  rÖ  r,   s          r"   r  r  à  s2   € õ 	Ð	fÑgÔgÐgØ×#Ò# D¨%°¸'À;ÐPUÑVÔVÐVr$   zŠNote that tl.advance does not have any side effects. To move the block pointer, you need to assign the result of tl.advance to a variable.c                ó.   — |                      | |¦  «        S )z‘
    Advance a block pointer

    :param base: the block pointer to advance
    :param offsets: the offsets to advance, a tuple by dimension
    )rÎ  )r  rÍ  r,   s      r"   rÎ  rÎ  ð  s   € ð ×Ò˜T 7Ñ+Ô+Ð+r$   Úzerorì  r�  r‰  rd  úList[constexpr]c                óR   — t          |¦  «        }|                     | ||||¦  «        S )a�  Make a tensor descriptor object

    :param base: the base pointer of the tensor, must be 16-byte aligned
    :param shape: A list of non-negative integers representing the tensor shape
    :param strides: A list of tensor strides. Leading dimensions must be multiples
        of 16-byte strides and the last dimension must be contiguous.
    :param block_shape: The shape of block to be loaded/stored from global memory

    Notes
    *****
    On NVIDIA GPUs with TMA support, this will result in a TMA descriptor object
    and loads and stores from the descriptor will be backed by the TMA hardware.

    Currently only 2-5 dimensional tensors are supported.

    Example
    *******
    .. code-block:: python

        @triton.jit
        def inplace_abs(in_out_ptr, M, N, M_BLOCK: tl.constexpr, N_BLOCK: tl.constexpr):
            desc = tl.make_tensor_descriptor(
                in_out_ptr,
                shape=[M, N],
                strides=[N, 1],
                block_shape=[M_BLOCK, N_BLOCK],
            )

            moffset = tl.program_id(0) * M_BLOCK
            noffset = tl.program_id(1) * N_BLOCK

            value = desc.load([moffset, noffset])
            desc.store([moffset, noffset], tl.abs(value))

        # TMA descriptors require a global memory allocation
        def alloc_fn(size: int, alignment: int, stream: Optional[int]):
            return torch.empty(size, device="cuda", dtype=torch.int8)

        triton.set_allocator(alloc_fn)

        M, N = 256, 256
        x = torch.randn(M, N, device="cuda")
        M_BLOCK, N_BLOCK = 32, 32
        grid = (M / M_BLOCK, N / N_BLOCK)
        inplace_abs[grid](x, M, N, M_BLOCK, N_BLOCK)

    )r±   Úmake_tensor_descriptor)r  rì  r‰  rd  r  r,   s         r"   r#  r#  ÿ  s.   € õr *¨.Ñ9Ô9€NØ×+Ò+¨D°%¸À+È~Ñ^Ô^Ð^r$   rB   r&   Úhas_cmpúCallable[[T], T]c                ó   ‡ ‡— dˆˆ fd„}|S )NÚfuncr   r)   c                ó:   •— d‰› d�}‰r|dz  }|dz  }|| _         | S )Nz
    Performs an atomic zï at the memory location specified by :code:`pointer`.

    Return the data stored at :code:`pointer` before the atomic operation.

    :param pointer: The memory locations to operate on
    :type pointer: Block of dtype=triton.PointerDTypez|
    :param cmp: The values expected to be found in the atomic object
    :type cmp: Block of dtype=pointer.dtype.element_tyaÃ  
    :param val: The values with which to perform the atomic operation
    :type val: Block of dtype=pointer.dtype.element_ty
    :param sem: Specifies the memory semantics for the operation. Acceptable values are "acquire",
        "release", "acq_rel" (stands for "ACQUIRE_RELEASE"), and "relaxed". If not provided,
        the function defaults to using "acq_rel" semantics.
    :type sem: str, optional
    :param scope: Defines the scope of threads that observe the synchronizing effect of the atomic operation.
        Acceptable values are "gpu" (default), "cta" (cooperative thread array, thread block), or "sys" (stands for "SYSTEM"). The default value is "gpu".
    :type scope: str, optional
    )rF   )r'  Údocstrr$  rB   s     €€r"   Ú
_decoratorz&_add_atomic_docstr.<locals>._decoratorC	  sT   ø€ ð9Øð9ð 9ð 9ˆð ð 	:Øð :ñ :ˆFð 	ð 
ñ 
	ˆð ˆŒØˆr$   ©r'  r   r)   r   r?   )rB   r$  r*  s   `` r"   Ú_add_atomic_docstrr,  A	  s/   øø€ ðð ð ð ð ð ð ð4 Ðr$   zcompare-and-swap)r$  c                óÄ   — |                      |¦  «        }|                      |¦  «        }t          |¦  «        }t          |¦  «        }|                     | ||||¦  «        S r   )r^   r±   rÓ  )r  rÐ  r¡   rÑ  rÒ  r,   s         r"   rÓ  rÓ  `	  s`   € ð ×
Ò
˜cÑ
"Ô
"€CØ
×
Ò
˜cÑ
"Ô
"€CÝ
˜sÑ
#Ô
#€CÝ  Ñ'Ô'€EØ×Ò ¨¨c°3¸Ñ>Ô>Ð>r$   Úexchangec                ó¸   — |                      |¦  «        }t          |¦  «        }t          |¦  «        }t          |¦  «        }|                     | ||||¦  «        S r   )r^   r±   rÖ  ©r  r¡   rÇ  rÑ  rÒ  r,   s         r"   rÖ  rÖ  k	  sZ   € ð ×
Ò
˜cÑ
"Ô
"€CÝ
˜sÑ
#Ô
#€CÝ  Ñ'Ô'€EÝ Ñ%Ô%€DØ× Ò  ¨#¨t°S¸%Ñ@Ô@Ð@r$   r>  c                ó¸   — |                      |¦  «        }t          |¦  «        }t          |¦  «        }t          |¦  «        }|                     | ||||¦  «        S r   )r^   r±   rØ  r0  s         r"   rØ  rØ  v	  óZ   € ð ×
Ò
˜cÑ
"Ô
"€CÝ
˜sÑ
#Ô
#€CÝ  Ñ'Ô'€EÝ Ñ%Ô%€DØ×Ò ¨¨d°C¸Ñ?Ô?Ð?r$   r  c                ó¸   — |                      |¦  «        }t          |¦  «        }t          |¦  «        }t          |¦  «        }|                     | ||||¦  «        S r   )r^   r±   rÚ  r0  s         r"   rÚ  rÚ  �	  r2  r$   r  c                ó¸   — |                      |¦  «        }t          |¦  «        }t          |¦  «        }t          |¦  «        }|                     | ||||¦  «        S r   )r^   r±   rÜ  r0  s         r"   rÜ  rÜ  Œ	  r2  r$   zlogical andc                ó¸   — |                      |¦  «        }t          |¦  «        }t          |¦  «        }t          |¦  «        }|                     | ||||¦  «        S r   )r^   r±   rÞ  r0  s         r"   rÞ  rÞ  —	  r2  r$   z
logical orc                ó¸   — |                      |¦  «        }t          |¦  «        }t          |¦  «        }t          |¦  «        }|                     | ||||¦  «        S r   )r^   r±   rà  r0  s         r"   rà  rà  ¢	  sZ   € ð ×
Ò
˜cÑ
"Ô
"€CÝ
˜sÑ
#Ô
#€CÝ  Ñ'Ô'€EÝ Ñ%Ô%€DØ×Ò˜w¨¨T°3¸Ñ>Ô>Ð>r$   zlogical xorc                ó¸   — |                      |¦  «        }t          |¦  «        }t          |¦  «        }t          |¦  «        }|                     | ||||¦  «        S r   )r^   r±   râ  r0  s         r"   râ  râ  ­	  r2  r$   c                ó–   — |                      | ¦  «        } t          |¦  «        }t          |¦  «        }|                     | ||¦  «        S )aé  
    Returns a tensor of elements from either :code:`x` or :code:`y`, depending on :code:`condition`.

    Note that :code:`x` and :code:`y` are always evaluated regardless of the value of :code:`condition`.

    If you want to avoid unintended memory operations, use the :code:`mask` arguments in `triton.load` and `triton.store` instead.

    The shape of :code:`x` and :code:`y` are both broadcast to the shape of :code:`condition`.
    :code:`x` and :code:`y` must have the same data type.

    :param condition: When True (nonzero), yield x, otherwise yield y.
    :type condition: Block of triton.bool
    :param x: values selected at indices where condition is True.
    :param y: values selected at indices where condition is False.
    )r^   r±   Úwhere)Ú	conditionr!   Úyr,   s       r"   r9  r9  ½	  sG   € ð" ×#Ò# IÑ.Ô.€IÝ˜QÑÔ€AÝ˜QÑÔ€AØ�?Š?˜9 a¨Ñ+Ô+Ð+r$   r<  c                ól   — t          | ¦  «        } t          |¦  «        }|                     | ||¦  «        S r   )r±   r>  ©r!   r;  r<  r,   s       r"   r>  r>  Ù	  ó3   € å˜QÑÔ€AÝ˜QÑÔ€AØ�=Š=˜˜AÐ0Ñ1Ô1Ð1r$   c                ól   — t          | ¦  «        } t          |¦  «        }|                     | ||¦  «        S r   )r±   rE  r=  s       r"   rE  rE  à	  r>  r$   c                ól   — t          | ¦  «        } t          |¦  «        }|                     | ||¦  «        S r   )r±   rI  r=  s       r"   rI  rI  ç	  r>  r$   Úpropagate_nanc                óæ   — |                      | ¦  «        } |                      |¦  «        }t          | |¬¦  «        } t          ||¬¦  «        }t          |¦  «        }|                     | ||¦  «        S )aH  
    Computes the element-wise minimum of :code:`x` and :code:`y`.

    :param x: the first input tensor
    :type x: Block
    :param y: the second input tensor
    :type y: Block
    :param propagate_nan: whether to propagate NaN values.
    :type propagate_nan: tl.PropagateNan

    .. seealso:: :class:`tl.PropagateNan`
    r¯  )r^   Ú_promote_bfloat16_to_float32r±   Úminimum©r!   r;  rA  r,   s       r"   rD  rD  î	  ós   € ð 	×Ò˜AÑÔ€AØ×Ò˜AÑÔ€AÝ$ Q°)Ð<Ñ<Ô<€AÝ$ Q°)Ð<Ñ<Ô<€AÝ(¨Ñ7Ô7€MØ×Ò˜Q  =Ñ1Ô1Ð1r$   c                óæ   — |                      | ¦  «        } |                      |¦  «        }t          | |¬¦  «        } t          ||¬¦  «        }t          |¦  «        }|                     | ||¦  «        S )aH  
    Computes the element-wise maximum of :code:`x` and :code:`y`.

    :param x: the first input tensor
    :type x: Block
    :param y: the second input tensor
    :type y: Block
    :param propagate_nan: whether to propagate NaN values.
    :type propagate_nan: tl.PropagateNan

    .. seealso:: :class:`tl.PropagateNan`
    r¯  )r^   rC  r±   ÚmaximumrE  s       r"   rH  rH  
  rF  r$   c                ó4  — |                      | ¦  «        } |                      |¦  «        }|                      |¦  «        }t          | |¬¦  «        } t          ||¬¦  «        }t          ||¬¦  «        }t          |¦  «        }|                     | |||¦  «        S )a<  
    Clamps the input tensor :code:`x` within the range [min, max].
    Behavior when :code:`min` > :code:`max` is undefined.

    :param x: the input tensor
    :type x: Block
    :param min: the lower bound for clamping
    :type min: Block
    :param max: the upper bound for clamping
    :type max: Block
    :param propagate_nan: whether to propagate NaN values. Applies only to the :code:`x` tensor.
        If either :code:`min` or :code:`max` is NaN, the result is undefined.
    :type propagate_nan: tl.PropagateNan

    .. seealso:: :class:`tl.PropagateNan`
    r¯  )r^   rC  r±   Úclamp)r!   r  r  rA  r,   s        r"   rJ  rJ  
  s˜   € ð$ 	×Ò˜AÑÔ€AØ
×
Ò
˜cÑ
"Ô
"€CØ
×
Ò
˜cÑ
"Ô
"€CÝ$ Q°)Ð<Ñ<Ô<€AÝ
& s°iÐ
@Ñ
@Ô
@€CÝ
& s°iÐ
@Ñ
@Ô
@€Cå(¨Ñ7Ô7€Mà�?Š?˜1˜c 3¨Ñ6Ô6Ð6r$   Úreturn_indices_argÚtie_break_argÚ	dtype_argc                ó    ‡ ‡‡‡— dˆˆ ˆˆfd„}|S )Nr'  r   r)   c                ó¨   •— d}‰�|d‰› d‰› d‰› d�z  }‰�|d‰› d‰› d‰› d�z  }‰�|d‰› d‰› d	‰› d
�z  }|                      ‰¬¦  «        | _        | S )Na~  
    Returns the {name} of all elements in the :code:`input` tensor along the provided :code:`axis`

    :param input: the input values
    :type input: Tensor
    :param axis: the dimension along which the reduction should be done. If None, reduce all dimensions
    :type axis: int
    :param keep_dims: if true, keep the reduced dimensions with length 1
    :type keep_dims: boolú
    :param z-: if true, return index corresponding to the z value
    :type z: boolzC: if true, in case of a tie (i.e., multiple elements have the same zI value), return the left-most index for values that aren't NaN
    :type úc: the desired data type of the returned tensor. If specified, the input tensor is casted to :code:`zæ` before the operation is performed. This is useful for preventing data overflows. If not specified, integer and bool dtypes are upcasted to :code:`tl.int32` and float dtypes are upcasted to at least :code:`tl.float32`.
    :type ú
: tl.dtyperA   ©ÚformatrF   )r'  r)  rM  rB   rK  rL  s     €€€€r"   r*  z)_add_reduction_docstr.<locals>._decorator@
  só   ø€ ðˆð Ð)Øð (Øð(ð (ØMQð(ð (àð(ð (ð (ñ (ˆFð Ð$Øð #Øð#ð #Ø^bð#ð #àð#ð #ð #ñ #ˆFð Ð Øð #Øð#ð #ð {Dð#ð #àð#ð #ð #ñ #ˆFð —}’}¨$�}Ñ/Ô/ˆŒØˆr$   r+  r?   )rB   rK  rL  rM  r*  s   ```` r"   Ú_add_reduction_docstrrU  =
  s;   øøøø€ ðð ð ð ð ð ð ð ð ð4 Ðr$   c              #  ód   K  — |                       ¦   «         }d V — |                      |¦  «         d S r   )Úget_insertion_pointÚrestore_insertion_point)rƒ   Úips     r"   Ú_insertion_guardrZ  ]
  s:   è è € à	×	$Ò	$Ñ	&Ô	&€BØ	€E€E€EØ×#Ò# BÑ'Ô'Ð'Ð'Ð'r$   c                óÆ  ‡ ‡‡‡‡‡— t          ‰ t          ¦  «        rt          ‰ f‰‰|‰‰¬¦  «        d         S ˆˆˆˆ fd„}ˆfd„Št          ‰¦  «        Št          |¦  «        }‰�(t	          ‰t          ‰ d         j        ¦  «        ¦  «        Š‰                     ‰ ‰|¦  «        }|r;‰�t          ˆˆfd„|D ¦   «         ¦  «        }nt          ˆˆ fd„|D ¦   «         ¦  «        }|S )a'  Applies the combine_fn to all elements in :code:`input` tensors along the provided :code:`axis`

    :param input: the input tensor, or tuple of tensors
    :type input: Tensor
    :param axis: the dimension along which the reduction should be done. If None, reduce all dimensions
    :type axis: int | None
    :param combine_fn: a function to combine two groups of scalar tensors (must be marked with @triton.jit)
    :type combine_fn: Callable
    :param keep_dims: if true, keep the reduced dimensions with length 1
    :type keep_dims: bool

    ©ró  r,   r:   r   c           
     óì  •‡‡— d„ ‰D ¦   «         dz  }|                       d¦  «        }‰
j        Št          ‰¦  «        5  ˆfd„}‰                     |t	          t          ||¦  «        ¦  «        ¦  «        Šˆfd„t          |¦  «        D ¦   «         }‰	                     ‰|i ¬¦  «        }t          |t          ¦  «        r	|j
        g}nd„ |D ¦   «         } ‰j        |Ž  d d d ¦  «         d S # 1 swxY w Y   d S )Nc                ó&   — g | ]}|j         j        ‘ŒS r?   ©rf   r  ©r  r  s     r"   r  z7reduce.<locals>.make_combine_region.<locals>.<listcomp>w
  ó   € Ð4Ð4Ð4¨�q”v”}Ð4Ð4Ð4r$   r   r   c                ó.   •— |                       ‰¦  «        S r   ©r¦  ©r   rƒ   s    €r"   r#   z5reduce.<locals>.make_combine_region.<locals>.<lambda>{
  ó   ø€ ˜aŸgšg gÑ.Ô.€ r$   c                ó\   •— g | ](\  }}t          ‰                     |¦  «        |¦  «        ‘Œ)S r?   ©rM   rž  ©r  rË  r  Úblocks      €r"   r  z7reduce.<locals>.make_combine_region.<locals>.<listcomp>}
  ó1   ø€ ÐQÐQÐQ±°°B•F˜5Ÿ9š9 Q™<œ<¨Ñ,Ô,ÐQÐQÐQr$   ©r1   c                ó   — g | ]	}|j         ‘Œ
S r?   ©r2  ©r  Úrs     r"   r  z7reduce.<locals>.make_combine_region.<locals>.<listcomp>‚
  ó   € Ð5Ð5Ð5¨˜1œ8Ð5Ð5Ð5r$   )Ú
get_regionrƒ   rZ  Úcreate_block_with_parentrH   r  r   Úcall_JitFunctionr%   rM   r2  Úcreate_reduce_ret)Ú	reduce_opÚparam_typesÚregionr¦  r0   Úresultsrg   ri  rƒ   r:   r,   rò  rÅ  s          @@€€€€r"   Úmake_combine_regionz#reduce.<locals>.make_combine_regionv
  s[  øøø€ Ø4Ð4¨eÐ4Ñ4Ô4°qÑ8ˆØ×%Ò% aÑ(Ô(ˆØÔ#ˆÝ˜gÑ&Ô&ð 		0ð 		0Ø.Ð.Ð.Ð.ˆEØ×4Ò4°V½TÅ#ÀeÈ[ÑBYÔBYÑ=ZÔ=ZÑ[Ô[ˆEØQÐQÐQÐQ½)ÀKÑ:PÔ:PÐQÑQÔQˆDØ ×1Ò1°*¸dÈ2Ð1ÑNÔNˆGÝ˜'¥6Ñ*Ô*ð 6Ø"œ>Ð*��à5Ð5¨WÐ5Ñ5Ô5�Ø%ˆGÔ% wÐ/Ð/ð		0ð 		0ð 		0ñ 		0ô 		0ð 		0ð 		0ð 		0ð 		0ð 		0ð 		0ð 		0øøøð 		0ð 		0ð 		0ð 		0ð 		0ð 		0ó   ¾BC)Ã)C-Ã0C-c                óZ   •— t          j        |¦  «        D ]}t          | d‰¬¦  «        } Œ| S )Nr   r¯  )r  rË  r¡  )r  Úndimsr  r,   s      €r"   Úexpand_ndimszreduce.<locals>.expand_ndims…
  s7   ø€ Ý” Ñ&Ô&ð 	7ð 	7ˆAÝ˜A˜q¨IÐ6Ñ6Ô6ˆAˆAØˆr$   Nc              3  ó<   •K  — | ]}t          |‰‰¬ ¦  «        V — ŒdS )r¯  N)r¡  )r  r  r,   rÄ  s     €€r"   r  zreduce.<locals>.<genexpr>‘
  s2   øè è € ÐOÐOÀa� A t°yÐAÑAÔAÐOÐOÐOÐOÐOÐOr$   c              3  ó`   •K  — | ](} ‰|t          ‰d          j        ¦  «        ¦  «        V — Œ)dS )r   N)rD   rì  )r  r  r}  rÅ  s     €€r"   r  zreduce.<locals>.<genexpr>“
  s=   øè è € ÐJÐJÀ˜˜ Q­¨E°!¬H¬NÑ(;Ô(;Ñ<Ô<ÐJÐJÐJÐJÐJÐJr$   )	r%   rM   rô  r±   rÒ  rD   rì  Ú	reductionr  )	rÅ  rÄ  rò  ró  r,   r:   ry  r§  r}  s	   ``` ``  @r"   rô  rô  d
  s:  øøøøøø€ õ �%�Ñ Ô ð wÝ�u�i  z¸YÐR[ÐhrÐsÑsÔsÐtuÔvÐvð0ð 0ð 0ð 0ð 0ð 0ð 0ð 0ðð ð ð ð õ
   Ñ%Ô%€DÝ$ YÑ/Ô/€IØÐÝ˜$¥ E¨!¤H¤NÑ 3Ô 3Ñ4Ô4ˆØ
×
Ò
˜e TÐ+>Ñ
?Ô
?€CØð KØÐÝÐOÐOÐOÐOÐOÈ3ÐOÑOÔOÑOÔOˆCˆCåÐJÐJÐJÐJÐJÀcÐJÑJÔJÑJÔJˆCØ€Jr$   c                óh   — | j         j        }|t          u r|                      t          |¬¦  «        S | S )Nr¯  )rf   r  Úbfloat16r±  r  )r  r,   rü  s      r"   rC  rC  —
  s3   € à””€Ið •HÐÐØ�tŠt•G yˆtÑ1Ô1Ð1Ø€Hr$   c                ó‚  — t          |¦  «        }| j        |         }t          d||¬¦  «        }t          | j        ¦  «        dk    r\d„ t	          j        t          | j        ¦  «        ¦  «        D ¦   «         }||= t          |||¬¦  «        }t          || j        |¬¦  «        }t          | |f|||||¬¦  «        \  }	}
|	|
fS )Nr   r¯  r;   c                ó,   — g | ]}t          |¦  «        ‘ŒS r?   r0  )r  rÝ  s     r"   r  z(_reduce_with_indices.<locals>.<listcomp>©
  s   € ÐQÐQÐQ¨1�) A™,œ,ÐQÐQÐQr$   r\  )	r±   rì  r»  rD   r  rË  r¡  r´  rô  )rÅ  rÄ  rò  ró  r,   r:   rÌ  r  Úaxes_to_expandÚrvalueÚrindicess              r"   Ú_reduce_with_indicesrˆ  ¡
  sÓ   € å Ñ%Ô%€DØŒ�DÔ€AÝ�1�a 9Ð-Ñ-Ô-€Eå
ˆ5Œ;ÑÔ˜!ÒÐàQÐQµ´½sÀ5Ä;Ñ?OÔ?OÑ0PÔ0PÐQÑQÔQˆØ˜4Ð Ý˜E >¸YÐGÑGÔGˆÝ˜U E¤K¸9ÐEÑEÔEˆå˜u e˜n¨d°JÈ)Ð_hØ)3ð5ñ 5ô 5Ñ€FˆHà�8ÐÐr$   c                ó   ‡ ‡— dˆˆ fd„}|S )Nr'  r   r)   c                ód   •— d}‰�|d‰› d‰› d‰› d�z  }|                      ‰¬¦  «        | _        | S )NaZ  
    Returns the {name} of all elements in the :code:`input` tensor along the provided :code:`axis`

    :param input: the input values
    :type input: Tensor
    :param axis: the dimension along which the scan should be done
    :type axis: int
    :param reverse: if true, the scan is performed in the reverse direction
    :type reverse: boolrP  rQ  zÚ` before the operation is performed. If not specified, small integer types (< 32 bits) are upcasted to prevent overflow. Note that :code:`tl.bfloat16` inputs are automatically promoted to :code:`tl.float32`.
    :type rR  rA   rS  )r'  r)  rM  rB   s     €€r"   r*  z$_add_scan_docstr.<locals>._decoratorº
  sm   ø€ ðˆð Ð Øð #Øð#ð #ð {Dð#ð #àð#ð #ð #ñ #ˆFð —}’}¨$�}Ñ/Ô/ˆŒØˆr$   r+  r?   )rB   rM  r*  s   `` r"   Ú_add_scan_docstrr‹  ¸
  s/   øø€ ðð ð ð ð ð ð ð& Ðr$   c                ó  ‡ ‡‡‡— t          ‰ t          ¦  «        rt          ‰ f|‰|‰‰¬¦  «        d         S ˆˆˆˆ fd„}t          |¦  «        }|�(t	          |t          ‰ d         j        ¦  «        ¦  «        }‰                     ‰ |||¦  «        S )a6  Applies the combine_fn to each elements with a carry in :code:`input` tensors along the provided :code:`axis` and update the carry

    :param input: the input tensor, or tuple of tensors
    :type input: Tensor
    :param axis: the dimension along which the reduction should be done
    :type axis: int
    :param combine_fn: a function to combine two groups of scalar tensors (must be marked with @triton.jit)
    :type combine_fn: Callable
    :param reverse: whether to apply the associative scan in the reverse direction along axis
    :type reverse: bool

    r¢  r   c           
     óì  •‡‡— d„ ‰D ¦   «         dz  }|                       d¦  «        }‰
j        Št          ‰¦  «        5  ˆfd„}‰                     |t	          t          ||¦  «        ¦  «        ¦  «        Šˆfd„t          |¦  «        D ¦   «         }‰	                     ‰|i ¬¦  «        }t          |t          ¦  «        r	|j
        g}nd„ |D ¦   «         } ‰j        |Ž  d d d ¦  «         d S # 1 swxY w Y   d S )Nc                ó&   — g | ]}|j         j        ‘ŒS r?   r_  r`  s     r"   r  zAassociative_scan.<locals>.make_combine_region.<locals>.<listcomp>ã
  ra  r$   r   r   c                ó.   •— |                       ‰¦  «        S r   rc  rd  s    €r"   r#   z?associative_scan.<locals>.make_combine_region.<locals>.<lambda>ç
  re  r$   c                ó\   •— g | ](\  }}t          ‰                     |¦  «        |¦  «        ‘Œ)S r?   rg  rh  s      €r"   r  zAassociative_scan.<locals>.make_combine_region.<locals>.<listcomp>é
  rj  r$   rk  c                ó   — g | ]	}|j         ‘Œ
S r?   rm  rn  s     r"   r  zAassociative_scan.<locals>.make_combine_region.<locals>.<listcomp>î
  rp  r$   )rq  rƒ   rZ  rr  rH   r  r   rs  r%   rM   r2  Úcreate_scan_ret)Úscan_oprv  rw  r¦  r0   rx  rg   ri  rƒ   r:   r,   rò  rÅ  s          @@€€€€r"   ry  z-associative_scan.<locals>.make_combine_regionâ
  s[  øøø€ Ø4Ð4¨eÐ4Ñ4Ô4°qÑ8ˆØ×#Ò# AÑ&Ô&ˆØÔ#ˆÝ˜gÑ&Ô&ð 		.ð 		.Ø.Ð.Ð.Ð.ˆEØ×4Ò4°V½TÅ#ÀeÈ[ÑBYÔBYÑ=ZÔ=ZÑ[Ô[ˆEØQÐQÐQÐQ½)ÀKÑ:PÔ:PÐQÑQÔQˆDØ ×1Ò1°*¸dÈ2Ð1ÑNÔNˆGÝ˜'¥6Ñ*Ô*ð 6Ø"œ>Ð*��à5Ð5¨WÐ5Ñ5Ô5�Ø#ˆGÔ# WÐ-Ð-ð		.ð 		.ð 		.ñ 		.ô 		.ð 		.ð 		.ð 		.ð 		.ð 		.ð 		.ð 		.øøøð 		.ð 		.ð 		.ð 		.ð 		.ð 		.rz  )r%   rM   r÷  r±   rÒ  rD   rì  )rÅ  rÄ  rò  rö  r,   r:   ry  s   ` ` `` r"   r÷  r÷  Ð
  sµ   øøøø€ õ �%�Ñ Ô ð uÝ  	¨4°¸WÐPYÐfpÐqÑqÔqÐrsÔtÐtð.ð .ð .ð .ð .ð .ð .ð .õ   Ñ%Ô%€DØÐÝ˜$¥ E¨!¤H¤NÑ 3Ô 3Ñ4Ô4ˆØ×%Ò% e¨TÐ3FÈÑPÔPÐPr$   c                óš   — t          |¦  «        }t          |¦  «        }|�|                     |¦  «        }|                     | ||¦  «        S )aq  computes an histogram based on input tensor with num_bins bins, the bins have a width of 1 and start at 0.

    :param input: the input tensor
    :type input: Tensor
    :param num_bins: number of histogram bins
    :type num_bins: int
    :param mask: if `mask[idx]` is false, exclude `input[idx]` from histogram
    :type mask: Block of `triton.int1`, optional

    )r±   r^   rý  )rÅ  rü  rÇ  r,   r:   s        r"   rý  rý  ÷
  sO   € õ $ HÑ-Ô-€HÝ Ñ%Ô%€DØÐØ×"Ò" 4Ñ(Ô(ˆØ×Ò˜u h°Ñ5Ô5Ð5r$   c                óŠ   — t          | ¦  «        } t          |¦  «        }t          |¦  «        }|                     | ||¦  «        S )zêGather from a tensor along a given dimension.

    :param src: the source tensor
    :type src: Tensor
    :param index: the index tensor
    :type index: Tensor
    :param axis: the dimension to gather along
    :type axis: int

    )r±   rú  )Úsrcr  rÄ  r,   s       r"   rú  rú    sC   € õ ˜sÑ
#Ô
#€CÝ  Ñ'Ô'€EÝ Ñ%Ô%€DØ×Ò˜C ¨Ñ-Ô-Ð-r$   r;   )Úpackr,   r:   Ú	scalar_fnú!Callable[..., Tuple[tensor, ...]]r0   c          
     ó  ‡— |dk    sJ ‚d„ |D ¦   «         }|j         }|                     ¦   «         Šg }|                     ¦   «         }t          |¦  «        D ]�\  }	}
t	          j        |¦  «        D ]g}‰                     |
                     |¦  «        |¦  «         |                     t          ‰ 
                    |	|z  |z   ¦  «        |
¦  «        ¦  «         ŒhŒ‚t          |¦  «        5  |                     ‰¦  «         |                     | |i ¬¦  «        }t          |t          ¦  «        }|r|f}d„ |D ¦   «         }|                     |¦  «         |                     |¦  «         ddd¦  «         n# 1 swxY w Y   d„ |D ¦   «         }|}|dk    r<|dd|…         }t	          j        d|¦  «        D ]}|||d|…         k    s
J d¦   «         ‚Œˆfd„}|                     |¦  «         |                     ||||¦  «        }|r|d	         n|S )
a  
        Map a scalar function over a tensor.

        The input tensors :code:`args` are implicitly broadcasted to the same shape.

        This may be useful in allowing control flow over single elements in a tensor,
        for example a multi-branch function where one branch is more expensive. With
        :code:`tl.where` you are forced to calculate both sides of the branch, but
        with an if we only execute one side.

        .. highlight:: python
        .. code-block:: python

            @triton.jit
            def selu_scalar(x, alpha):
                if x > 0:
                    return a
                else:
                    return alpha * (tl.exp(x) - 1)

            @triton.jit
            def selu(x, alpha):
                return tl.map_elementwise(selu_scalar, x, alpha)

        :param scalar_fn: the function to map over.
        :param pack: the number of elements to be processed by one function call.
        :return: one tensor or a tuple of tensors, depending on the mapped function.
    r;   c                ó&   — g | ]}|j         j        ‘ŒS r?   r_  r`  s     r"   r  z#map_elementwise.<locals>.<listcomp>D  s   € Ð1Ð1Ð1 q�Q”V”]Ð1Ð1Ð1r$   rk  c                ó   — g | ]	}|j         ‘Œ
S r?   rm  rn  s     r"   r  z#map_elementwise.<locals>.<listcomp>V  s   € Ð4Ð4Ð4 �1”8Ð4Ð4Ð4r$   Nc                ó   — g | ]	}|j         ‘Œ
S r?   )rf   r  s     r"   r  z#map_elementwise.<locals>.<listcomp>Z  s   € Ð6Ð6Ð6 !�q”vÐ6Ð6Ð6r$   z!type mismatch in unpacked resultsc                ó\   •— |                       d¦  «        }|                     ‰¦  «         d S )Nr   )rq  Ú	push_back)Úelementwise_oprw  ri  s     €r"   Úmake_elementwise_regionz0map_elementwise.<locals>.make_elementwise_regiona  s0   ø€ Ø×*Ò*¨1Ñ-Ô-ˆØ×Ò˜ÑÔÐÐÐr$   r   )rƒ   Ú	new_blockÚget_locr   r  rË  Úadd_argument_atr¦  r¥  rM   rž  rZ  Úset_insertion_point_to_startrs  r%   Úset_locÚcreate_map_elementwise_retÚmap_elementwise)r˜  r—  r,   r:   r0   Úin_scalar_tysrƒ   Úscalar_argsÚoriginal_locrË  r  ÚjÚscalar_resultsÚ	is_singlerg   Úfn_result_typesÚscalar_result_typesÚoffsetr¡  Úresultri  s                       @r"   r¨  r¨    s¨  ø€ ðJ �1Š9ˆ9ˆ9ˆ9Ø1Ð1¨DÐ1Ñ1Ô1€MØÔ€GØ×ÒÑÔ€EØ€KØ—?’?Ñ$Ô$€LÝ˜=Ñ)Ô)ð Dð D‰ˆˆ2Ý” Ñ%Ô%ð 	Dð 	DˆAØ×!Ò! "§(¢(¨7Ñ"3Ô"3°\ÑBÔBÐBØ×Ò�v e§i¢i°°D±¸1±Ñ&=Ô&=¸rÑBÔBÑCÔCÐCÐCð	Dõ 
˜'Ñ	"Ô	"ð 
4ð 
4Ø×,Ò,¨UÑ3Ô3Ð3Ø#×4Ò4°YÀÐTVÐ4ÑWÔWˆå˜~­vÑ6Ô6ˆ	Øð 	-Ø+˜_ˆNà4Ð4 ^Ð4Ñ4Ô4ˆØ�Š˜Ñ%Ô%Ð%Ø×*Ò*¨7Ñ3Ô3Ð3ð
4ð 
4ð 
4ñ 
4ô 
4ð 
4ð 
4ð 
4ð 
4ð 
4ð 
4øøøð 
4ð 
4ð 
4ð 
4ð 7Ð6 ~Ð6Ñ6Ô6€OØ)ÐØˆa‚x€xØ-¨f¨f°¨fÔ5ÐÝ”n Q¨Ñ-Ô-ð 	mð 	mˆFØ&¨/¸&¸,À$¸,Ô*GÒGÐGÐGÐIlÑGÔGÐGÐGð ð  ð  ð  ð  ð ‡O‚O�LÑ!Ô!Ð!Ø×&Ò& tÐ-@À$ÐH_Ñ`Ô`€FØ!Ð-ˆ6�!Œ9ˆ9 vÐ-s   Ã'A>E1Å1E5Å8E5c                ó*   — |                       ¦   «         S )zA
    Insert a barrier to synchronize all threads in a block.
    )Údebug_barrierr¯  s    r"   r´  r´  o  s   € ð
 ×"Ò"Ñ$Ô$Ð$r$   c           	     ót  — t          |t          ¦  «        r|g}t          |¦  «        D ]o\  }}t          |t          ¦  «        st          d|› d�¦  «        ‚t          |j        t
          ¦  «        s(t          d|› dt          |j        ¦  «        › d�¦  «        ‚Œpd„ |D ¦   «         }|                     | |¦  «        S )zd
    Let the compiler know that the values in :code:`input` are all multiples of :code:`value`.
    úvalues element ú must have type `constexpr`ú1 must have type `constexpr[int]`, got `constexpr[r—   c                ó   — g | ]	}|j         ‘Œ
S r?   r‘   r  s     r"   r  zmultiple_of.<locals>.<listcomp>ƒ  ó   € Ð&Ð&Ð&˜!ˆaŒgÐ&Ð&Ð&r$   )r%   r¦   r   rU   r’   rz   rf   Úmultiple_of©rÅ  rI   r,   rË  rÝ  s        r"   r»  r»  w  sÚ   € õ
 �&�)Ñ$Ô$ð Ø�ˆÝ˜&Ñ!Ô!ð tð t‰ˆˆ1Ý˜!�YÑ'Ô'ð 	NÝÐL¨aÐLÐLÐLÑMÔMÐMÝ˜!œ'¥3Ñ'Ô'ð 	tÝÐr¨aÐrÐrÕbfÐghÔgnÑboÔboÐrÐrÐrÑsÔsÐsð	tà&Ð&˜vÐ&Ñ&Ô&€FØ× Ò  ¨Ñ/Ô/Ð/r$   c           	     ót  — t          |t          ¦  «        r|g}t          |¦  «        D ]o\  }}t          |t          ¦  «        st          d|› d�¦  «        ‚t          |j        t
          ¦  «        s(t          d|› dt          |j        ¦  «        › d�¦  «        ‚Œpd„ |D ¦   «         }|                     | |¦  «        S )z^
    Let the compiler know that the `value` first values in :code:`input` are contiguous.
    r¶  r·  r¸  r—   c                ó   — g | ]	}|j         ‘Œ
S r?   r‘   r  s     r"   r  z"max_contiguous.<locals>.<listcomp>“  rº  r$   )r%   r¦   r   rU   r’   rz   rf   Úmax_contiguousr¼  s        r"   r¿  r¿  ‡  sÚ   € õ
 �&�)Ñ$Ô$ð Ø�ˆÝ˜&Ñ!Ô!ð tð t‰ˆˆ1Ý˜!�YÑ'Ô'ð 	NÝÐL¨aÐLÐLÐLÑMÔMÐMÝ˜!œ'¥3Ñ'Ô'ð 	tÝÐr¨aÐrÐrÕbfÐghÔgnÑboÔboÐrÐrÐrÑsÔsÐsð	tà&Ð&˜vÐ&Ñ&Ô&€FØ×#Ò# E¨6Ñ2Ô2Ð2r$   c           	     ót  — t          |t          ¦  «        r|g}t          |¦  «        D ]o\  }}t          |t          ¦  «        st          d|› d�¦  «        ‚t          |j        t
          ¦  «        s(t          d|› dt          |j        ¦  «        › d�¦  «        ‚Œpd„ |D ¦   «         }|                     | |¦  «        S )zì
    Let the compiler know that the `value` first values in :code:`input` are constant.

    e.g. if :code:`values` is [4], then each group of 4 values in :code:`input` should all be equal,
    for example [0, 0, 0, 0, 1, 1, 1, 1].
    r¶  r·  r¸  r—   c                ó   — g | ]	}|j         ‘Œ
S r?   r‘   r  s     r"   r  z!max_constancy.<locals>.<listcomp>¦  rº  r$   )r%   r¦   r   rU   r’   rz   rf   Úmax_constancyr¼  s        r"   rÂ  rÂ  —  sÚ   € õ �&�)Ñ$Ô$ð Ø�ˆÝ˜&Ñ!Ô!ð tð t‰ˆˆ1Ý˜!�YÑ'Ô'ð 	NÝÐL¨aÐLÐLÐLÑMÔMÐMÝ˜!œ'¥3Ñ'Ô'ð 	tÝÐr¨aÐrÐrÕbfÐghÔgnÑboÔboÐrÐrÐrÑsÔsÐsð	tà&Ð&˜vÐ&Ñ&Ô&€FØ×"Ò" 5¨&Ñ1Ô1Ð1r$   c                óR   — |                      |                     | ¦  «        ¦  «        S )z<
    Allow compiler to assume the :code:`cond` is True.
    )Úassumer^   )Úcondr,   s     r"   rÄ  rÄ  ª  s&   € ð
 ×Ò˜I×/Ò/°Ñ5Ô5Ñ6Ô6Ð6r$   ú ú
)Úsepr¼  ÚfileÚflushr,   rÈ  r¼  c                ó   — dS )a…  
    Print the values at compile time.  The parameters are the same as the builtin :code:`print`.

    NOTE: Calling the Python builtin :code:`print` is not the same as calling this, it instead maps to :code:`device_print`,
    which has special requirements for the arguments.

    .. highlight:: python
    .. code-block:: python

        tl.static_print(f"BLOCK_SIZE={BLOCK_SIZE}")
    Nr?   )rÈ  r¼  rÉ  rÊ  r,   rI   s         r"   Ústatic_printrÌ  ·  s	   € ð 	€Dr$   c                ó   — dS )zä
    Assert the condition at compile time.  Does not require that the :code:`TRITON_DEBUG` environment variable
    is set.

    .. highlight:: python
    .. code-block:: python

        tl.static_assert(BLOCK_SIZE == 1024)
    Nr?   )rÅ  Úmsgr,   s      r"   Ústatic_assertrÏ  Ç  s	   € ð 	€Dr$   )Úhexr,   c               ó>  — ddl }t          | ¦  «        } t          | t          ¦  «        sJ | › d�¦   «         ‚d}| D ]}||j        vrd} nŒ|sJ | › d�¦   «         ‚g }|D ]*}|                     |                     |¦  «        ¦  «         Œ+|                     | ||¦  «        S )a·  
    Print the values at runtime from the device.  String formatting does not work for runtime values, so you should
    provide the values you want to print as arguments.  The first value must be a string, all following values must
    be scalars or tensors.

    Calling the Python builtin :code:`print` is the same as calling this function, and the requirements for the arguments will match
    this function (not the normal requirements for :code:`print`).

    .. highlight:: python
    .. code-block:: python

        tl.device_print("pid", pid)
        print("pid", pid)

    On CUDA, printfs are streamed through a buffer of limited size (on one host,
    we measured the default as 6912 KiB, but this may not be consistent across
    GPUs and CUDA versions).  If you notice some printfs are being dropped, you
    can increase the buffer size by calling

    .. highlight:: python
    .. code-block:: python

        triton.runtime.driver.active.utils.set_printf_fifo_size(size_bytes)

    CUDA may raise an error if you try to change this value after running a
    kernel that uses printfs.  The value set here may only affect the current
    device (so if you have multiple GPUs, you'd need to call it multiple times).

    :param prefix: a prefix to print before the values. This is required to be a string literal.
    :param args: the values to print. They can be any tensor or scalar.
    :param hex: print all values as hex instead of decimal
    r   Nz is not stringTFz is not an ascii string)Ústringr±   r%   r&   Ú	printabler¥  r^   Údevice_print)	rÏ  rÐ  r,   r0   rÒ  Úb_asciiÚchÚnew_argsrž  s	            r"   rÔ  rÔ  Õ  sà   € ðD €M€M€MÝ! &Ñ)Ô)€FÝ�f�cÑ"Ô"Ð=Ð= vÐ$=Ð$=Ð$=Ñ=Ô=Ð"Ø€GØð ð ˆØ�VÔ%Ð%Ð%ØˆGØˆEð &ð Ð6Ð6�vÐ6Ð6Ð6Ñ6Ô6ˆ7Ø€HØð 2ð 2ˆØ�Š˜	×+Ò+¨CÑ0Ô0Ñ1Ô1Ð1Ð1Ø×!Ò! &¨(°CÑ8Ô8Ð8r$   c                óÀ   — t          |¦  «        }t          |¦  «        }|�|                     |¦  «        }|                     |                     | ¦  «        ||¦  «        S )a(  
    Assert the condition at runtime from the device.  Requires that the environment variable :code:`TRITON_DEBUG`
    is set to a value besides :code:`0` in order for this to have any effect.

    Using the Python :code:`assert` statement is the same as calling this function, except that the second argument
    must be provided and must be a string, e.g. :code:`assert pid == 0, "pid != 0"`.  The environment variable must
    be set for this :code:`assert` statement to have any effect.

    .. highlight:: python
    .. code-block:: python

        tl.device_assert(pid == 0)
        assert pid == 0, f"pid != 0"

    :param cond: the condition to assert. This is required to be a boolean tensor.
    :param msg: the message to print if the assertion fails. This is required to be a string literal.
    )r±   r^   Údevice_assert)rÅ  rÎ  rÇ  r,   s       r"   rÙ  rÙ    s]   € õ& ˜sÑ
#Ô
#€CÝ Ñ%Ô%€DØÐØ×"Ò" 4Ñ(Ô(ˆØ×"Ò" 9×#6Ò#6°tÑ#<Ô#<¸cÀ4ÑHÔHÐHr$   ÚasmÚconstraintsr   úUnion[dtype, Sequence[dtype]]Úis_purer—  c                ó8  ‡‡‡‡— t          | ¦  «        } t          |¦  «        }t          |¦  «        }t          |¦  «        }	 t          |¦  «         d}n# t          $ r d}|f}Y nw xY wt          j        t
          t                   |¦  «        }|}ˆfd„|D ¦   «         x}	rpt          ‰j        ddd¬¦  «        }
|	d         Š|	D ]} |
|‰¦  «        \  }ŠŒ‰j	        r5t          |	¦  «        D ]\  }} |
|‰¦  «        \  |	|<   }Œˆfd„|D ¦   «         }d„ |	D ¦   «         }‰j        Š‰                     | ||ˆfd„|D ¦   «         ||¦  «        Š|s)t          ‰                     d¦  «        |d         ¦  «        S t          ˆfd	„t          |¦  «        D ¦   «         ¦  «        S )
a>  
        Execute inline assembly over a tensor.  Essentially, this is :code:`map`
        where the function is inline assembly.

        The input tensors :code:`args` are implicitly broadcasted to the same shape.

        :code:`dtype` can be a tuple of types, in which case the output is a
        tuple of tensors.

        Each invocation of the inline asm processes :code:`pack` elements at a
        time.  Exactly which set of inputs a block receives is unspecified.
        Input elements of size less than 4 bytes are packed into 4-byte
        registers.

        This op does not support empty :code:`dtype` -- the inline asm must
        return at least one tensor, even if you don't need it.  You can work
        around this by returning a dummy tensor of arbitrary type; it shouldn't
        cost you anything if you don't use it.

        Example using
        `PTX <https://docs.nvidia.com/cuda/parallel-thread-execution/index.html>`_
        assembly:

        .. highlight:: python
        .. code-block:: python

            @triton.jit
            def kernel(A, B, C, D, BLOCK: tl.constexpr):
                a = tl.load(A + tl.arange(0, BLOCK)) # uint8 tensor
                b = tl.load(B + tl.arange(0, BLOCK)) # float32 tensor

                # For each (a,b) in zip(a,b), perform the following:
                # - Let ai be `a` converted to int32.
                # - Let af be `a` converted to float.
                # - Let m be the max of ai and b.
                # - Return ai and mi.
                # Do the above 4 elements at a time.
                (c, d) = tl.inline_asm_elementwise(
                    asm="""
                    {
                        // Unpack `a` into `ai`.
                        .reg .b8 tmp<4>;
                        mov.b32 {tmp0, tmp1, tmp2, tmp3}, $8;
                        cvt.u32.u8 $0, tmp0;
                        cvt.u32.u8 $1, tmp1;
                        cvt.u32.u8 $2, tmp2;
                        cvt.u32.u8 $3, tmp3;
                    }
                    // Convert `ai` to float.
                    cvt.rn.f32.s32 $4, $0;
                    cvt.rn.f32.s32 $5, $1;
                    cvt.rn.f32.s32 $6, $2;
                    cvt.rn.f32.s32 $7, $3;
                    // Take max of `ai` and `b`.
                    max.f32 $4, $4, $9;
                    max.f32 $5, $5, $10;
                    max.f32 $6, $6, $11;
                    max.f32 $7, $7, $12;
                    """,
                    constraints=(
                        # 8 output registers, namely
                        #   $0=ai0, $1=ai1, $2=ai2, $3=ai3,
                        #   $4=m0,  $5=m1,  $6=m2,  $7=m3.
                        "=r,=r,=r,=r,=r,=r,=r,=r,"
                        # 5 input registers, namely
                        #   $8=ai,
                        #   $9=b0, $10=b1, $11=b2, $12=b3.
                        # The four elements from `a` are all packed into one register.
                        "r,r,r,r,r"),
                    args=[a, b],
                    dtype=(tl.int32, tl.float32),
                    is_pure=True,
                    pack=4,
                )
                tl.store(C + tl.arange(0, BLOCK), c)
                tl.store(D + tl.arange(0, BLOCK), d)

        :param asm: assembly to run.  Must match target's assembly format.
        :param constraints: asm constraints in
            `LLVM format <https://llvm.org/docs/LangRef.html#inline-asm-constraint-string>`_
        :param args: the input tensors, whose values are passed to the asm block
        :param dtype: the element type(s) of the returned tensor(s)
        :param is_pure: if true, the compiler assumes the asm block has no side-effects
        :param pack: the number of elements to be processed by one instance of inline assembly
        :return: one tensor or a tuple of tensors of the given dtypes
    TFc                ó:   •— g | ]}‰                      |¦  «        ‘ŒS r?   r]   )r  rž  r,   s     €r"   r  z*inline_asm_elementwise.<locals>.<listcomp>‰  s'   ø€ ÐBÐBÐB°c˜×,Ò,¨SÑ1Ô1ÐBÐBÐBr$   )Úarithmetic_checkÚallow_lhs_ptrÚallow_rhs_ptrr   c                óD   •— g | ]}‰j                              |¦  «        ‘ŒS r?   )rf   rÒ  )r  ÚdtÚbroadcast_args     €r"   r  z*inline_asm_elementwise.<locals>.<listcomp>˜  s*   ø€ ÐNÐNÐNÀ"�}Ô)×9Ò9¸"Ñ=Ô=ÐNÐNÐNr$   c                ó   — g | ]	}|j         ‘Œ
S r?   rm  r`  s     r"   r  z*inline_asm_elementwise.<locals>.<listcomp>™  s   € Ð/Ð/Ð/˜AˆqŒxÐ/Ð/Ð/r$   c                ó:   •— g | ]}|                      ‰¦  «        ‘ŒS r?   rc  )r  r  rƒ   s     €r"   r  z*inline_asm_elementwise.<locals>.<listcomp>›  s&   ø€ Ð@eÐ@eÐ@eÐWYÀÇÂÈ'ÑARÔARÐ@eÐ@eÐ@er$   c              3  ód   •K  — | ]*\  }}t          ‰                     |¦  «        |¦  «        V — Œ+d S r   )rM   Ú
get_result)r  rË  r  Úcalls      €r"   r  z)inline_asm_elementwise.<locals>.<genexpr>Ÿ  s=   øè è € ÐPÐP±E°A°r•˜Ÿš¨Ñ*Ô*¨BÑ/Ô/ÐPÐPÐPÐPÐPÐPr$   )r±   rT   rU   Útypingr°  r   Ú_DtypeClassr   Úbinary_op_type_checking_implrì  r   rƒ   Úcreate_inline_asmrM   ré  r  )rÚ  rÛ  r0   r  rÝ  r—  r,   Úhas_multiple_outputsÚres_tysÚdispatch_argsÚbin_op_type_checkingræ  r  rË  rg   rå  rƒ   rê  s         `        @@@r"   Úinline_asm_elementwiseró     s  øøøø€ õr ˜sÑ
#Ô
#€CÝ& {Ñ3Ô3€KÝ Ñ%Ô%€DÝ" 7Ñ+Ô+€GðÝˆU‰ŒˆØ#ÐÐøÝð ð ð Ø$ÐØ�	ˆˆˆðøøøõ ŒK�¥Ô-¨uÑ5Ô5€Eà€GØBÐBÐBÐB¸TÐBÑBÔBÐB€}ð OÝ&ØÔ2Ø"ØØð	 
ñ  
ô  
Ðð & aÔ(ˆà!ð 	Ið 	IˆDØ3Ð3°D¸-ÑHÔHÑˆAˆ}ˆ}ØÔð 	Oå$ ]Ñ3Ô3ð Pð P‘��4Ø&:Ð&:¸4ÀÑ&OÔ&OÑ#�˜aÑ  ! !ØNÐNÐNÐNÈÐNÑNÔNˆGØ/Ð/ Ð/Ñ/Ô/€GØÔ€GØ×$Ò$ S¨+°wÐ@eÐ@eÐ@eÐ@eÐ]dÐ@eÑ@eÔ@eÐgnÐptÑuÔu€Dàð 6Ý�d—o’o aÑ(Ô(¨'°!¬*Ñ5Ô5Ð5ÝÐPÐPÐPÐP½YÀwÑ=OÔ=OÐPÑPÔPÑPÔPÐPs   ÁA ÁA&Á%A&c                  ó&   — e Zd ZdZdd„Zd„ Zd„ ZdS )Ústatic_rangea  
    Iterator that counts upward forever.

    .. highlight:: python
    .. code-block:: python

        @triton.jit
        def kernel(...):
            for i in tl.static_range(10):
                ...
    :note: This is a special iterator used to implement similar semantics to Python's :code:`range` in the context of
        :code:`triton.jit` functions. In addition, it also guides the compiler to unroll the loop aggressively.
    :param arg1: the start value.
    :param arg2: the end value.
    :param step: the step value.
    Nc                óh  — t          |t          ¦  «        sJ |› d�¦   «         ‚|€t          d¦  «        | _        n)t          |t          ¦  «        sJ |› d�¦   «         ‚|| _        |€t          d¦  «        | _        || _        d S t          |t          ¦  «        sJ |› d�¦   «         ‚|| _        || _        d S )Nz7 used as tl.static_range start value is not a constexprr;   z6 used as tl.static_range step value is not a constexprr   z5 used as tl.static_range end value is not a constexpr)r%   r¦   r¥  r£  r¼  )r@   Úarg1Úarg2r¥  s       r"   r”   zstatic_range.__init__¹  sÁ   € Ý˜$¥	Ñ*Ô*ÐlÐl¨tÐ,lÐ,lÐ,lÑlÔlÐ*Øˆ<Ý! !™œˆDŒIˆIå˜d¥IÑ.Ô.ÐoÐo°4Ð0oÐ0oÐ0oÑoÔoÐ.ØˆDŒIØˆ<Ý" 1™œˆDŒJØˆDŒHˆHˆHå˜d¥IÑ.Ô.ÐnÐn°4Ð0nÐ0nÐ0nÑnÔnÐ.ØˆDŒJØˆDŒHˆHˆHr$   c                ó    — t          d¦  «        ‚©Nz8static_range can only be used in @triton.jit'd functionsr–  r�   s    r"   rÿ   zstatic_range.__iter__È  ó   € ÝÐUÑVÔVÐVr$   c                ó    — t          d¦  «        ‚rú  r–  r�   s    r"   Ú__next__zstatic_range.__next__Ë  rû  r$   r*  ©rG   ra   rb   rF   r”   rÿ   rý  r?   r$   r"   rõ  rõ  §  sX   € € € € € ðð ð"ð ð ð ðWð Wð WðWð Wð Wð Wð Wr$   rõ  c                  ó*   — e Zd ZdZ	 	 dd„Zd„ Zd„ ZdS )rË  a‘  
    Iterator that counts upward forever.

    .. highlight:: python
    .. code-block:: python

        @triton.jit
        def kernel(...):
            for i in tl.range(10, num_stages=3):
                ...
    :note: This is a special iterator used to implement similar semantics to Python's :code:`range` in the context of
        :code:`triton.jit` functions. In addition, it allows user to pass extra attributes to the compiler.
    :param arg1: the start value.
    :param arg2: the end value.
    :param step: the step value.
    :param num_stages: pipeline the loop into this many stages (so there are
        :code:`num_stages` iterations of the loop in flight at once).

        Note this is subtly different than passing :code:`num_stages` as a
        kernel argument.  The kernel argument only pipelines loads that feed
        into :code:`dot` operations, while this attribute tries to pipeline most
        (though not all) loads in this loop.
    :param loop_unroll_factor: Tells the Triton IR level loop unroller how many
        times to unroll a for loop that this range is used with. Less than 2 for
        this value implies no unrolling.
    :param disallow_acc_multi_buffer: If true, prevent the accumulator of the dot
        operation in the loop to be multi-buffered, if applicable.
    :param flatten: automatically flatten the loop nest starting at this loop to
        create a single flattened loop. The compiler will try to pipeline the
        flattened loop which can avoid stage stalling.
    :param warp_specialize: Enable automatic warp specialization on the loop.
        The compiler will attempt to partition memory, MMA, and vector
        operations in the loop into separate async partitions. This will
        increase the total number of warps required by the kernel.
    :param disable_licm: Tells the compiler it shouldn't hoist loop invariant
        code outside the loop. This is often useful to avoid creating long liveranges
        within a loop.

        Note that warp specialization is only supported on Blackwell GPUs and
        only works on simple matmul loops. Support for arbitrary loops will be
        expanded over time.
    NFc
                óî   — |€t          d¦  «        | _        n|| _        |€t          d¦  «        | _        || _        n|| _        || _        || _        || _        || _        || _        || _        |	| _	        d S )Nr;   r   )
r¦   r¥  r£  r¼  Ú
num_stagesÚloop_unroll_factorÚdisallow_acc_multi_bufferÚflattenÚwarp_specializeÚdisable_licm)
r@   r÷  rø  r¥  r  r  r  r  r  r  s
             r"   r”   zrange.__init__û  sz   € àˆ<Ý! !™œˆDŒIˆIàˆDŒIØˆ<Ý" 1™œˆDŒJØˆDŒHˆHàˆDŒJØˆDŒHØ$ˆŒØ"4ˆÔØ)BˆÔ&ØˆŒØ.ˆÔØ(ˆÔÐÐr$   c                ó    — t          d¦  «        ‚©Nz4tl.range can only be used in @triton.jit'd functionsr–  r�   s    r"   rÿ   zrange.__iter__  ó   € ÝÐQÑRÔRÐRr$   c                ó    — t          d¦  «        ‚r  r–  r�   s    r"   rý  zrange.__next__  r	  r$   )NNNNFFFFrþ  r?   r$   r"   rË  rË  Ï  sc   € € € € € ð)ð )ðV X\Øejð)ð )ð )ð )ð&Sð Sð SðSð Sð Sð Sð Sr$   rË  c                  ó   — e Zd ZdZdd„ZdS )r:  a=  
    While loop condition wrapper.

    .. highlight:: python
    .. code-block:: python

        @triton.jit
        def kernel(...):
            while tl.condition(c, disable_licm)
                ...
    :note: This is a special wrapper used to annotate while loops in the context of
        :code:`triton.jit` functions. It allows user to pass extra attributes to the compiler.
    :param disable_licm: Tells the compiler it shouldn't hoist loop invariant
        code outside the loop. This is often useful to avoid creating long liveranges
        within a loop.
    Fc                ó"   — || _         || _        d S r   )r:  r  )r@   r÷  r  s      r"   r”   zcondition.__init__'  s   € ØˆŒØ(ˆÔÐÐr$   Nr,  )rG   ra   rb   rF   r”   r?   r$   r"   r:  r:    s2   € € € € € ðð ð")ð )ð )ð )ð )ð )r$   r:  Úlib_nameÚlib_pathrH   Úarg_type_symbol_dictÚdictÚret_typec                ó,  — t          |¦  «        dk    rt          d¦  «        ‚t          t          |                     ¦   «         ¦  «        d         ¦  «        }t          |¦  «        |k    r"t          dt          |¦  «        › d|› �¦  «        ‚g }	g }
|D ]ƒ}t	          |t
          ¦  «        r5|	                     |j        ¦  «         |
                     |j        ¦  «         ŒL|	                     t          |¦  «        ¦  «         |
                     |¦  «         Œ„t          |	¦  «        }	|	|vr't          d|                     ¦   «         › d|	› �¦  «        ‚||	         d         }|j        }t           | ||||
|                     |¦  «        |¦  «        |¦  «        S )a˜  
        Dispatch a function to a library
        :param func: the function to dispatch
        :param lib_name: the name of the library
        :param lib_path: the path of the library
        :param args: the arguments of the function
        :param arg_type_symbol_dict: the type of the arguments
        :param ret_type: the type of the return value
        :return: the return value of the function
    r   zarg_type_symbol_dict is emptyz+length of input args does not match.Expect rÐ  z,input arg type does not match.Expect one of )rD   r.   rH   rE   r%   rM   r¥  r  r2  rf   r  rƒ   r¦  )r'  r  r  r0   r  r  rÝ  r,   Únum_argsÚ	arg_typesÚarg_listrž  Úsymbolrƒ   s                 r"   Údispatchr  1  sÌ  € õ ÐÑ Ô  AÒ%Ð%ÝÐ8Ñ9Ô9Ð9å•4Ð,×1Ò1Ñ3Ô3Ñ4Ô4°QÔ7Ñ8Ô8€HÝ
ˆ4�y„y�HÒÐÝð ?Ý#& t¡9¤9ð?ð ?Ø4<ð?ð ?ñ @ô @ð 	@ð €IØ€HØð !ð !ˆÝ�c�6Ñ"Ô"ð 	!Ø×Ò˜SœYÑ'Ô'Ð'Ø�OŠO˜CœJÑ'Ô'Ð'Ð'à×Ò�T #™YœYÑ'Ô'Ð'Ø�OŠO˜CÑ Ô Ð Ð Ý�iÑ Ô €IàÐ,Ð,Ð,Ýð YØ*>×*CÒ*CÑ*EÔ*EðYð YØMVðYð Yñ Zô Zð 	Zð & iÔ0°Ô3ˆØÔ#ˆÝ�d�d˜8 X¨v°xÀÇÂÐPWÑAXÔAXÐZaÑbÔbÐdlÑmÔmÐmr$   c           
     ó  — |                      ¦   «         }d}g }t          j        t          |¦  «        ¦  «        D ]a}	|                     ||	         ¦  «        ||	<   |                     ||	         j        ¦  «         ||	         j                             ¦   «         rd}Œbt          |¦  «        }||         d         }
t          |¦  «        dk    r”d}||v rd}|d         }|D ]}| 
                    |||¬¦  «        \  }}Œt          j        t          |¦  «        ¦  «        D ]&}	| 
                    ||	         ||¬¦  «        \  ||	<   }Œ'|s|j                             |
¦  «        }
|j        j        }t          || ||||
||¦  «        S )av  
        Dispatch an elementwise function to a library
        :param lib_name: the name of the library
        :param lib_path: the path of the library
        :param args: the arguments of the function
        :param arg_type_symbol_dict: the type of the arguments
        :param is_pure: whether the function is pure
        :return: the return value of the function
    TFr;   r   )rà  )Úcopyr  rË  rD   r^   r¥  r  rf   rš  r  rí  rÒ  rƒ   Úcreate_extern_elementwiser  )r  r  r0   r  rÝ  r,   rñ  Ú
all_scalarr  rË  r  rà  rå  ræ  r  r'  s                   r"   Úextern_elementwiser  Y  sÈ  € ð —I’I‘K”K€MØ€JØ€IÝŒ^�C Ñ.Ô.Ñ/Ô/ð ð ˆØ$×.Ò.¨}¸QÔ/?Ñ@Ô@ˆ�aÑØ×Ò˜ qÔ)Ô/Ñ0Ô0Ð0Ø˜ÔÔ ×)Ò)Ñ+Ô+ð 	ØˆJøå�iÑ Ô €IØ# IÔ.¨qÔ1€HÝ
ˆ9�~„~˜ÒÐØÐàÐ,Ð,Ð,Ø$ÐØ% aÔ(ˆà!ð 	ið 	iˆDØ(×EÒEÀdÈMØWgð  Fñ  iô  iÑˆAˆ}ˆ}õ ”¥ MÑ 2Ô 2Ñ3Ô3ð 	lð 	lˆAØ"+×"HÒ"HÈÐWXÔIYÐ[hØZjð #Iñ #lô #lÑˆM˜!Ñ˜a˜aàð 	DØ$Ô)×9Ò9¸(ÑCÔCˆHØÔÔ6€DÝ�D˜( H¨mÐ=QÐS[Ð]dÐfoÑpÔpÐpr$   c                ó.   — |                      | |¦  «        S )zª
        Convert both operands to a single common type
        :param lhs: the left operand
        :param rhs: the right operand
        :param builder: the builder
    )rí  )r	  r  Úsemantics      r"   Úbinary_op_type_legalizationr  „  s   € ð ×0Ò0°°cÑ:Ô:Ð:r$   c                ó    — t          | ¦  «        S )z#A decorator for external functions.)r8   r[   s    r"   Úexternr!  Ž  s   € å�2‰;Œ;Ðr$   c                ó@   — | dk    ot          j        d| ¦  «        dk     S )Ng        g      ð?r   )r3  ÚcopysignrV   s    r"   Úis_negative_zeror$  –  s"   € Ø�Š8Ð1�œ c¨1Ñ-Ô-°Ò1Ð1r$   ©rA  r,   c                ól  — t          |¦  «        }t          d„ |D ¦   «         ¦  «        }|rw| t          u s
J d¦   «         ‚t          d„ |D ¦   «         ¦  «        rJ ‚t          d„ |D ¦   «         ¦  «        rJ ‚t	          t          j        t          |¦  «        ¦  «        ¦  «        S | t          u rt          j        } nt          d¦  «         t          |¦  «        dk    s
J d¦   «         ‚|d         }|d	d …         D ]}t          ||| |¬
¦  «        }Œ|j                             ¦   «         rt          d¦  «         |S )Nc              3  óB   K  — | ]}t          |t          ¦  «         V — Œd S r   ©r%   rd   r  s     r"   r  zbuiltin_max.<locals>.<genexpr>�  ó/   è è € ÐCÐC¸�: a­Ñ4Ô4Ð4ÐCÐCÐCÐCÐCÐCr$   z-propagate_nan is not supported on builtin maxc              3  ó>   K  — | ]}t          j        |¦  «        V — Œd S r   ©r3  Úisnanr  s     r"   r  zbuiltin_max.<locals>.<genexpr>   ó*   è è € Ð3Ð3¨•t”z !‘}”}Ð3Ð3Ð3Ð3Ð3Ð3r$   c              3  ó4   K  — | ]}t          |¦  «        V — Œd S r   ©r$  r  s     r"   r  zbuiltin_max.<locals>.<genexpr>¡  ó+   è è € Ð9Ð9¨qÕ'¨Ñ*Ô*Ð9Ð9Ð9Ð9Ð9Ð9r$   zJpassing propagate_nan to builtin max is deprecated, use tl.minimum insteadr   úmin requires at least 2 valuesr   r;   r%  zMbuiltin max on non-scalar tensor values is deprecated, use tl.maximum instead)r±   r¢  Ú_NOTHINGÚanyr¦   r  r  ÚPropagateNanÚNONEr   rD   rH  rf   rš  )rA  r,   r0   Úis_constexprÚmax_valrž  s         r"   Úbuiltin_maxr8  š  óX  € å Ñ%Ô%€DÝÐCÐC¸dÐCÑCÔCÑCÔC€LØð CØ¥Ð(Ð(Ð(Ð*YÑ(Ô(Ð(ÝÐ3Ð3¨dÐ3Ñ3Ô3Ñ3Ô3Ð3Ð3Ð3ÝÐ9Ð9°DÐ9Ñ9Ô9Ñ9Ô9Ð9Ð9Ð9Ý�œÕ&:¸4Ñ&@Ô&@ÑAÔAÑBÔBÐBà�Ð Ð Ý$Ô)ˆˆåÐYÑZÔZÐZåˆt‰9Œ9˜Š>ˆ>ˆ>Ð;‰>Œ>ˆ>Ø�1Œg€GØ�A�B�BŒxð Zð ZˆÝ˜' 3°mÈyÐYÑYÔYˆˆØ„|×ÒÑÔð ^ÝÐ\Ñ]Ô]Ð]Ø€Nr$   c                ól  — t          |¦  «        }t          d„ |D ¦   «         ¦  «        }|rw| t          u s
J d¦   «         ‚t          d„ |D ¦   «         ¦  «        rJ ‚t          d„ |D ¦   «         ¦  «        rJ ‚t	          t          j        t          |¦  «        ¦  «        ¦  «        S | t          u rt          j        } nt          d¦  «         t          |¦  «        dk    s
J d¦   «         ‚|d         }|d	d …         D ]}t          ||| |¬
¦  «        }Œ|j                             ¦   «         rt          d¦  «         |S )Nc              3  óB   K  — | ]}t          |t          ¦  «         V — Œd S r   r(  r  s     r"   r  zbuiltin_min.<locals>.<genexpr>µ  r)  r$   z-propagate_nan is not supported on builtin minc              3  ó>   K  — | ]}t          j        |¦  «        V — Œd S r   r+  r  s     r"   r  zbuiltin_min.<locals>.<genexpr>¸  r-  r$   c              3  ó4   K  — | ]}t          |¦  «        V — Œd S r   r/  r  s     r"   r  zbuiltin_min.<locals>.<genexpr>¹  r0  r$   zJpassing propagate_nan to builtin min is deprecated, use tl.minimum insteadr   r1  r   r;   r%  zMbuiltin min on non-scalar tensor values is deprecated, use tl.minimum instead)r±   r¢  r2  r3  r¦   r  r  r4  r5  r   rD   rD  rf   rš  )rA  r,   r0   r6  Úmin_valrž  s         r"   Úbuiltin_minr?  ²  r9  r$   )T)r    r   r)   r   rŠ   r   )r  rz   r'  rX   r)   r  )rÅ  rM   )Fr   Nr*  r)  r&  r'  )NNr?   r<   r<   r<   FN)r  rR  rÍ  rg  r)   rM   )r  rR  rÍ  rg  r’   rM   r)   rM   )Nr?   r<   r<   N)r  rM   )r   N)
r  rM   rì  r�  r‰  r�  rd  r!  r)   rˆ  r,  )rB   r&   r$  rX   r)   r%  r+  )NNNN)TN)r<  r¦   )rA  r¦   )
rB   r&   rK  r&   rL  r&   rM  r&   r)   r%  )FNN)rB   r&   rM  r&   r)   r%  )r˜  r™  r0   rM   )rÈ  r&   r¼  r&   )r<   N)r<   NN)rÚ  r&   rÛ  r&   r0   r   r  rÜ  rÝ  rX   r—  rz   )r  r&   r  r&   r0   rH   r  r  r  r  rÝ  rX   )
r  r&   r  r&   r0   rH   r  r  rÝ  rX   )«Ú
__future__r   r3  Úwarningsr   Ú
contextlibr   Úenumr   Ú	functoolsr   r   r	   rë  r
   r   r   r   r   r   r   Údataclassesr   r  r<   r   Úruntime.jitr   r6   Ú_C.libtritonr   Ú_utilsr   r   r   r   r   r5   ÚPROPAGATE_NANr4  r   r8   rR   rW   rL   r^   r`   rd   re   r�   r¦   r-  r±   r	  r  r  rì  rØ  rë  r	  r$  r0  r"  r  r  r   r!  r#  r$  r%  r&  Úfloat8e5Úfloat8e5b16Ú
float8e4nvÚ
float8e4b8Úfloat8e4b15Úfloat16r‚  r  Úfloat64Úpi32_tr+  rM   r0  r  rŸ  rM  rR  rƒ  rˆ  r’  r´  r¶  r¹  r»  rF   rð  rÀ  rÂ  rÆ  r´  r¹  r»  rÑ  r  rÞ  r¾  rÀ  ræ  rÂ  rÒ  r¡  r°  rú  r  rj  r  r  rË  r  rÎ  r#  r,  rÓ  rÖ  rØ  rÚ  rÜ  rÞ  rà  râ  r9  r>  rE  rI  r5  rD  rH  rJ  rU  rZ  rô  rC  rˆ  r‹  r÷  rý  rú  r¨  r´  r»  r¿  rÂ  rÄ  rÌ  rÏ  rÔ  rÙ  ró  rõ  rË  r:  r  r  r  r!  Úobjectr2  r$  r8  r?  r?   r$   r"   ú<module>rS     s)  ðØ "Ð "Ð "Ð "Ð "Ð "à €€€Ø Ð Ð Ð Ð Ð Ø %Ð %Ð %Ð %Ð %Ð %Ø Ð Ð Ð Ð Ð Ø 5Ð 5Ð 5Ð 5Ð 5Ð 5Ð 5Ð 5Ð 5Ð 5Ø €€€Ø LÐ LÐ LÐ LÐ LÐ LÐ LÐ LÐ LÐ LÐ LÐ LÐ LÐ LÐ LÐ LÐ LÐ LØ !Ð !Ð !Ð !Ð !Ð !Ø €€€Ø Ð Ð Ð Ð Ð Ø %Ð %Ð %Ð %Ð %Ð %Ø €€€à Ð Ð Ð Ð Ð Ø iÐ iÐ iÐ iÐ iÐ iÐ iÐ iÐ iÐ iÐ iÐ ià€GˆC�L„L€à%€àÔ€ðð ð ð ðð ð ð ð"*ð *ð *ð *ðZð ð ð,.ð .ð .ð .ð
 	ð"ð "ð "ñ 	„ð"ð	ð 	ð 	ð 	ð 	ñ 	ô 	ð 	ð	"ð 	"ð 	"ð 	"ð 	"ñ 	"ô 	"ð 	"ð"ð "ð "ð "ð "ñ "ô "ð "ð,-ð -ð -ð -ð -�Yñ -ô -ð -ð8L-ð L-ð L-ð L-ð L-�
ñ L-ô L-ð L-ð^ ˆi˜‰lŒl€ð6ð 6ð 6ðð ð ðð ð ðLð Lð Lð Lð LˆIñ Lô Lð Lðd €ð%.ð %.ð %.ð %.ð %.�5ñ %.ô %.ð %.ðP3!ð 3!ð 3!ð 3!ð 3!�ñ 3!ô 3!ð 3!ðl$Fð $Fð $Fð $Fð $F�ñ $Fô $Fð $FðN!ð !ð !ð !ð !�ñ !ô !ð !ð €uˆV�}„}€Ø€uˆV�}„}€Ø€uˆV�}„}€Øˆˆg‰Œ€Øˆˆg‰Œ€Øˆˆg‰Œ€Øˆˆg‰Œ€Ø	ˆˆx‰Œ€Ø	ˆˆx‰Œ€Ø	ˆˆx‰Œ€Øˆ5�‰>Œ>€Øˆe�JÑÔ€ØˆU�9ÑÔ€
ØˆU�9ÑÔ€
Øˆe�JÑÔ€Ø
ˆ%�‰-Œ-€Øˆ5�‰=Œ=€Ø
ˆ%�‰-Œ-€Ø
ˆ%�‰-Œ-€à	ˆ�eÑ	Ô	€ðUð Uð Uð Uð8Zð Zð Zð Zð ZˆZñ Zô Zð Zðzuð uð uð uð?>ð ?>ð ?>ð ?>ð ?>ˆJñ ?>ô ?>ð ?>ðD!ð !ð !ð !ð !ñ !ô !ð !ð/ð /ð /ð /ð / )ñ /ô /ð /ð:XNð XNð XNð XNð XN˜Zñ XNô XNð XNðvkð kð kð kð kÐ8ñ kô kð kð6*ð *ð *ð *ð *Ð.ñ *ô *ð *ð8 €�$ÐÑÔð.ð .ð .ð .ð .�iñ .ô .ñ Ôð.ð6?ð ?ð ?ðN 	ð&ð &ð &ñ 	„ð&ð$ 	ð(ð (ð (ñ 	„ð(ð  	ð(ð (ð (ñ 	„ð(ð
ð '>ð
ð 
ð 
€„ð4ð 4ð 4ð
ð ð ð 	ð/ð /ð /ñ 	„ð/ð, 	ð	8ð 	8ð 	8ñ 	„ð	8ð ØØ*.ð 8ð 8ð 8ð 8ñ 	„ñ Ôð8ð& ØØ*.ð *ð *ð *ð *ð *ñ 	„ñ Ôð*ð< ØØ$(ð *ð *ð *ð *ñ 	„ñ Ôð*ð, 	ð6ð 6ð 6ñ 	„ð6ðD 	ð ð  ð  ñ 	„ð ð.
 ð 
 ð 
 ð 
 ð Øðð ð ð ñ 	„ñ ÔððB ØØ"&ð =ð =ð =ð =ñ 	„ñ Ôð=ð( ØðGð Gð Gñ 	„ñ ÔðGð ØØ',¸Èð 8ð 8ð 8ð 8ñ 	„ñ Ôð8ð*.ð .ð .ð Øðð ð ñ 	„ñ Ôðð8 Øð>ð >ð >ð >ñ 	„ñ Ôð>ð< 	Ø°ÀÐ]aÐmtØðDð Dð Dñ 	„ðDðN 	ØKOÐ[`ÐmqØ¨'¸Tð&7ð &7ð &7ñ 	„ð&7ð\ 	ØrtØ#'ð9$ð 9$ð 9$ñ 	„ð9$ðx 	à%)ð3ð 3ð 3ð 3ñ 	„ð3ð 	à&*ð;ð ;ð ;ð ;ñ 	„ð;ð Øð.bð .bð .bñ 	„ñ Ôð.bðb 	ðWð Wð Wð Wñ 	„ðWð €ð Qñô ð Øð,ð ,ð ,ñ 	„ñ Ôñô ð
,ð 	ð Øð9_ð 9_ð 9_ð 9_ñ 	„ð9_ðBð ð ð ð ð> ØØÐÐ&°Ð5Ñ5Ô5ð?ð ?ð ?ñ 6Ô5ñ 	„ñ Ôð?ð ØØÐ�JÑÔñAð Að Añ  Ôñ 	„ñ ÔðAð ØØÐ�EÑÔñ@ð @ð @ñ Ôñ 	„ñ Ôð@ð ØØÐ�EÑÔñ@ð @ð @ñ Ôñ 	„ñ Ôð@ð ØØÐ�EÑÔñ@ð @ð @ñ Ôñ 	„ñ Ôð@ð ØØÐ�MÑ"Ô"ñ@ð @ð @ñ #Ô"ñ 	„ñ Ôð@ð ØØÐ�LÑ!Ô!ñ?ð ?ð ?ñ "Ô!ñ 	„ñ Ôð?ð ØØÐ�MÑ"Ô"ñ@ð @ð @ñ #Ô"ñ 	„ñ Ôð@ð 	ð,ð ,ð ,ñ 	„ð,ð6 	ñ2ñ 2ð 2ð 2ñ 	„ð2ð 	ñ2ñ 2ð 2ð 2ñ 	„ð2ð 	ñ2ñ 2ð 2ð 2ñ 	„ð2ð 	Ø-9Ô->È$ð 2ñ 2ð 2ð 2ñ 	„ð2ð* 	Ø-9Ô->È$ð 2ñ 2ð 2ð 2ñ 	„ð2ð* 	Ø2>Ô2CÈtð 7ñ 7ð 7ð 7ñ 	„ð7ðD [_Ø+/ðñ ð ð ð ð@ ð(ð (ñ „ð(ð Øñ.ð .ð .ñ 	„ñ Ôð.ðb 	ðð ð ñ 	„ðð 	ñð ð ñ 	„ðð,ñ ð ð ð ð0 Øñ"Qð "Qð "Qñ 	„ñ Ôð"QðJ Øð6ð 6ð 6ñ 	„ñ Ôð6ð$ Øð.ð .ð .ñ 	„ñ Ôð.ð" 	ð 
ØØðH.ð H.ñ H.ð H.ð H.ñ 	„ðH.ð` 	ð%ð %ð %ñ 	„ð%ð 	ð0ð 0ð 0ñ 	„ð0ð 	ð3ð 3ð 3ñ 	„ð3ð 	ð2ð 2ð 2ñ 	„ð2ð$ 	ð7ð 7ð 7ñ 	„ð7ð 	Ø%(°TÀÈEÐ]að 	ð 	ñ 	ð 	ð 	ñ 	„ð	ð 	ñ
	ð 
	ð 
	ñ 	„ð
	ð 	Ø$)°Tð -9ð -9ð -9ð -9ñ 	„ð-9ð` 	ñIð Ið Iñ 	„ðIð2 	à?Cð~Qñ ~Qð ~Qð ~Qñ 	„ð~QðL%Wð %Wð %Wð %Wð %W�:ñ %Wô %Wð %WðPCSð CSð CSð CSð CSˆJñ CSô CSð CSðL)ð )ð )ð )ð )�
ñ )ô )ð )ñ8%nð %nð %nð %nðP 	à!%ð'qñ 'qð 'qð 'qñ 	„ð'qðT;ð ;ð ;ðð ð ð
 ˆ6‰8Œ8€ð2ð 2ð 2ð 	Ø%-¸ð ð ð ð ñ 	„ðð. 	Ø%-¸ð ð ð ð ñ 	„ðð ð r$   