o
    ^i                     @   s   d dl mZ d dlmZ d dlmZ d dlm	Z	 d dl
mZ ddlmZ e	edZ	 ed	 hZd
d ZdefddZdefddZdejdejfddZeddejfddZeddejfddZG dd dZdS )    )core)builtin)proton)TritonSemantic)GluonSemantic   )get_instrumentation_on)tritongluonr
   c                 C   s*   t | ttstdt|  dt d S )NzUnsupported semantic type: z. Supported semantics are: )
isinstancetuple
_SEMANTICS	TypeErrortype)semantic r   S/var/www/html/RAG/RAG_venv/lib/python3.10/site-packages/triton/profiler/language.py_check_supported_semantic   s
   r   semantic_namec                 C      t t|   d S N)r   add_ALL_SEMANTICSr   r   r   r   enable_semantic      r   c                 C   r   r   )r   remover   r   r   r   r   disable_semantic    r   r   is_start
scope_namec                 C   sH   t  sd S t| t| } t|}|j }tt|| |tj	S r   )
r   r   tl_unwrap_if_constexprbuilderget_op_buildertensortriton_protoncreate_proton_recordvoid)r   r   r   
op_builderr   r   r   record$   s   


r)   Nnamec                 C      t d| |d d S )NTr   r   r   r)   r*   	_semanticr   r   r   enter_scope.      r0   c                 C   r+   )NFr,   r-   r.   r   r   r   
exit_scope3   r1   r2   c                   @   s,   e Zd Zd	defddZdd Zdd ZdS )
scopeNr*   c                 C   s   || _ || _d S r   )r*   r   )selfr*   r/   r   r   r   __init__:   s   
zscope.__init__c                 C      t | j| jd d S N)r/   )r0   r*   r   )r4   r   r   r   	__enter__>      zscope.__enter__c                 C   r6   r7   )r2   r*   r   )r4   exc_type	exc_value	tracebackr   r   r   __exit__A   r9   zscope.__exit__r   )__name__
__module____qualname__strr5   r8   r=   r   r   r   r   r3   8   s    r3   r   )triton.languager   r    triton.language.corer   triton._C.libtritonr   r%   triton.language.semanticr   ,triton.experimental.gluon.language._semanticr   flagsr   r   r   r   rA   r   r   	constexprr)   r0   r2   r3   r   r   r   r   <module>   s(    

