+
    ‹°³jr(  ã                   ó2  € ^ RI t ^ RIt^ RIHt ^ RIHt ^RIHt ^RIH	t	H
t
Ht ^RIHt ^RIHt ^ RIHtHt R	tR
 R ltR R ltR R ltR$RRRRRRRRRR/R R llltR$R R lltR%R R lltR&R R lltR'R R  lltR$R!RRRRRRRRRRR/R" R# llltR# )(é    N)Úproton)Úgetenv)Úflags)ÚHookManagerÚ
LaunchHookÚInstrumentationHook)ÚHook)ÚBaseMode)ÚOptionalÚUnionr   c                ó$   € V ^8„  d   QhR\         /# )é   Úreturn©Ústr)Úformats   "ÚX/home/luca/screen-checking/.venv/lib/python3.14/site-packages/triton/profiler/profile.pyÚ__annotate__r      s   € ÷ Bñ Bœñ Bó    c                  ó¦   € \         P                  P                  P                  P	                  4       P
                  p \        P                  ! V 4      # ©N)ÚtritonÚruntimeÚdriverÚactiveÚget_current_targetÚbackendÚ	libprotonÚ#select_profiler_from_triton_backend)r   s    r   Ú_select_backendr       s7   € Ü�n‰n×#Ñ#×*Ñ*×=Ñ=Ó?×GÑG€GÜ×8Ò8¸ÓAÐAr   c                ót   € V ^8„  d   QhR\         R\        \        \         \        3,          ,          R\         /# )r   r   Úmoder   )r   r   r   r
   )r   s   "r   r   r      s/   € ÷ %ñ %œ3ð %¤h¬u´S¼(°]Õ/CÕ&Dð %Ìñ %r   c                 óÔ   € V R 8X  dN   \         P                  P                  P                  P	                  4       P
                  pV'       d   V RV 2# T# V'       d   \        V4      # R# )ÚinstrumentationÚ:Ú )r   r   r   r   r   r   r   )r   r"   Úprefixs   && r   Ú_get_mode_strr(      sX   € ØÐ#Ô#Ü—‘×&Ñ&×-Ñ-×@Ñ@ÓB×JÑJˆß%)�&�˜˜4˜&Ð!Ð5¨vÐ5ßŒ3ˆt‹9Ð$ "Ð$r   c                ó(   € V ^8„  d   QhR\         RR/# )r   r   r   Nr   )r   s   "r   r   r      s   € ÷ 9ñ 9œð 9 ñ 9r   c                 óF  € V R9   d+   RR.pV F   p\        VR4      f   K  \        RV R24      h	  V R8H  ;'       d@    \        P                  P                  P
                  P                  4       P                  ^d8¬  p\        P                  P                  P                  P                  4        Fí  w  rEVP                  p\        VR4      e   K!  VR8X  dM   V'       dE   \        P                  P                  V\        P                  P                  P                  4       Kt  \        \        P                  P                  V4      pVf   Kž  \        P                  P!                  V4      ;p'       g   KÇ  \        P                  P                  Wh^ ,          4       Kï  	  R# )	ÚrocprofilerÚHIP_VISIBLE_DEVICESÚCUDA_VISIBLE_DEVICESNz3Proton does not work when the environment variable zK is set on AMD GPUs. Please unset it and use `ROCR_VISIBLE_DEVICES` insteadÚcuptiÚTRITON_CUPTI_LIB_PATH)r+   Ú	roctracer)r   Ú
