[all-commits] [llvm/llvm-project] ebd0cb: [mlir][tensor] Preserve encoding in more canonical...

Dmitrii Makarenko via All-commits all-commits at lists.llvm.org
Tue Aug 4 04:29:23 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: ebd0cbfb372c42c499d021022975a60bbc6d0d27
      https://github.com/llvm/llvm-project/commit/ebd0cbfb372c42c499d021022975a60bbc6d0d27
  Author: Dmitrii Makarenko <dmitrii.makarenko at intel.com>
  Date:   2026-08-04 (Tue, 04 Aug 2026)

  Changed paths:
    M mlir/include/mlir/IR/TensorEncoding.td
    M mlir/lib/Dialect/Tensor/IR/TensorOps.cpp
    M mlir/test/Dialect/Tensor/canonicalize.mlir

  Log Message:
  -----------
  [mlir][tensor] Preserve encoding in more canonicalizers (pad, convertToStaticExpandShape) (#207241)

Fixes encoding drop in `tensor.*` canonicalizers.

Patterns that only refine a tensor's shape (never merge/combine data)
now propagate the encoding: `ConvertToStaticExpandShape`,
`PadOp::inferResultType` (and its callers `FoldSourceTensorCast`,
`FoldStaticPadding`). An encoding implementing
`VerifiableTensorEncoding` is re-verified against the refined shape and
dropped if invalid (e.g. sparse); an opaque encoding (no interface) is
propagated as-is.

Patterns that merge/combine tensors (`ConcatOp::inferResultType`,
`InferConcatOperandTypes`, `CollapseShapeOp::inferCollapsedType`) keep
the existing drop-encoding behavior - there's no static way to verify an
arbitrary encoding survives a merge or rank change when dynamic dims are
involved.

Documents this contract on `VerifiableTensorEncoding` in
`TensorEncoding.td`.

co-authored Claude Opus 4.7

Signed-off-by: Dmitrii Makarenko <dmitrii.makarenko at intel.com>



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list