This is an archive of the discontinued LLVM Phabricator instance.

[MLIR][LinAlg] Use AnyTypeOf for LinalgOperand for better error msg.
ClosedPublic

Authored by kumasento on Jul 23 2020, 9:23 AM.

Details

Summary

Previously, LinalgOperand is defined with Type<Or<..,>>, which produces
not very readable error messages when it is not matched, e.g.,

'linalg.generic' op operand #0 must be anonymous_326, but got ....

It is simply because the description property is not properly set.

This diff switches to use AnyTypeOf for LinalgOperand, which automatically
generates a description based on the allowed types provided.

As a result, the error message now becomes:

'linalg.generic' op operand #0 must be ranked tensor of any type values or strided memref of any type values, but got ...

Which is clearer and more informative.

Diff Detail

Event Timeline

kumasento created this revision.Jul 23 2020, 9:23 AM
kumasento retitled this revision from Use AnyTypeOf for LinalgOperand for better error msg. to [MLIR][LinAlg] Use AnyTypeOf for LinalgOperand for better error msg..Jul 23 2020, 10:44 AM
nicolasvasilache accepted this revision.Jul 29 2020, 6:12 AM

Much better, thanks @kumasento

This revision is now accepted and ready to land.Jul 29 2020, 6:12 AM

Much better, thanks @kumasento

Thank you Nicolas, would you mind helping me committing it when you are available? Thanks :)