+
    "Ý³j  ã                   ón  € ^ RI t ^ RIt^ RIt^ RIHt ^ RIHt ^ RIH	t	H
t
HtHt ] P                  ! ]4      t]P!                  ] P"                  ! 4       4        ^ RIHt ]! ]! ]P0                  ! R^ 4      4      4      tR R	 ltR
 R ltR R ltR R ltR#   ] d    ]P+                  R4       Rt LUi ; i)é    N)Úis_compiling)Ú	out_dtype)Ú_cpu_is_amx_tile_supportedÚ_cpu_is_vnni_supportedÚ
_is_deviceÚtorch_version_at_least)Úintmm_tritonzTWarning: Detected no triton, on systems without Triton certain kernels will not workÚTORCHAO_AUTOTUNER_ENABLEc                óx   € V ^8„  d   QhR\         P                  R\         P                  R\         P                  /# )é   ÚinputÚmat2Úreturn©ÚtorchÚTensor)Úformats   "ÚU/home/luca/screen-checking/.venv/lib/python3.14/site-packages/torchao/kernel/intmm.pyÚ__annotate__r   #   s-   € ÷ :
ñ :
”u—|‘|ð :
¬5¯<©<ð :
¼E¿L¹Lñ :
ó    c                ó`  € \        4       '       g   RV P                  4       9   dÇ   V P                  P                  R8X  de   \	        \
        P                  P                  P                  P                  \
        P                  V P                  4       VP                  4       4      # \	        \
        P                  P                  P                  P                  \
        P                  W4      # VP                  V P                  8X  g"   Q RVP                   RV P                   24       hRVP                  P                  V P                  P                  39   pV P                  ^,          ^,          ^ 8H  ;'       d    V P                  ^,          ^ 8„  pVP                  ^,          ^,          ^ 8H  ;'       d    VP                  ^,          ^ 8„  pT;'       d    T'       * pV'       g	   V'       d‘   \
        P                  ! V P                  4       P                  \
        P                  4      VP                  4       P                  \
        P                  4      4      P                  V P                  P                  4      # VP!                  4       '       g   VP#                  4       pV P!                  4       '       g0   V P                  ^ ,          ^,          ^ 8w  d   V P#                  4       p  \	        \
        P                  P                  P                  P                  \
        P                  W4      #   \$         dr    \
        P                  ! T P                  \
        P&                  4      TP                  \
        P&                  4      4      P                  \
        P                  4      u # i ; i)a’  
Performs a safe integer matrix multiplication, considering different paths for
torch.compile, cublas, and fallback cases.

Args:
    input (torch.Tensor): The input tensor of shape [i, j].
    mat2 (torch.Tensor): The matrix to multiply with, of shape [j, k].

Returns:
    torch.Tensor: The result of the matrix multiplication.

Raises:
    AssertionError: If the tensors are not on the same device.
Ú
FakeTensorÚcpuz3need both tensors to be on the same device but got z and )Údynamo_is_compilingÚ__repr__ÚdeviceÚtyper   r   ÚopsÚatenÚmmÚdefaultÚint32ÚfloatÚshapeÚmatmulr   ÚtoÚis_contiguousÚ
contiguousÚ	ExceptionÚfloat32)r   r   Ú
device_cpuÚj_is_nonzero_multiple_of_8Úk_is_nonzero_multiple_of_8Úbad_dimensions_for_cublass   &&    r   Úsafe_int_mmr/   #   s‡  € ô  ×Ò °·±Ó0@Ô @Ø�<‰<×Ñ Ô%äÜ—	‘	—‘×!Ñ!×)Ñ)¬5¯;©;¸¿¹»ÀtÇzÁzÃ|óð ô œŸ™Ÿ™×*Ñ*×2Ñ2´E·K±KÀÓMÐMð �;‰;˜%Ÿ,™,Ô&ð Ø
=¸d¿k¹k¸]È%ÐPU×P\ÑP\È~Ð^óÐ&ð ˜4Ÿ;™;×+Ñ+¨U¯\©\×->Ñ->Ð?Ñ?€Jà"'§+¡+¨a¥.°1Õ"4¸Ñ"9×!SÐ!SÀÇÁÈAÅÐQRÑ@RÐØ"&§*¡*¨Q¥-°!Õ"3°qÑ"8×!QÐ!Q¸t¿z¹zÈ!½}ÈqÑ?PÐà"×AÐAÐ'Aô!Ð÷ ×.ä�|Š|˜EŸI™I›KŸN™N¬5¯;©;Ó7¸¿¹»¿¹ÄuÇ{Á{Ó9SÓT×WÑWØ�L‰L×Ñó
ð 	
ð
 ×Ñ×ÒØ�‰Ó ˆØ×Ñ×!Ò!Ø�‰�A�˜Õ˜aÔð ×ÑÓð 	ð
ÜœŸ™Ÿ™×*Ñ*×2Ñ2´E·K±KÀÓMÐMøÜô 
ô �|Š|˜EŸH™H¤U§]¡]Ó3°T·W±W¼U¿]¹]Ó5KÓL×OÑOÜ�K‰Kó
ò 	
ð
ús   Ë*AL1 Ì1A9N-Î,N-c                óx   € V ^8„  d   QhR\         P                  R\         P                  R\         P                  /# )r   ÚaÚbr   r   )r   s   "r   r   r   `   s-   € ÷ ñ ”%—,‘,ð ¤5§<¡<ð ´E·L±Lñ r   c                ó’   € \         e6   \        '       d*   \        P                  P                  P                  W4      # \        W4      # )a<  
Performs integer matrix multiplication using intmm_triton if available and autotuner is enabled,
otherwise falls back to safe_int_mm.