ValueErrorr   r   r   r   r   ÚarchÚknobsr   Úknob_descriptorsÚitemsÚkeyÚsetenvÚcupti_lib_blackwell_dirÚgetattrÚtoenv)	r   Úhip_device_envsÚenvÚuse_blackwell_cuptiÚattrÚdescr6   ÚvalÚenv_vals	   &        r   Ú
_check_envrB      sG  € ØÐ.Ô.Ø0Ð2HÐIˆÛ"ˆCÜ�c˜4Ó Ô,Ü ØIÈ#Èð  OZð  [óð ñ #ð " WÑ,×nÐn´·±×1FÑ1F×1MÑ1M×1`Ñ1`Ó1b×1gÑ1gÐknÑ1nÐô —l‘l×)Ñ)×:Ñ:×@Ñ@ÖB‰
ˆØ�h‰hˆÜ�#�tÓÔ$ØÐ-Ô-×2Eä—‘×#Ñ# C¬¯©×)<Ñ)<×)TÑ)TÔUÙÜœ&Ÿ,™,×-Ñ-¨tÓ4ˆCØŒÜ$Ÿl™l×0Ñ0°Ó5Ð5�7×5Ð5Ü—L‘L×'Ñ'¨°Q­ZÖ8ó Cr   ÚcontextÚshadowÚdataÚtreer   r"   Úhookc                óJ  € V ^8„  d   QhR\         \        ,          R\         \        ,          R\         \        ,          R\         \        ,          R\         \        \        \        3,          ,          R\         \        \        \        3,          ,          R\         \
        ,          /# )r   ÚnamerC   rE   r   r"   rG   r   )r   r   r   r
   r	   Úint)r   s   "r   r   r   4   s‰   € ÷ Nñ NÜ
”3�-ðNô ”c�]ðNô ”3�-ð	Nô
 ”c�]ðNô ”5œœh˜Õ'Õ
(ðNô ”5œœd˜Õ#Õ
$ðNô Œc…]ñNr   c               óP  € \         P                  '       g+   \        P                  P                  P
                  '       d   R# R\         n        V f   \        MT p Vf   \        4       MTp\        W44      p\        V4       \        P                  ! WW#V4      p\        V\        4      '       d   \        P                   ! WW4       M:VR8X  d!   \        P                   ! \#        4       V4       MVe   \%        RV: 24      hVR8X  d!   \        P                   ! \'        V4      V4       V# )aÄ  
Start profiling with the given name and backend.

Usage:

    ```python
    proton.start("my_profile")
    # do something
    proton.finalize()
    ```

Args:
    name (str, optional): The name (with path) of the profiling session.
                          If not provided, the default name is "~/proton.<suffix>", where suffix is the default
                          format according to the data type. For example, if data is "tree", the default name is "~/proton.hatchet".
    context (str, optional): The context to use for profiling.
                             Available options are ["shadow", "python"].
                             Defaults to "shadow".
    data (str, optional): The data structure to use for profiling.
                          Available options are ["tree", "trace"].
                          Defaults to "tree".
    backend (str, optional): The backend to use for profiling.
                             Available options are [None, "cupti", "rocprofiler", "roctracer", "instrumentation"].
                             Defaults to None, which automatically selects the backend matching the current active runtime.
                             On AMD GPUs, "rocprofiler" is preferred and will fall back to "roctracer" if
                             rocprofiler-sdk is not available.
    mode (Union[str, BaseMode], optional): The "mode" to use for profiling, which is specific to the backend.
                                           Can be a string or an instance of BaseMode (or any subclass thereof).
                                           Defaults to None.
                                           For "cupti", available options are [None, "pcsampling", "periodic_flushing"].
                                           For "rocprofiler", available options are [None, "periodic_flushing"].
                                           For "roctracer", available options are [None, "periodic_flushing"].
                                           For "instrumentation", available options are [None].
                                           Each mode has a set of control knobs following with the mode name.
                                           For example, "periodic_flushing" mode has a knob:
                                           - format: The output format of the profiling results. Available options are ["hatchet", "hatchet_msgpack", "chrome_trace"]. Default is "hatchet".
                                           The can be set via `mode="periodic_flushing:format=chrome_trace"`.
    hook (Union[str, Hook], optional): The hook to use for profiling.
                                       You may pass either:
                                       - a string hook name, e.g. "triton" (kernel launch metadata), or
                                       - a custom Hook instance.
                                       Defaults to None.
Returns:
    session (Optional[int]): The session ID of the profiling session, or None if profiling is disabled.
