o
    ?ß±iŽ  ã                   @   sL   d Z ddlZddlmZ dedeej fdd„Zdedeej fdd	„Z	dS )
zÃ
Imaginaire4 Attention Subpackage:
Unified implementation for all Attention implementations.

Flash Attention v2 (flash2) Backend: metadata
Always safe to import (as long as torch is available.)
é    N)Úsafe_logÚarch_tagÚreturnc                 C   ó"   | dk rt  d¡ g S tjtjgS )aM  
    Returns data type choices for forward pass according to arch tag (attention.utils.get_arch_tag).

    Parameters:
        arch_tag (int): Arch tag for the current CUDA device. Example: 80 for A100, 90 for H100.

    Returns:
        data_type_choices (list): a list of PyTorch data types. Empty if device is not supported.

    éP   úcFlash Attention v2 (flash2) is not supported because compute capability is below the minimum (8.0).©ÚlogÚdebugÚtorchÚfloat16Úbfloat16©r   © r   ú_/data/cameron/vidgen/cosmos-predict2.5/cosmos_predict2/_src/imaginaire/attention/flash2/meta.pyÚget_fwd_dtypes   ó   
r   c                 C   r   )aN  
    Returns data type choices for backward pass according to arch tag (attention.utils.get_arch_tag).

    Parameters:
        arch_tag (int): Arch tag for the current CUDA device. Example: 80 for A100, 90 for H100.

    Returns:
        data_type_choices (list): a list of PyTorch data types. Empty if device is not supported.

    r   r   r   r   r   r   r   Úget_bwd_dtypes0   r   r   )
Ú__doc__r   Ú/cosmos_predict2._src.imaginaire.attention.utilsr   r	   ÚintÚlistÚdtyper   r   r   r   r   r   Ú<module>   s
   