This is an archive of the discontinued LLVM Phabricator instance.

[mlir][Vector] Mostly-NFC - Restructure options for lowering to LLVM Matrix Intrinsics
ClosedPublic

Authored by nicolasvasilache on Mar 16 2020, 9:05 PM.

Details

Summary

This revision restructures the calling of vector transforms to make it more flexible to ask for lowering through LLVM matrix intrinsics.
This also makes sure we bail out in degenerate cases (i.e. 1) in which LLVM complains about not being able to scalarize.

Diff Detail

Event Timeline

Herald added a project: Restricted Project. · View Herald TranscriptMar 16 2020, 9:06 PM
mehdi_amini added inline comments.Mar 16 2020, 9:24 PM
mlir/lib/Dialect/VectorOps/VectorTransforms.cpp
955

Can you expand the comment to describe the problem with LLVM?
Also is it a fundamental problem is it just a temporary bug/limitation in LLVM that should be lifted there? (what is the tracking bug? Is there a test-case?)

mlir/test/lib/Transforms/TestVectorTransforms.cpp
27

Can you use pass options instead?

aartbik added inline comments.Mar 16 2020, 10:26 PM
mlir/include/mlir/Dialect/VectorOps/VectorOps.h
27

add a comment here to document the struct

(options for the vector transforms, or at least the contract populate method for now)

28

provide convenience constructors for this

(one bool is simple but if we add more that may come in handy?)

nicolasvasilache marked 6 inline comments as done.Mar 17 2020, 11:55 AM
nicolasvasilache added inline comments.
mlir/include/mlir/Dialect/VectorOps/VectorOps.h
28

What benefit do constructors bring in this instance?
A simple struct with public members is the simplest thing in my book.

Once multiple options are available and they can be logically grouped and given a meaningful name we can provide static constructors that configure a set of options.

We can also provide chaining semantics to have something like: VectorTransformsOptions().setX(true).setY(3)

All these will make sense in the future but are premature until we have at least 3-5 flags + behaviors that must compound.

mlir/test/lib/Transforms/TestVectorTransforms.cpp
27

very cool! Done.

nicolasvasilache marked 2 inline comments as done.Mar 17 2020, 11:55 AM

Address review comments.

aartbik accepted this revision.Mar 17 2020, 1:23 PM
aartbik added inline comments.
mlir/include/mlir/Dialect/VectorOps/VectorOps.h
28

Well, this was just a vague forward looking idea; with proper enums a constructor could read something like this

VectorTransformOpions(ENABLE_LOWER_TO_LLVM_MATRIX, USE_THIS_AND_THAT)

when passing it into a method without the need for a chain of setters. But given that we have one bool, the point is moot :-)

mlir/lib/Dialect/VectorOps/VectorTransforms.cpp
956

if this is really a for now, consider adding a TODO in addition to the bug links

This revision is now accepted and ready to land.Mar 17 2020, 1:23 PM
This revision was automatically updated to reflect the committed changes.