I’m updating an old cuda extention. The old code used THCudaTensor and THCudaBlas_Sgemm. The updated code uses torch::Tensor, but I’m not sure how to correspondingly update THCudaBlas_Sgemm.
Original call
THCudaBlas_Sgemm(state, 'n', 'n', n, m, k, 1.0f,
THCudaTensor_data(state, columns), n,
THCudaTensor_data(state, weight), k, 1.0f,
THCudaTensor_data(state, output_n), n);
I’ve tried
THCudaBlas_Sgemm(state, 'n', 'n', n, m, k, 1.0f,
columns.data(), n,
weight.data(), k, 1.0f,
output_n.data(), n);
But I get the error
error: cannot convert ‘at::Tensor’ to ‘float*’ for argument ‘8’ to ‘void THCudaBlas_Sgemm(THCState*, char, char, int64_t, int64_t, int64_t, float, float*, int64_t, float*, int64_t, float, float*, int64_t)’
I’ve also thought about how to convert this call to torch::addmm, but the leading dimension arguments in sgemm make this a complicated conversion since there isn’t an equivalent argument to addmm.