
    XhC              	          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dS )    )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 )GluonASTSourceNreturnNonec                    t                                          ||||           t          j        | _        d| _        d S )Nttgir)super__init__r   GLUONlanguageext)selffn	signature
constexprsattrs	__class__s        t/var/www/tools.fuzzalab.pt/emblema-extractor/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        |          }|                                }t          j        j	        j
                                        }	 ||	          }
|
                    |          }	|                    d|                    |	                     |                    d|                    |j                             |                    d|                    |j                             |                    d|                    d                     |j        .|                    d	|                    |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   sn   999999>>>>>>*W%%&&(( &-@@BB,v&&((11g&=&=f&E&EFFF)?)?@Q)R)RSSS(>(>w?O(P(PQQQ.0F0Fr0J0JKKK?&OOM7+A+A'/+R+RSSSTWdGWZe(26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_gluon1   s    tr    )r=   r>   r?   rF   rJ   r@   rA   s   @r   rC   rC   *   sG            
      r    rC   )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>.decoratorR   sD    ||/+I+	
 	
 	
 		
r    N)r   r   r   rX   rI   )	r   rK   rL   rM   rN   rO   rP   rQ   r[   s	    ``````` r   jitr\   5   sb    :
 
 
 
 
 
 
 
 
 
 
 
 
~y}} r    rE   )r   rR   rL   rS   rM   rS   rN   rT   rO   rT   rP   rU   rQ   rU   r   rV   )
__future__r   r.   r*   r   triton.backends.compilerr   triton.runtime.jitr   typingr   r   r	   r
   r   triton._C.libtritonr   r   r   rC   r\   rI   r    r   <module>rb      s@   " " " " " "  . . . . . . - - - - - - * * * * * * ? ? ? ? ? ? ? ? ? ? ? ? ? ? " " " " " "GCLL    Y   <    {1~    . #*.7;DH #. . . . . . . .r    