
    hC              	          S SK Jr  S SKrS SKJr  S SKJr  S SKJr  S SK	J
r
JrJrJrJr  S SKJr  \
" S5      r " S	 S
\5      r " S S\\   5      r SSSSSSSSS.               SS jjjrg)    )annotationsN	ASTSource)Language)JITFunction)TypeVarOptionalCallableIterableUnion)irTc                  6   ^  \ rS rSrSSU 4S jjjrS rSrU =r$ )GluonASTSource   c                ^   > [         TU ]  XX45        [        R                  U l        SU l        g )Nttgir)super__init__r   GLUONlanguageext)selffn	signature
constexprsattrs	__class__s        \/var/www/fran/franai/venv/lib/python3.13/site-packages/triton/experimental/gluon/_runtime.pyr   GluonASTSource.__init__   s$    
:     c           
        SSK Jn  SSKJn  [        R
                  " U5      nUR                  5       n[        R                  R                  R                  R                  5       n	U" U	5      n
U
R                  U5      n	UR                  SUR                  U	5      5        UR                  SUR                  UR                   5      5        UR                  SUR                  UR"                  5      5        UR                  SUR                  S5      5        UR$                  b+  UR                  S	UR                  UR$                  5      5        U" U R&                  XXX8S
9nU$ )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_irGluonASTSource.make_ir   s   9>**W%&&( &&--@@Bv&((1g&=&=f&EF)?)?@Q@Q)RS(>(>w?O?O(PQ.0F0Fr0JK??&OOM7+A+A'//+RSTWWdW(2Cr!   )r   r   )NN)returnNone)__name__
__module____qualname____firstlineno__r   r=   __static_attributes____classcell__r   s   @r   r   r      s     
 r!   r   c                  .   ^  \ rS rSrU 4S jrS rSrU =r$ )GluonJITFunction*   c                :   > [         TU ]  5       n[        U l        U$ N)r   create_binderr   r   )r   resultr   s     r   rM   GluonJITFunction.create_binder,   s    &('r!   c                    g)NT )r   s    r   is_gluonGluonJITFunction.is_gluon1   s    r!   r   )rA   rB   rC   rD   rM   rR   rE   rF   rG   s   @r   rI   rI   *   s    
 r!   rI   )versionreprlaunch_metadatado_not_specializedo_not_specialize_on_alignmentdebugnoinlinec               F   ^^^^^^^ SUUUUUUU4S jjnU b  U" U 5      $ U$ )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                H   > [        U 5      (       d   e[        U TTTTTTTS9$ )N)rT   rW   rX   rY   rZ   rU   rV   )callablerI   )r   rY   rW   rX   rV   rZ   rU   rT   s    r   	decoratorjit.<locals>.decoratorR   s6    |||/+I+	
 		
r!   )r   r   r?   zJITFunction[T]rQ   )	r   rT   rU   rV   rW   rX   rY   rZ   r^   s	    ``````` r   jitr`   5   s&    :
 
 
~} r!   rL   )r   zOptional[T]rU   Optional[Callable]rV   ra   rW   Optional[Iterable[int | str]]rX   rb   rY   Optional[bool]rZ   rc   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   rI   r`   rQ   r!   r   <module>ri      s    "  . - * ? ? "CLY <{1~  . #*.7;DH #.. 	.
 (. 5. %B. . . ?.r!   