This is an archive of the discontinued LLVM Phabricator instance.

[mlir] Linalg: Extend promotion to non f32 buffers.
ClosedPublic

Authored by poechsel on Feb 13 2020, 1:45 AM.

Details

Summary

Linalg's promotion pass was only supporting f32 buffers due to how the
zero value was build for the fill operation.

Moreover, promoteSubViewOperands was returning a vector with one entry
per float subview while omitting integer subviews. For a program
with only integer subviews the return vector would be of size 0.
However, promoteSubViewsOperands would try to access a non zero
number of entries of this vector, resulting in a sefgault.

Diff Detail

Unit TestsFailed

Event Timeline

poechsel created this revision.Feb 13 2020, 1:45 AM
rriddle added inline comments.Feb 13 2020, 11:17 AM
mlir/lib/Dialect/Linalg/Transforms/Promotion.cpp
136

Remove trivial braces.

221

sv.getType().getElementType().isIntOrFloat()

poechsel updated this revision to Diff 244581.Feb 14 2020, 12:53 AM
poechsel marked 2 inline comments as done.

Reformat the code.

ftynse accepted this revision.Feb 14 2020, 1:43 AM

I wonder how much of the test here is just carried over mechanically and if we could do something to reduce this churn...

This revision is now accepted and ready to land.Feb 14 2020, 1:43 AM
This revision was automatically updated to reflect the committed changes.

I wonder how much of the test here is just carried over mechanically and if we could do something to reduce this churn...

The check part can be significantly reduced, one only really needs to check the allocs.
Re. test itself, this is just a tiled linalg.matmul, we could leave the original one unchanged and for the new ones just write a 1-liner test for f16/f64/i32/whatever and do mlir-opt --linalg-tile ... | mlir-opt -linalg-promote-subviews | FileCheck %s --check=prefix=NEW_PREFIX