CUBLAS sgemm overwrite input with result

The CUBLAS documentation defines the operation in sgemm/dgemm method as follows:

C = alpha * A * B + beta * C

Suppose I have two matrices, X and Y, and would like to perform the operation X = X * Y. Therefore, for CUBLAS, I will be passing in the following parameters:

alpha = 1.0
A = X
B = Y
beta = 0.0
C = X

The idea is to overwrite X (originally an input) with the resultant matrix. I have seen some weird behavior so far, where sometimes it works, and sometimes only portions of the resultant matrix are correct. Can anyone tell me definitely if this is a poor practice? Thank you in advance!

You cannot do that. The output C must be different from the 2 inputs. Only the 2 inputs can be identical

All BLAS implementation that I know of are like this.

You cannot do that. The output C must be different from the 2 inputs. Only the 2 inputs can be identical

All BLAS implementation that I know of are like this.