Skip to content

[mlir] Redundant signed cast attribute added when building linalg.matmul #132961

Open
@andfau-amd

Description

@andfau-amd

The Python bindings for constructing linalg.matmul, linalg.matmul_transpose_a and linalg.matmul_transpose_b add redundant cast attributes. For example:

%2 = linalg.matmul_transpose_b {cast = #linalg.type_fn<cast_signed>} ins(%arg0, %arg1 : tensor<512x14336xf16>, tensor<4096x14336xf16>) outs(%1 : tensor<512x4096xf32>) -> tensor<512x4096xf32>

Here the {cast = #linalg.type_fn<cast_signed>} is meaningless because the result type is float. Moreover, at least when using the Python builder functions (linalg.matmul(), linalg.matmul_transpose_a(), linalg.matmul_transpose_b()), it is not possible to request that this attribute not be added.

There are a few ways to look at this issue:

  • Is the problem that this builder is adding the attribute unconditionally?
  • Is the problem that the assembly format is showing the attribute even when it has the default value?

I am not sure if this should be seen as purely a Python bindings issue or if it has C++ ramifications.

Please see this discussion for more context: https://github.com/nod-ai/iree-kernel-benchmark/pull/57/files#r2006203540

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions