Skip to content

Some ops requires redundant data in MLIR C++ API #2890

@joelberkeley

Description

@joelberkeley

What happened?

ConvertOp requires a type to specify the output. But the API requires a tensor type, including shape, not just an element type. This makes no sense for ops like ConvertOp, where the return shape is uniquely determined by the other arguments. This is confusing and cumbersome for API callers, and encourages bugs where the specified shape is invalid.

Similar ops where both shape and type are required by the API:

  • DotGeneralOp : the result element is the same is the input type. Similarly the shape is uniquely inferrable from args.
  • ReshapeOp : the result element is the same is the input type.

Steps to reproduce your issue

Call ConvertOp via C++

Version information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions