From 59c92e06cc2b5ef91a757fd129896e56a664d888 Mon Sep 17 00:00:00 2001 From: Ouye Xie Date: Wed, 5 Nov 2025 17:25:20 -0800 Subject: [PATCH] Semantically, lda should be K for a row major matrix with shape (MxK), similarly, ldc should be M for a column major matrix with shape (MxN) --- matmul.cu | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/matmul.cu b/matmul.cu index bad7554..65934fe 100644 --- a/matmul.cu +++ b/matmul.cu @@ -46,7 +46,7 @@ void runCublasGemmBF16(int M, int N, int K, bf16 *A, bf16 *B, bf16 *C) { float alpha = 1, beta = 0; // C(column major) = A(row major) * B(column major) cublasStatus_t status = cublasGemmEx(cublas_handle, CUBLAS_OP_T, CUBLAS_OP_N, M, N, K, &alpha, A, CUDA_R_16BF, - N, B, CUDA_R_16BF, K, &beta, C, CUDA_R_16BF, N, CUBLAS_COMPUTE_32F, CUBLAS_GEMM_DEFAULT); + K, B, CUDA_R_16BF, K, &beta, C, CUDA_R_16BF, M, CUBLAS_COMPUTE_32F, CUBLAS_GEMM_DEFAULT); if (status != CUBLAS_STATUS_SUCCESS) { std::cout << "CUBLAS error: " << status << std::endl;