jiazhihao / TASO

The Tensor Algebra SuperOptimizer for Deep Learning
Apache License 2.0
692 stars 90 forks source link

Less flaky transpose detection #80

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.