jiazhihao / TASO

The Tensor Algebra SuperOptimizer for Deep Learning
Apache License 2.0
682 stars 89 forks source link

Make transpose detection less flaky #81

Closed jspark1105 closed 3 years ago

jspark1105 commented 3 years ago

Just checking stride[numDim-1] or stride[numDim-2] == 1 is not enough. If a matrix has M x K shape, CUBLAS_OP_T (row-major) will have stride [..., >=K, 1], CUBLAS_OP_N (col-major) will have stride [..., 1, >=M]. If M or K is 1, just checking either of stride is 1 breaks down. When M == K == 1, one can think there's an ambiguity but that's moot because for 1x1 matrix transpose is nop.