Args:
    a (torch.Tensor): The first matrix to multiply.
    b (torch.Tensor): The second matrix to multiply.

Returns:
    torch.Tensor: The result of the matrix multiplication.
)r	   ÚAUTOTUNER_ENABLEr   r   ÚtorchaoÚ
int_matmulr/   )r1   r2   s   &&r   r6   r6   `   s6   € ô Ò×$4Ó$4Ü�y‰y× Ñ ×+Ñ+¨AÓ1Ð1Ü�qÓÐr   c                ó˜   € V ^8„  d   QhR\         P                  R\         P                  R\         P                  R\         P                  /# ©r   r1   r2   Úscales1r   r   )r   s   "r   r   r   q   s<   € ÷  -ñ  -Ü‡|�|ð -ÜŸ™ð -Ü/4¯|©|ð -ä
‡\�\ñ -r   c                ó>  € \        4       '       g×   \        4       '       dÇ   \        R4      '       d¶   V P                  \        P
                  4      ^€,           P                  \        P                  4      p \        P                  ! W4      pVP                  ^ R\        P
                  R7      ^€,          pVP                  V4       VP                  VP                  4      V,          # \        P                  ! W4      pVP                  VP                  4      V,          # )aœ  
CPU-optimized path for scaled integer matrix multiplication.
CPU prefers decomposed version to leverage the fusion capability of Inductor.
It goes to u8s8 or s8s8 path based on ISA support for hardware. The selection
is for performance only and both paths should work regardless of ISA support.

Args:
    a (torch.Tensor): The first matrix to multiply (int8).
    b (torch.Tensor): The second matrix to multiply (int8).
    scales1 (torch.Tensor): The scaling factors, typically shape (M, 1).
        A scalar-like shape (1, 1) is also supported and will broadcast
        across all rows.

Returns:
    torch.Tensor: The result of the scaled matrix multiplication.
z
2.12.0.devT)ÚdimÚkeepdimÚdtype)r   r   r   r&   r   r"   Úuint8Ú_int_mmÚsumÚsub_r=   )r1   r2   r9   ÚcÚcomps   &&&  r   Ú_int_scaled_matmul_cpurD   q   s½   € ô( '×(Ò(Ü"×$Ò$Ü" <×0Ò0ð �T‰T”%—+‘+Ó Õ$×(Ñ(¬¯©Ó5ˆÜ�MŠM˜!ÓˆØ�u‰u˜ D´·±ˆuÓ<¸sÕBˆØ	�‰ˆtŒØ�t‰t�G—M‘MÓ" WÕ,Ð,ä�MŠM˜!ÓˆØ�t‰t�G—M‘MÓ" WÕ,Ð,r   c                ó˜   € V ^8„  d   QhR\         P                  R\         P                  R\         P                  R\         P                  /# r8   r   )r   s   "r   r   r   ”   s<   € ÷ #ñ #Ü‡|�|ð#ÜŸ™ð#Ü/4¯|©|ð#ä
‡\�\ñ#r   c                ó6  € V P                   w  r4VP                   w  rEVP                  4       ^8X  g   Q hW2P                  ^ 4      8X  g   VP                  4       ^8X  g   Q h^VP                  ^4      8X  g   Q hVP	                  4       '       g   Q h\        RVP                  4      '       d   \        WV4      # VP                  W534      p\        e7   \        '       d+   \        P                  P                  P                  WV4      # \        W4      pWb,          # )a  
Performs scaled integer matrix multiplication.

Args:
    a (torch.Tensor): The first matrix to multiply.
    b (torch.Tensor): The second matrix to multiply.
    scales1 (torch.Tensor): The scaling factors for the rows of the result.
        Expected shape is (M, 1). A scalar-like shape (1, 1) is also
        supported and will broadcast across all rows.

Returns:
    torch.Tensor: The result of the scaled matrix multiplication.

Raises:
    AssertionError: If the dimensions of the input tensors do not match the expected shapes.
r   )r$   r;   ÚsizeÚnumelr'   r   r   rD   Úexpandr	   r4   r   r   r5   Úint_scaled_matmulr/   )r1   r2   r9   ÚMÚKÚNrB   s   &&&    r   rJ   rJ   ”   sã   € ð& �7‰7�D€AØ�7‰7�D€AØ�;‰;‹=˜AÔÐÐØ—‘˜Q“Ô 7§=¡=£?°aÔ#7Ð7Ð7Ø�—‘˜Q“ÔÐÐØ× Ñ ×"Ò"Ð"Ð"ä�%˜Ÿ™×(Ò(Ü% a¨GÓ4Ð4à�n‰n˜a˜VÓ$€GäÒ×$4Ó$4Ü�y‰y× Ñ ×2Ñ2°1¸ÓAÐAä�AÓ€AØ�;Ðr   )ÚloggingÚosr   Útorch._dynamor   r   Ú!torch._higher_order_ops.out_dtyper   Útorchao.utilsr   r   r   r   Ú	getLoggerÚ__name__ÚloggerÚ
addHandlerÚNullHandlerÚtorchao.kernelr	   ÚImportErrorÚwarningÚboolÚintÚgetenvr4   r/   r6   rD   rJ   © r   r   Ú<module>r_      s­   ðó Û 	ã Ý =Ý 7÷ó ð 
×	Ò	˜8Ó	$€Ø × Ñ �'×%Ò%Ó'Ô (ðÝ+ñ ™˜BŸIšIÐ&@À!ÓDÓEÓFÐ õ:
õzõ" -÷F#øðw ô Ø
‡N�NØ^ôð ‚Lðús   ÁB ÂB4Â3B4