This is an archive of the discontinued LLVM Phabricator instance.

[mlir][linalg][transform] Fix printing of TileToForall in edge case.
ClosedPublic

Authored by ingomueller-net on Jul 12 2023, 3:04 AM.

Details

Summary

The static_(num_threads|tile_sizes) attributes of this op are
DefaultValuedOptionalAttrs, 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.

Diff Detail

Event Timeline

Herald added a project: Restricted Project. · View Herald TranscriptJul 12 2023, 3:04 AM
ingomueller-net requested review of this revision.Jul 12 2023, 3:04 AM
nicolasvasilache accepted this revision.Jul 12 2023, 6:07 AM
This revision is now accepted and ready to land.Jul 12 2023, 6:07 AM