NTr   zUnsupported hook: r$   )r   Úcommand_liner   r3   r   ÚdisableÚprofiling_onÚDEFAULT_PROFILE_NAMEr    r(   rB   r   ÚstartÚ
isinstancer	   r   Úregisterr   r1   r   )rI   rC   rE   r   r"   rG   Úmode_strÚsessions   &$$$$$  r   rP   rP   4   sá   € ôl ××ÐœVŸ\™\×0Ñ0×8×8Ð8áà„EÔà#'¢<Õ°T€DØ#*¢?ŒoÔ¸€Gä˜WÓ+€HäˆwÔä�oŠo˜d¨T¸HÓE€Gä�$œ×ÒÜ×Ò˜TÕ+Ø	�Ô	Ü×ÒœZ›\¨7Õ3Ø	Ò	ÜÐ-¨d©XÐ6Ó7Ð7ØÐ#Ô#Ü×ÒÔ0°Ó6¸Ô@à€Nr   c                ó>   € V ^8„  d   QhR\         \        ,          RR/# )r   rT   r   N)r   rJ   )r   s   "r   r   r   …   s   € ÷ $ñ $”hœs•mð $¨tñ $r   c                óä   € \         P                  '       d   V ^ 8w  d   \        R4      h\        P                  ! V 4       V f   \
        P                  ! 4        R# \
        P                  ! V 4       R# )z×
Activate the specified session.
The profiling session will be active and data will be recorded.

Args:
    session (int): The session ID of the profiling session. Defaults to None (all sessions)

Returns:
    None
zEOnly one session can be activated when running from the command line.N)r   rL   r1   r   Úactivater   Úactivate_all)rT   s   &r   rW   rW   …   sO   € ô ××Ð˜g¨œlÜÐ`ÓaÐaä×Ò˜Ô!à‚Ü×ÒÖ ä×Ò˜7Ö#r   c                óJ   € V ^8„  d   QhR\         \        ,          R\        RR/# )r   rT   Úflushingr   N)r   rJ   Úbool)r   s   "r   r   r   ›   s%   € ÷ 0ñ 0œ¤�ð 0¼ð 0Èñ 0r   c                óæ   € \         P                  '       d   V ^ 8w  d   \        R4      h\        P                  ! V 4       V f   \
        P                  ! V4       R# \
        P                  ! W4       R# )aP  
Stop the specified session.
The profiling session's data will still be in the memory, but no more data will be recorded.

Args:
    session (int): The session ID of the profiling session. Defaults to None (all sessions)
    flushing (bool): Whether to flush the profiling data before deactivating. Defaults to True.

Returns:
    None
zGOnly one session can be deactivated when running from the command line.N)r   rL   r1   r   Ú
deactivater   Údeactivate_all)rT   rZ   s   &&r   r]   r]   ›   sQ   € ô ××Ð˜g¨œlÜÐbÓcÐcä×Ò˜7Ô#à‚Ü× Ò  Ö*ä×Ò˜WÖ/r   c                ó`   € V ^8„  d   QhR\         \        ,          R\         \        ,          RR/# )r   rT   Úoutput_formatr   N)r   rJ   r   )r   s   "r   r   r   ²   s*   € ÷ 3ñ 3”hœs•mð 3¼8ÄC½=ð 3ÐRVñ 3r   c                óü   € \         P                  ! V 4       V f$   R\        n        \        P
                  ! V4       R# \        P                  '       d   V ^ 8w  d   \        R4      h\        P                  ! W4       R# )a±  
Finalizes a profiling session.
Flush and write the profiling data to the file specified by the session name.

Args:
    session (int, optional): The session ID to finalize. If None, all sessions are finalized. Defaults to None.
    output_format (str, optional): The output format for the profiling results.
                                   Available options are ["hatchet", "hatchet_msgpack", "chrome_trace"].

Returns:
    None
