o
    ^i%	                     @   sN   d dd dd dd dd diZ ddd	d
Zdddd
Zdd Zdd ZdS )CUDAc                 K      d| d  S )Ng  2C    widthkwargsr   r   P/var/www/html/RAG/RAG_venv/lib/python3.10/site-packages/triton/profiler/specs.py<lambda>       r	   c                 K   r   )Ng bBr   r   r   r   r   r   r	      r
   c                 K   s    |d | d d d | d  S )Nr   g    x:Ai  g   mBr   r   r   num_sms
clock_rater   r   r   r   r	      s    c                 K   s   |d |d  d | d  S )Ni @       @@g    .Ar   r   r   r   r   r   r	      s    )808990100g   vHBg   xHBg   B)gfx90agfx942gfx950i   i   i    c                 C   sn   | dkrt | | | d |d  S | tvrtd|  |t|  vr*td| t|  | }||||dS )a  
    Calculate the maximum FLOPS for a given device type and width.

    Args:
        device_type (str): The type of device (e.g., "CUDA", "HIP").
        arch (str): The architecture of the device (e.g., "80", "90").
        width (int): The width in bits.
        num_sms (int): The number of streaming multiprocessors.
        clock_rate (float): The clock rate in GHz.

    Returns:
        float: The maximum FLOPS for the given device type and width.
    HIPr   r   zUnsupported device type: zUnsupported architecture: )r   r   )amd_fp8_flops_by_archflops_by_device
ValueError)device_typearchr   r   r   
flops_funcr   r   r   	max_flops   s   r   c                 C   s0   | dkrd| | d d S | dksJ t | S )a  
    Calculate the maximum bytes per second for a given bus width and memory clock rate.

    Args:
        bus_width (int): The bus width in bits.
        memory_clock_rate (float): The memory clock rate in GHz.

    Returns:
        float: The maximum bytes per second.
    r      r   r   r   )amd_bps_by_arch)r   r   	bus_widthmemory_clock_rater   r   r   max_bps6   s   r#   N)r   r    r   r   r#   r   r   r   r   <module>   s   