This is an archive of the discontinued LLVM Phabricator instance.

[mlir][Transform] Add classify_convolution_dims op
ClosedPublic

Authored by qedawkins on Jul 23 2023, 10:56 PM.

Details

Summary

Includes inferConvolutionDims based on the existing helper for
contractions, inferContractionDims. This allows matching and
identifying the relevant dims for a convolution sub-computation of
a linalg operation.

Additionally adds stride/dilations inference to the captures and
convolution interface matcher.

Diff Detail

Event Timeline

qedawkins created this revision.Jul 23 2023, 10:56 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 23 2023, 10:56 PM
qedawkins requested review of this revision.Jul 23 2023, 10:56 PM

can we please revert the unsigned changes and consistently move to int64_t when touching code that uses unsigned?

https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#es106-dont-try-to-avoid-negative-values-by-using-unsigned

qedawkins updated this revision to Diff 543573.Jul 24 2023, 8:51 AM

Switch to int64_t and only set batch parameters once

ftynse accepted this revision.Jul 28 2023, 1:56 AM
ftynse added inline comments.
mlir/include/mlir/Dialect/Linalg/IR/LinalgInterfaces.h
89–96

Nit: leading whitespace feels off here.

mlir/lib/Dialect/Linalg/IR/LinalgInterfaces.cpp
478

Please document top-level functions.

531–536

Nit: prefer llvm::sort

mlir/lib/Dialect/Linalg/TransformOps/LinalgMatchOps.cpp
283–294

Shouldn't these be using makeI64AttrsFromI64 ?

This revision is now accepted and ready to land.Jul 28 2023, 1:56 AM
qedawkins updated this revision to Diff 545504.Jul 30 2023, 8:33 PM

address comments

qedawkins marked 3 inline comments as done.Jul 30 2023, 8:38 PM
qedawkins added inline comments.
mlir/lib/Dialect/Linalg/TransformOps/LinalgMatchOps.cpp
283–294

The dimensions are stored as unsigned, unlike the strides and dilations which are int64_t. If we want to change the types for ConvolutionDimensions (and ContractionDimensions) that can probably be a follow up.

ftynse accepted this revision.Jul 31 2023, 8:03 AM
ftynse added inline comments.
mlir/lib/Dialect/Linalg/TransformOps/LinalgMatchOps.cpp
283–294

ack

This revision was automatically updated to reflect the committed changes.