
    9i              	          S SK Jr  S SKJr  S SKJr  S SKJr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	/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)    )annotations	ASTSource)Language)JITFunctionconstexpr_function)TypeVarOptionalCallableIterableUnion)irTr   jitc                  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        b/var/www/html/land-doc-ocr/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	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                  UR                  5      5        UR                  S:H  nU(       a8  UR                  b+  U	R                  S	UR                  UR                  5      5        U" U R                   XX#XIS
9n	U	$ )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_irGluonASTSource.make_ir   s   9>**W%&&( v&((1g&=&=f&EF)?)?@Q@Q)RS(>(>w?O?O(PQ.0F0FwGXGX0YZ&&&0w2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_gluon4   s    r#   r   )rA   rB   rC   rD   rM   rR   rE   rF   rG   s   @r!   rI   rI   -   s    
 r#   rI   N)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>.decoratorU   s6    |||/+I+	
 		
r#   )r   r   r?   zJITFunction[T]rQ   )	r   rT   rU   rV   rW   rX   rY   rZ   r^   s	    ``````` r!   r   r   8   s&    :
 
 
~} r#   rL   )r   zOptional[T]rU   Optional[Callable]rV   r`   rW   Optional[Iterable[int | str]]rX   ra   rY   Optional[bool]rZ   rb   r?   z9Union[GluonJITFunction[T], Callable[[T], JITFunction[T]]])
__future__r   r-   r   triton.backends.compilerr   triton.runtime.jitr   r   typingr	   r
   r   r   r   triton._C.libtritonr   r   __all__r   rI   r   rQ   r#   r!   <module>ri      s    " . - > ? ? "CL
'Y @{1~  . #*.7;DH #.. 	.
 (. 5. %B. . . ?.r#   