o
    ÒÙ¾i†  ã                   @   sF   d Z ddlZddlmZ ejdd„ ƒZejdd„ ƒZejdd„ ƒZdS )	a3  
Copyright (c) 2024 by FlashInfer team.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
é    Nc                 C   ó@  t  d¡}t  |
| d ¡t  |
| ¡ }||}}t  | |d  |¡ t  | |d  d |¡ t  | |d  d |¡ |rEt  || ¡nt  |t j¡}||| |  }t  || |¡ |t  |
| ¡|  }t  || |¡ |	t  |
| ¡|  }t  || |¡ t  || |¡ t  || |r“|n|¡ t  || |¡ d S ©Nr   é   é   é   ©ÚtlÚ
program_idÚloadÚstoreÚcastÚint64)Úall_problems_ptrÚx_ptrÚw_ptrÚy_ptrÚx_ld_ptrÚw_ld_ptrÚy_ld_ptrÚxÚwÚyÚ	xy_indptrÚ	w_indicesÚd_inÚd_outÚw_column_majorÚpidÚmÚkÚnÚw_iÚ
w_curr_ptrÚ
x_curr_ptrÚ
y_curr_ptr© r%   úJ/home/ubuntu/.local/lib/python3.10/site-packages/flashinfer/triton/gemm.pyÚcompute_sm80_group_gemm_args   ó    
 
 r'   c                 C   r   r   r   )r   r   r   r   Úx_stride_ptrÚw_stride_ptrÚy_stride_ptrr   r   r   r   r   r   r   r   r   r   r   r    r!   r"   r#   r$   r%   r%   r&   Úcompute_sm90_group_gemm_args?   r(   r,   c           	      C   s~   t  d¡}t  | | ¡}t  | | d ¡}t  || ¡}t|| ƒD ]}t  || | || ¡ t  || | || ¡ q"d S )Nr   r   )r   r	   r
   Úranger   )	Úm_indptrÚpadded_m_indptrÚm_rankÚpadded_m_rankr   Úm_startÚm_endÚpadded_m_startÚir%   r%   r&   Úcompute_padding_mappingi   s   
þr6   )	Ú__doc__ÚtritonÚtriton.languageÚlanguager   Újitr'   r,   r6   r%   r%   r%   r&   Ú<module>   s    
)
)