This is an archive of the discontinued LLVM Phabricator instance.

[mlir][tosa] Quantized Conv2DOp lowering to linalg added.
ClosedPublic

Authored by rsuderman on Jul 20 2021, 3:33 PM.

Details

Summary

Includes a version of a quantized conv2D operations with a lowering from TOSA
to linalg with corresponding test. We keep the quantized and quantized variants
as separate named ops to avoid the additional operations for non-quantized
convolutions.

Diff Detail

Event Timeline

rsuderman created this revision.Jul 20 2021, 3:33 PM
rsuderman requested review of this revision.Jul 20 2021, 3:33 PM
hanchung requested changes to this revision.Jul 21 2021, 12:37 PM

We should add a roundtrip test when adding a new op. You can add it to mlir/test/Dialect/Linalg/named-ops.mlir

mlir/include/mlir/Dialect/Linalg/IR/LinalgNamedStructuredOps.yaml
1550

Delete the blank line?

mlir/lib/Conversion/TosaToLinalg/TosaToLinalg.cpp
944

I think the order is strideAttr and then dilationAttr. This is an issue in TC ops. The order attributes of TC ops is alphabetical, but we really should make it be the order of declaration. Hopefully, it is fixed in yaml ops.

mlir/test/Conversion/TosaToLinalg/tosa-to-linalg.mlir
1187–1190

We can use CHECK-DAG to prevent such change in the future.

This revision now requires changes to proceed.Jul 21 2021, 12:37 PM

Updated review comments.

rsuderman marked 3 inline comments as done.Jul 22 2021, 12:02 PM
hanchung accepted this revision.Jul 22 2021, 3:02 PM

LGTM if adding a roundtrip test to mlir/test/Dialect/Linalg/named-ops.mlir.

This revision is now accepted and ready to land.Jul 22 2021, 3:02 PM
rsuderman updated this revision to Diff 361003.Jul 22 2021, 3:36 PM

Added roundtrip test for conv_2d quantized

This revision was landed with ongoing or failed builds.Jul 22 2021, 3:43 PM
This revision was automatically updated to reflect the committed changes.