NFzEOnly one session can be finalized when running from the command line.)	r   Ú
unregisterr   rN   r   Úfinalize_allrL   r1   Úfinalize)rT   r`   s   &&r   rd   rd   ²   sY   € ô ×Ò˜7Ô#à‚Ø"ŒÔÜ×Ò˜}Ö-ä××Ð '¨Q¤,ÜÐdÓeÐeÜ×Ò˜7Ö2r   c                ó  € V ^8„  d   QhR\         \        ,          R\         \        ,          R\         \        ,          R\         \        ,          R\         \        ,          R\         \        \        \        3,          ,          /# ©r   rI   rC   rE   r   r"   rG   ©r   r   r   r	   )r   s   "r   r   r   Ê   sh   € ÷ ñ ä
”3�-ðô ”c�]ðô ”3�-ð	ô
 ”c�]ðô ”3�-ðô ”5œœd˜Õ#Õ
$ñr   c                ó^   a aaaaaa€ \         P                  ! S 4      VVVV VVV3R l4       pV# )z—
Context manager for profiling. Internally use only.

Args:
    See start() for the arguments.

Returns:
    wrapper (function): The wrapped function.
c            	      óP   <€ \        S
SSSS	SR 7      pS! V / VB p\        V4       V# ))rC   rE   r   r"   rG   )rP   r]   )ÚargsÚkwargsrT   Úretr   rC   rE   ÚfuncrG   r"   rI   s   *,  €€€€€€€r   ÚwrapperÚ_profiling.<locals>.wrapperÝ   s5   ø€ ä˜ g°DÀ'ÐPTÐ[_Ô`ˆÙ�DÐ#˜FÑ#ˆÜ�7ÔØˆ
r   )Ú	functoolsÚwraps)rm   rI   rC   rE   r   r"   rG   rn   s   fffffff r   Ú
_profilingrr   Ê   s,   þ€ ô& ‡_‚_�TÓ÷ò ó ðð €Nr   rI   c                ó  € V ^8„  d   QhR\         \        ,          R\         \        ,          R\         \        ,          R\         \        ,          R\         \        ,          R\         \        \        \        3,          ,          /# rf   rg   )r   s   "r   r   r   ç   sr   € ÷ #nñ #nô ”3�-ð#nô ”c�]ð	#nô
 ”3�-ð#nô ”c�]ð#nô ”3�-ð#nô ”5œœd˜Õ#Õ
$ñ#nr   c          
     óT   aaaaaa€ V f   VVVVVV3R lpV# \        V SSSSSSR7      # )z»
Decorator for profiling.

Usage:

```python
@proton.profile
def foo():
    pass
```

Args:
    See start() for the arguments.

Returns:
    decorator (function): The decorator function.
c           
      ó(   <€ \        V SSSSSSR 7      # )©rI   rC   rE   r   r"   rG   ©rr   )Úfr   rC   rE   rG   r"   rI   s   &€€€€€€r   Ú	decoratorÚprofile.<locals>.decorator  s   ø€ Ü˜a d°GÀ$ÐPWÐ^bÐimÔnÐnr   rv   rw   )rm   rI   rC   rE   r   r"   rG   ry   s   &dddddd r   Úprofiler{   ç   s9   ý€ ð6 ‚|÷	oò 	oð Ðô ˜$ T°7ÀÈwÐ]aÐhlÔmÐmr   r   )NF)Nr&   )NrD   rF   NNN)rp   r   Útriton._C.libprotonr   r   Útriton._C.libtritonr   r   Úhooksr   r   r   Ú
hooks.hookr	   r"   r
   Útypingr   r   rO   r    r(   rB   rP   rW   r]   rd   rr   r{   © r   r   Ú<module>r‚      sß   ðÛ Û å 3Ý &Ý ß ?Ñ ?Ý Ý ß "àÐ õBõ
%õ9ñ2Nð &ðNð !ð	Nð
 "ðNð ,0ðNð (,÷Nð N÷b$÷,0÷.3÷0ñ:#nð ð#nð &ð	#nð
 !ð#nð "ð#nð ð#nð (,÷#nò #nr   