I’m using CUBLAS DGEMM and have noticed that if I have values of M,N = 1, K = 0 I get a
CUBLAS_STATUS_INVALID_VALUE error when I make the DGEMM call. (Leaving aside the performance
issues) the docs say this error occurs when M,N,K < 0 ? But they clearly are not.
Ok, you’re right, if K = 0 then all you are doing is scaling the matrix C. I tend to think of the gemms as multiplying matrices, so this use seems weird to me.
The behavior of cublasDgemm() is designed to match the behavior of DGEMM in the reference BLAS implementation. Best I can tell, this is the case. As eelsen points out, k=0 results in the scaling of matrix C by beta. Like the reference implementation, cublasDgemm() also checks the arguments (including the transpose modes) for validity, and it returns CUBLAS_STATUS_INVALID_VALUE when an invalid argument is detected.
Other than the documentation not enumerating all possible reasons for the error code CUBLAS_STATUS_INVALID_VALUE to be returned, I do not see any issue at the moment.