This is an archive of the discontinued LLVM Phabricator instance.

[MLIR] Fix indexing maps in isColumnMajorMatmul
AbandonedPublic

Authored by GMNGeoffrey on Feb 17 2021, 5:05 PM.

Details

Reviewers
nicolasvasilache
Summary

This patch updates the indexing maps used for checking against a
column-major matmul operation. The maps as currently written do not
describe a column-major matmul. The linalg named op column_major_matmul
has the correct maps (and notably fails this test).

If C = matmul(A, B) we want an operation that given A in column major
format and B in column major format produces C in column major format.
Given that for a matrix, faux column major is just transpose.
column_major_matmul(transpose(A), transpose(B)) = transpose(C). If A
is NxK and B is KxM, then C is NxM, so transpose(A) is
KxN, transpose(B) is MxK and transpose(C) is MxN, not NxM as
these maps currently have.

Longer-term, this check should be permutation-invariant to be more
general, but for now let's have it at least use a correct map to avoid
further confusion.

There are no longer any uses of this in the repo, but I expect to add further
uses as part of expanding linalg interfaces.

Diff Detail