o
    c۷im                     @   s   d dl mZmZ d dlmZ d dlm  mZ d dl	m
Z
 d dlmZmZ eddddejdejdee d	ed
eejejf f
ddZdS )    )TypeUnionN)OperandMajorMode)Numericdsl_user_oplocip	tiled_mmamma_tiler_mnka_dtype
num_stagesreturnc                C   s   | j jtjk}| tj|d||d}tj|d d ||d|d  tj|d d ||d|d  f}tj	tj
| j j||||d|||d}	tj|	tj||||d|sUdnd||d}
|
S )	a  
    :param tiled_mma: The tiled MMA used to partition tensor A
    :type tiled_mma: cute.TiledMma
    :param mma_tiler_mnk: The MMA tile shape
    :type mma_tiler_mnk: cute.cute.Tile
    :param a_dtype: The element type for tensor A
    :type a_dtype: Type[Numeric]
    :param num_stages: The number of pipeline stages for tensor A
    :type num_stages: int

    :return: SMEM layout for tensor A
    :rtype: Union[cute.Layout, cute.ComposedLayout]
    )   Nr   r   r   r      )r   r   r   )r   r   r   )orderr   r	   )opa_major_moder   Kpartition_shape_Acutedicesizesm100_utils_ogmake_smem_layout_atomget_smem_layout_atom_abtile_to_shapeappend)r
   r   r   r   r   r	   
is_k_majora_smem_shapea_smem_shape_mn_ka_smem_layout_atoma_smem_layout_staged r#   G/home/ubuntu/vllm_env/lib/python3.10/site-packages/quack/sm100_utils.pymake_smem_layout_cpasync_a   s6   
r%   )typingr   r   cutlass.cuter   cutlass.utils.blackwell_helpersutilsblackwell_helpersr   cutlass.cute.nvgpu.tcgen05r   cutlass.cutlass_dslr   r   TiledMmaTileintLayoutComposedLayoutr%   r#   r#   r#   r$   <module>   s&   