
    "hj                     t    d dl mZmZmZ d dlmZmZmZmZ  G d de      Z	 G d de      Z
 G d d	e
      Zy
)    )ABCMetaabstractmethodabstractclassmethod)CallableListProtocolSequencec                   ,    e Zd Zdedee   dee   fdZy)Benchmarkerkernel_call	quantilesreturnc                     y N )selfr   r   kwargss       S/var/www/html/sandstorm/venv/lib/python3.12/site-packages/triton/backends/driver.py__call__zBenchmarker.__call__           N)__name__
__module____qualname__r   r   floatr	   r   r   r   r   r   r      s'    H DK V^_dVe r   r   c                   J    e Zd Zed        Zed        Zedefd       ZddZ	y)
DriverBasec                      y r   r   r   s    r   	is_activezDriverBase.is_active       r   c                      y r   r   r   s    r   get_current_targetzDriverBase.get_current_target   r!   r   r   c                     t         )z[
        Return the benchmarking function that this backend should use by default.
        )NotImplementedErrorr   s    r   get_benchmarkerzDriverBase.get_benchmarker   s
    
 "!r   Nc                      y r   r   r   s    r   __init__zDriverBase.__init__   r   r   )r   N)
r   r   r   r   r    r   r#   r   r&   r(   r   r   r   r   r      sH        " " "r   r   )	metaclassc                       e Zd Zd Zd Zy)	GPUDriverc                     dd l j                  j                  | _        	 ddlm} || _        j                  j                  | _        j                  j                  | _
        y # t        $ r fd| _        Y Lw xY w)Nr   )_cuda_getCurrentRawStreamc                 N    j                   j                  |       j                  S r   )cudacurrent_streamcuda_stream)idxtorchs    r   <lambda>z$GPUDriver.__init__.<locals>.<lambda>*   s    %**2K2KC2P2\2\ r   )r3   r/   get_device_capabilitytorch._Cr-   get_current_streamImportErrorcurrent_deviceget_current_device
set_deviceset_current_device)r   r-   r3   s     @r   r(   zGPUDriver.__init__"   sj    %*ZZ%E%E"	]:&?D# #(**";";"'**"7"7  	]&\D#	]s   A& &A<;A<c                     |S r   r   )r   tensormaps_infoargss      r   assemble_tensormap_to_argz#GPUDriver.assemble_tensormap_to_arg/   s    r   N)r   r   r   r(   r@   r   r   r   r+   r+       s    
8r   r+   N)abcr   r   r   typingr   r   r   r	   r   r   r+   r   r   r   <module>rC      s5    < < 5 5( 7 *
 r   