diff --git a/.gitmodules b/.gitmodules index 45d99f8fe451..18f6d797b2d0 100644 --- a/.gitmodules +++ b/.gitmodules @@ -28,4 +28,5 @@ url = https://github.com/zeromq/cppzmq.git [submodule "3rdparty/DeepGEMM"] path = 3rdparty/DeepGEMM - url = https://github.com/deepseek-ai/DeepGEMM.git + url = https://github.com/ruoqianguo/DeepGEMM.git + branch = dev/ruoqiang/swapab_sm100 diff --git a/tensorrt_llm/_torch/custom_ops/torch_custom_ops.py b/tensorrt_llm/_torch/custom_ops/torch_custom_ops.py index 1dfc08620c42..e2c77cd4a81d 100644 --- a/tensorrt_llm/_torch/custom_ops/torch_custom_ops.py +++ b/tensorrt_llm/_torch/custom_ops/torch_custom_ops.py @@ -926,8 +926,9 @@ def get_valid_tactics( inputs: List[torch.Tensor], profile: OptimizationProfile, ) -> List[int]: - # Encode swap_ab as False (0) and True (1). Currently only add one tactic here. - return [0] + # Encode swap_ab as False (0) and True (1). Currently enabled when GEMM m <= 128. + input, _, _ = inputs + return [0, 1] if input.shape[0] <= 128 else [0] def forward( self, @@ -941,9 +942,9 @@ def forward( device=input.device, dtype=self.output_dtype, ) - # TODO: add swap_ab=tactic == 0 to detemrmine the swap_ab value - # Treat the default tactic=-1 as swap_ab=False - deep_gemm.fp8_gemm_nt( + + forward_func = deep_gemm.fp8_gemm_ntt if tactic == 1 else deep_gemm.fp8_gemm_nt + forward_func( (a, a_sf), (weight, weight_scale), output,