Ë
    ÏÍ:jC  ã            	      óâ   — 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mZmZ d dlmZ  e
d«      Z G d	„ d
e«      Z G d„ dee   «      Z	 dddddddddœ	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd„Zy)é    )ÚannotationsN)Ú	ASTSource)ÚLanguage)ÚJITFunction)ÚTypeVarÚOptionalÚCallableÚIterableÚUnion)ÚirÚTc                  ó(   ‡ — e Zd Zddˆ fd„Zd„ Zˆ xZS )ÚGluonASTSourcec                ób   •— t         ‰| �  ||||«       t        j                  | _        d| _        y )NÚttgir)ÚsuperÚ__init__r   ÚGLUONÚlanguageÚext)ÚselfÚfnÚ	signatureÚ
constexprsÚattrsÚ	__class__s        €úw/home/mcse/projects/srt_converter/srt-converter-venv/lib/python3.12/site-packages/triton/experimental/gluon/_runtime.pyr   zGluonASTSource.__init__   s(   ø€ Ü‰Ñ˜˜Y¨
°EÔ:Ü Ÿ™ˆŒØˆ�ó    c           	     óÎ  — ddl m} ddlm} t	        j
                  |«      }|j                  «       }t        j                  j                  j                  j                  «       }	 ||	«      }
|
j                  |«      }	|j                  d|j                  |	«      «       |j                  d|j                  |j                   «      «       |j                  d|j                  |j"                  «      «       |j                  d|j                  d«      «       |j$                  �+|j                  d	|j                  |j$                  «      «        || j&                  | |||||¬
«      }|S )Nr   )Úmake_backend)Úast_to_ttirz
ttg.targetzttg.num-warpszttg.num-ctaszttg.threads-per-warpé    zttg.maxnreg)ÚcontextÚoptionsÚcodegen_fnsÚ
module_mapÚmodule)Útriton.compiler.compilerr    Útriton.compiler.code_generatorr!   r   ÚbuilderÚcreate_moduleÚtritonÚruntimeÚdriverÚactiveÚget_current_targetÚget_target_nameÚset_attrÚget_string_attrÚget_int32_attrÚ	num_warpsÚnum_ctasÚmaxnregr   )r   r$   r%   r&   r#   r    r!   r*   r'   ÚtargetÚbackends              r   Úmake_irzGluonASTSource.make_ir   s  € Ý9Ý>ä—*‘*˜WÓ%ˆØ×&Ñ&Ó(ˆô —‘×&Ñ&×-Ñ-×@Ñ@ÓBˆÙ˜vÓ&ˆØ×(Ñ(¨Ó1ˆØ�‰˜ g×&=Ñ&=¸fÓ&EÔFØ�‰˜¨×)?Ñ)?À×@QÑ@QÓ)RÔSØ�‰˜¨×(>Ñ(>¸w×?OÑ?OÓ(PÔQØ�‰Ð.°×0FÑ0FÀrÓ0JÔKØ�?‰?Ð&Ø�O‰O˜M¨7×+AÑ+AÀ'Ç/Á/Ó+RÔSá˜TŸW™W d°GÀWÐZeØ(2¸6ôCˆàˆr   )NN)ÚreturnÚNone)Ú__name__Ú
__module__Ú__qualname__r   r:   Ú__classcell__©r   s   @r   r   r      s   ø„ öö
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                 ó   — y)NT© )r   s    r   Úis_gluonzGluonJITFunction.is_gluon1   s   € Ør   )r=   r>   r?   rF   rJ   r@   rA   s   @r   rC   rC   *   s   ø„ ôö
r   rC   )ÚversionÚreprÚlaunch_metadataÚdo_not_specializeÚdo_not_specialize_on_alignmentÚdebugÚnoinlinec               ó@   ‡‡‡‡‡‡‡— 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
    c           
     óD   •— 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>.decoratorR   s4   ø€ Ü˜Œ|Ðˆ|ÜØØØ/Ø+IØØØØ+ô	
ð 		
r   )r   r   r;   zJITFunction[T]rI   )	r   rK   rL   rM   rN   rO   rP   rQ   rU   s	    ``````` r   ÚjitrV   5   s&   þ€ ÷:
ó 
ð 
€~Ù˜‹}Ðð Ðr   rE   )r   zOptional[T]rL   úOptional[Callable]rM   rW   rN   úOptional[Iterable[int | str]]rO   rX   rP   úOptional[bool]rQ   rY   r;   z9Union[GluonJITFunction[T], Callable[[T], JITFunction[T]]])Ú
__future__r   r,   r(   r   Útriton.backends.compilerr   Útriton.runtime.jitr   Útypingr   r   r	   r
   r   Útriton._C.libtritonr   r   r   rC   rV   rI   r   r   ú<module>r_      s·   ðÝ "Û Ý .Ý -Ý *ß ?Õ ?Ý "áˆCƒL€ô�Yô ô<�{ 1‘~ô ð ð.ð Ø#Ø*.Ø7;ØDHØ Ø#ñ.Øð.ð ð	.ð
 (ð.ð 5ð.ð %Bð.ð ð.ð ð.ð ?ô.r   