§
    OŠtj…  ã            	      óâ   — d dl mZ d dlmZ d dlmZ d dlmZmZ d dl	m
Z
mZmZmZmZ d dlmZ  e
d¦  «        Zdd	gZ G d
„ de¦  «        Z G d„ dee         ¦  «        Z	 dddddddddœdd„ZdS ) é    )Úannotations)Ú	ASTSource)ÚLanguage)ÚJITFunctionÚconstexpr_function)ÚTypeVarÚOptionalÚCallableÚIterableÚUnion)ÚirÚTr   Újitc                  ó(   ‡ — e Zd Zddˆ fd„Zd„ Zˆ xZS )ÚGluonASTSourceNÚreturnÚNonec                ó€   •— t          ¦   «                              ||||¦  «         t          j        | _        d| _        d S )NÚttgir)ÚsuperÚ__init__r   ÚGLUONÚlanguageÚext)ÚselfÚfnÚ	signatureÚ
constexprsÚattrsÚ	__class__s        €ú`/var/www/html/CA-Chatbot/venv/lib/python3.11/site-packages/triton/experimental/gluon/_runtime.pyr   zGluonASTSource.__init__   s5   ø€ Ý‰Œ×Ò˜˜Y¨
°EÑ:Ô:Ð:Ý œˆŒØˆŒˆˆó    c           	     óÆ  — ddl m} ddlm} t	          j        |¦  «        }|                     ¦   «         }	 ||¦  «        }
|
                     |¦  «        }|	                     d| 	                    |¦  «        ¦  «         |	                     d| 
                    |j        ¦  «        ¦  «         |	                     d| 
                    |j        ¦  «        ¦  «         |	                     d| 
                    |j        ¦  «        ¦  «         |j        dk    }|r5|j        �.|	                     d	| 
                    |j        ¦  «        ¦  «          || j        | |||||	¬
¦  «        }	|	S )Nr   )Úmake_backend)Úast_to_ttirz
ttg.targetzttg.num-warpszttg.num-ctaszttg.threads-per-warpÚcudazttg.maxnreg)ÚcontextÚoptionsÚcodegen_fnsÚ
module_mapÚmodule)Útriton.compiler.compilerr$   Útriton.compiler.code_generatorr%   r   ÚbuilderÚcreate_moduleÚget_target_nameÚset_attrÚget_string_attrÚget_int32_attrÚ	num_warpsÚnum_ctasÚ	warp_sizeÚbackend_nameÚmaxnregr   )r   Útargetr(   r)   r*   r'   r$   r%   r.   r+   ÚbackendÚis_cudas               r!   Úmake_irzGluonASTSource.make_ir   sm  € Ø9Ð9Ð9Ð9Ð9Ð9Ø>Ð>Ð>Ð>Ð>Ð>å”*˜WÑ%Ô%ˆØ×&Ò&Ñ(Ô(ˆð �,˜vÑ&Ô&ˆØ×(Ò(¨Ñ1Ô1ˆà�Š˜ g×&=Ò&=¸fÑ&EÔ&EÑFÔFÐFØ�Š˜¨×)?Ò)?ÀÔ@QÑ)RÔ)RÑSÔSÐSØ�Š˜¨×(>Ò(>¸wÔ?OÑ(PÔ(PÑQÔQÐQØ�ŠÐ.°×0FÒ0FÀwÔGXÑ0YÔ0YÑZÔZÐZàÔ&¨&Ò0ˆØð 	T�w”Ð2Ø�OŠO˜M¨7×+AÒ+AÀ'Ä/Ñ+RÔ+RÑSÔSÐSà�˜TœW d°GÀWÐZeØ(2¸6ðCñ Cô Cˆàˆr"   )NN)r   r   )Ú__name__Ú
__module__Ú__qualname__r   r<   Ú__classcell__©r    s   @r!   r   r      sQ   ø€ € € € € ðð ð ð ð ð ð ð
ð ð ð ð ð ð r"   r   c                  ó$   ‡ — e Zd Zˆ fd„Zd„ Zˆ xZS )ÚGluonJITFunctionc                ó`   •— t          ¦   «                              ¦   «         }t          | _        |S ©N)r   Úcreate_binderr   r   )r   Úresultr    s     €r!   rF   zGluonJITFunction.create_binder/   s$   ø€ Ý‘”×&Ò&Ñ(Ô(ˆÝ'ˆŒØˆr"   c                ó   — dS )NT© )r   s    r!   Úis_gluonzGluonJITFunction.is_gluon4   s   € Øˆtr"   )r=   r>   r?   rF   rJ   r@   rA   s   @r!   rC   rC   -   sG   ø€ € € € € ðð ð ð ð ð
ð ð ð ð ð ð r"   rC   N)ÚversionÚreprÚlaunch_metadataÚdo_not_specializeÚdo_not_specialize_on_alignmentÚdebugÚnoinliner   úOptional[T]rL   úOptional[Callable]rM   rN   úOptional[Iterable[int | str]]rO   rP   úOptional[bool]rQ   r   ú9Union[GluonJITFunction[T], Callable[[T], JITFunction[T]]]c               óF   ‡‡‡‡‡‡‡— dˆˆˆˆˆˆˆfd„}| � || ¦  «        S |S )a<  
    Decorator for JIT-compiling a function using the Triton compiler.

    :note: When a jit'd function is called, arguments are
        implicitly converted to pointers if they have a :code:`.data_ptr()` method
        and a `.dtype` attribute.

    :note: This function will be compiled and run on the GPU. It will only have access to:

           * python primitives,
           * builtins within the triton package,
           * arguments to this function,
           * other jit'd functions

    :param fn: the function to be jit-compiled
    :type fn: Callable
    r   r   r   úJITFunction[T]c           
     óT   •— t          | ¦  «        sJ ‚t          | ‰‰‰‰‰‰‰¬¦  «        S )N)rK   rN   rO   rP   rQ   rL   rM   )ÚcallablerC   )r   rP   rN   rO   rM   rQ   rL   rK   s    €€€€€€€r!   Ú	decoratorzjit.<locals>.decoratorU   sC   ø€ Ý˜‰|Œ|ÐÐˆ|ÝØØØ/Ø+IØØØØ+ð	
