
    Pi                         d dl mZmZ ddlmZ ddlmZ ddlmZ	 ddl
mZ dZ ed	d
          Z edd
          Z G d de          Zd
S )   )enter_state
exit_state    )LazyDict   )Hook)proton)
ContextVar__proton_launch_metadataop_nameN)defaultidc                        e Zd ZdZdZg dZd eD             dgz   dgz   Zd Z fdZd	e	d
e
de	ddfdZd Zd ZdeddfdZdeddfdZ xZS )
LaunchHookd   N)          @   c                     g | ]}d | S )flops ).0widths     t/var/www/development/aibuddy-work/election-extract/venv/lib/python3.11/site-packages/triton/profiler/hooks/launch.py
<listcomp>zLaunchHook.<listcomp>   s    8885u888    bytesr   c                     d S Nr   selfs    r   __init__zLaunchHook.__init__       r   c                 z    | j         -t          t          |                               |           | _         | j         S r    )	_instancesuperr   __new__)cls	__class__s    r   r(   zLaunchHook.__new__   s2    = !*c22::3??CM}r   namemetadata_grouphashreturnc                     d S r    r   )r"   modulefunctionr+   r,   r-   s         r   init_handlezLaunchHook.init_handle   r$   r   c                     d S r    r   r!   s    r   activatezLaunchHook.activate    r$   r   c                     d S r    r   r!   s    r   
deactivatezLaunchHook.deactivate#   r$   r   metadatac                    t          t                     |                                t                       fdt          j        D             }t                              d                    t                              t          j
                               t          j        t                                          d                    t          j        t                                          |           d S )Nc                 *    i | ]}|v ||         S r   r   )r   klazy_metadatas     r   
<dictcomp>z$LaunchHook.enter.<locals>.<dictcomp>*   s*    \\\amI[I[aq)I[I[I[r   r+   )r   COMPUTE_METADATA_SCOPE_NAMEgetr   r   metricsr   setr   	libprotonrecord_scopeenter_opadd_metrics)r"   r7   
fn_metricsr;   s      @r   enterzLaunchHook.enter&   s    /000 \\\\:3E\\\
M&)***
y%''(((26688]6%:;;;bffhh
33333r   c                     t          j        t                                          t                                                     d S r    )rA   exit_opr   r>   r   )r"   r7   s     r   exitzLaunchHook.exit0   s+    "&&((GKKMM22222r   )__name__
__module____qualname__priorityr&   flops_widthr?   r#   r(   strdictr2   r4   r6   r   rF   rI   __classcell__)r*   s   @r   r   r      s       HI!//K88K888G9DyPG      
# t SV [_        4h 44 4 4 4 43X 3$ 3 3 3 3 3 3 3 3r   r   )stater   r   triton.compilerr   hookr   triton._C.libprotonr	   rA   contextvarsr
   r=   r   r   r   r   r   r   <module>rW      s    + + + + + + + + $ $ $ $ $ $       3 3 3 3 3 3 " " " " " "8 
*Y
-
-
-Zd###$3 $3 $3 $3 $3 $3 $3 $3 $3 $3r   