This is an archive of the discontinued LLVM Phabricator instance.

[mlir][Interfaces] Add ReifyShapeDimTypeInterface
Changes PlannedPublic

Authored by springerm on Mar 14 2023, 8:04 AM.

Details

Summary

This interface allows callers to reify dimension sizes of a shaped value without depending on any dialect. This interface and its helper functions can replace switch-case statements that generate tensor.dim/memref.dim ops (depending on the type of the shaped value) in various parts of the code base.

This revision also removes createOrFoldDimOp and similiar functions from the Linalg dialect and the Vector dialect.

Diff Detail

Event Timeline

springerm created this revision.Mar 14 2023, 8:04 AM
Herald added a reviewer: aartbik. · View Herald Transcript
Herald added a project: Restricted Project. · View Herald Transcript
springerm requested review of this revision.Mar 14 2023, 8:04 AM

LG for sparse

@mehdi_amini Just took another look at your original comment: Can we replace this with an interface method on ShapedTypeInterface and avoid hard-depending on specific dialect implementations?

This revision is adding a new interface instead of adding the functionality to ShapedTypeInterface. The problem with ShapedTypeInterface is that it would then have to be implemented as an external model in the tensor/memref dialect. This means:

  • All code that uses ShapedType will have to depend on TensorDialect/MemRefDialect.
  • Calls to getRank, getShaped etc. through the interface may get a bit more expensive.

I'm not sure which is better, the implementation in this revision or making ShapedTypeInterface an external model. It would be nice if we could make this work without adding a new interface.

springerm planned changes to this revision.Apr 19 2023, 8:10 PM

We are looking into moving shaped types into dialects. Putting this revision on hold.