This is an archive of the discontinued LLVM Phabricator instance.

[mlir][Linalg] Update signatures of the callback functions.
ClosedPublic

Authored by hanchung on Jul 19 2021, 4:15 PM.

Details

Summary

This allows caller to use non-const functions, e.g., getOperandNumber, etc. It
is expected that OpOperand is not modified in a callback function.

Diff Detail

Event Timeline

hanchung created this revision.Jul 19 2021, 4:15 PM
hanchung requested review of this revision.Jul 19 2021, 4:15 PM
mravishankar accepted this revision.Jul 20 2021, 3:34 PM
mravishankar added inline comments.
mlir/include/mlir/Dialect/Linalg/Transforms/Transforms.h
54

Nit: Please also state that the callback is expected to not modify the OpOperand.
Do we want to drop the const on OpResult as well?

This revision is now accepted and ready to land.Jul 20 2021, 3:34 PM
hanchung updated this revision to Diff 360316.Jul 20 2021, 4:29 PM

adjust comments a bit

hanchung added inline comments.Jul 20 2021, 4:31 PM
mlir/include/mlir/Dialect/Linalg/Transforms/Transforms.h
54

That would raise some lvalue issue. I've found that most of time we would call controlFn(producer->getResult(0), *consumerOpOperand). If we drop the const on OpResult, I think we will have to declare a variable to store it.

I assume the methods in OpResult is not that useful, so I'd keep the const in this case.

This revision was landed with ongoing or failed builds.Jul 20 2021, 5:03 PM
This revision was automatically updated to reflect the committed changes.