[all-commits] [llvm/llvm-project] ab86b8: [mlir][linalg][transform] Fix printing of TileToFo...

Ingo Müller via All-commits all-commits at lists.llvm.org
Wed Jul 12 06:30:30 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: ab86b8cef4b04c6d078e9533353d16ac1843fc40
      https://github.com/llvm/llvm-project/commit/ab86b8cef4b04c6d078e9533353d16ac1843fc40
  Author: Ingo Müller <ingomueller at google.com>
  Date:   2023-07-12 (Wed, 12 Jul 2023)

  Changed paths:
    M mlir/include/mlir/Dialect/Transform/Utils/Utils.h
    M mlir/lib/Dialect/Transform/Utils/Utils.cpp

  Log Message:
  -----------
  [mlir][linalg][transform] Fix printing of TileToForall in edge case.

The `static_(num_threads|tile_sizes)` attributes of this op are
`DefaultValuedOptionalAttr`s, so they can be constructed *without* such
an attribute. In other words, the following is a valid op (note the
absense of the `static_num_threads` attribute):

"builtin.module"() ({
  "transform.sequence"() <{failure_propagation_mode = 1 : i32, operand_segment_sizes = array<i32: 0, 0>}> ({
  ^bb0(%arg0: !pdl.operation, %arg1: !transform.op<"linalg.matmul">, %arg2: !transform.op<"linalg.elemwise_binary">):
    %0 = "transform.structured.match"(%arg0) <{ops = ["test.dummy"]}> : (!pdl.operation) -> !pdl.operation
    %1:2 = "transform.structured.tile_to_forall_op"(%arg1, %0) <{operand_segment_sizes = array<i32: 1, 0, 0, 0, 1>}> : (!transform.op<"linalg.matmul">, !pdl.operation) -> (!transform.op<"scf.forall">, !transform.op<"linalg.matmul">)
    "transform.yield"() : () -> ()
  }) : () -> ()
}) : () -> ()

However, the custom printing directive converted those to an `ArrayRef`,
which crashes if done on an empty `ArrayAttr`. This patch changes the
signature such that no automatic conversion takes place and extends the
test to test for existinnce of the attribute.

Reviewed By: nicolasvasilache

Differential Revision: https://reviews.llvm.org/D155062




More information about the All-commits mailing list