o
    灛i                     @   s:   d dl mZmZmZ G dd dedZG dd deZdS )    )ABCMetaabstractmethodabstractclassmethodc                   @   s.   e Zd Zedd Zedd Zd	ddZdS )

DriverBasec                 C      d S N selfr   r   X/sda-disk/www/egybert/egybert_env/lib/python3.10/site-packages/triton/backends/driver.py	is_active      zDriverBase.is_activec                 C   r   r   r   r	   r   r   r   get_current_target
   r   zDriverBase.get_current_targetreturnNc                 C   r   r   r   r	   r   r   r   __init__      zDriverBase.__init__)r   N)__name__
__module____qualname__r   r   r   r   r   r   r   r   r   r      s    

r   )	metaclassc                   @   s   e Zd Zdd Zdd ZdS )	GPUDriverc                    sb   dd l   jj| _zddlm} || _W n ty$    fdd| _Y nw  jj| _ jj	| _
d S )Nr   )_cuda_getCurrentRawStreamc                    s    j | jS r   )cudacurrent_streamcuda_stream)idxtorchr   r   <lambda>   s    z$GPUDriver.__init__.<locals>.<lambda>)r   r   get_device_capabilitytorch._Cr   get_current_streamImportErrorcurrent_deviceget_current_device
set_deviceset_current_device)r
   r   r   r   r   r      s   


zGPUDriver.__init__c                 C   s   |S r   r   )r
   tensormaps_infoargsr   r   r   assemble_tensormap_to_arg!   r   z#GPUDriver.assemble_tensormap_to_argN)r   r   r   r   r)   r   r   r   r   r      s    r   N)abcr   r   r   r   r   r   r   r   r   <module>   s    