ñ 	
ô 	
ð 		
r"   N)r   r   r   rX   rI   )	r   rK   rL   rM   rN   rO   rP   rQ   r[   s	    ``````` r!   r   r   8   sb   øøøøøøø€ ð:
ð 
ð 
ð 
ð 
ð 
ð 
ð 
ð 
ð 
ð 
ð 
ð 
€~Øˆy˜‰}Œ}Ðð Ðr"   rE   )r   rR   rL   rS   rM   rS   rN   rT   rO   rT   rP   rU   rQ   rU   r   rV   )Ú
__future__r   r,   r   Útriton.backends.compilerr   Útriton.runtime.jitr   r   Útypingr   r	   r
   r   r   Útriton._C.libtritonr   r   Ú__all__r   rC   r   rI   r"   r!   ú<module>rb      sH  ðØ "Ð "Ð "Ð "Ð "Ð "Ø .Ð .Ð .Ð .Ð .Ð .Ø -Ð -Ð -Ð -Ð -Ð -Ø >Ð >Ð >Ð >Ð >Ð >Ð >Ð >Ø ?Ð ?Ð ?Ð ?Ð ?Ð ?Ð ?Ð ?Ð ?Ð ?Ð ?Ð ?Ð ?Ð ?Ø "Ð "Ð "Ð "Ð "Ð "à€GˆC�L„L€à Ð
'€ðð ð ð ð �Yñ ô ð ð@ð ð ð ð �{ 1”~ñ ô ð ð ð.ð Ø#Ø*.Ø7;ØDHØ Ø#ð.ð .ð .ð .ð .ð .ð .ð .r"   