[Mlir-commits] [mlir] [MLIR] Make `OneShotModuleBufferize` use `OpInterface` (PR #110322)

Andrzej Warzyński llvmlistbot at llvm.org
Thu Oct 17 03:48:23 PDT 2024


banach-space wrote:

Thanks for flagging this @DavidSpickett.

This can be reproduced without requiring an emulator. Plain `mlir-opt` is fine. From you build dir:
```bash
bin/mlir-opt ../../mlir/test/Integration/Dialect/Linalg/CPU/ArmSME/matmul.mlir -transform-interpreter -test-transform-dialect-erase-schedule
../../mlir/test/Integration/Dialect/Linalg/CPU/ArmSME/matmul.mlir:56:3: error: cannot bufferize a FuncOp with tensors and without a unique ReturnOp
  transform.named_sequence @__transform_main(%module : !transform.any_op {transform.consumed}) {
  ^
../../mlir/test/Integration/Dialect/Linalg/CPU/ArmSME/matmul.mlir:56:3: note: see current operation:
"transform.named_sequence"() <{arg_attrs = [{transform.consumed}], function_type = (!transform.any_op) -> (), sym_name = "__transform_main"}> ({
^bb0(%arg0: !transform.any_op):
  %0 = "transform.structured.match"(%arg0) <{ops = ["linalg.matmul"]}> : (!transform.any_op) -> !transform.any_op
  %1:4 = "transform.structured.tile_using_for"(%0) <{scalable_sizes = array<i1: true, true, false>, static_sizes = array<i64: 4, 4, 1>}> : (!transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op, !transform.any_op)
  "transform.structured.vectorize"(%1#0) <{scalable_sizes = array<i1: true, true, false>, static_vector_sizes = array<i64: 4, 4, 1>}> : (!transform.any_op) -> ()
  %2 = "transform.bufferization.one_shot_bufferize"(%arg0) <{allow_return_allocs_from_loops = false, allow_unknown_ops = false, bufferize_function_boundaries = true, check_parallel_regions = true, dump_alias_sets = false, memcpy_op = "memref.copy", print_conflicts = false, test_analysis_only = false}> : (!transform.any_op) -> !transform.any_op
  %3 = "transform.structured.match"(%2) <{ops = ["func.func"]}> : (!transform.any_op) -> !transform.any_op
  "transform.apply_patterns"(%3) <{max_iterations = -1 : i64, max_num_rewrites = -1 : i64}> ({
    "transform.apply_patterns.vector.lower_masked_transfers"() : () -> ()
    "transform.apply_patterns.vector.transfer_permutation_patterns"() : () -> ()
    "transform.apply_patterns.vector.reduction_to_contract"() : () -> ()
  }) : (!transform.any_op) -> ()
  "transform.apply_patterns"(%3) <{max_iterations = -1 : i64, max_num_rewrites = -1 : i64}> ({
    "transform.apply_patterns.vector.lower_contraction"() <{lowering_strategy = 2 : i32}> : () -> ()
    "transform.apply_patterns.vector.lower_masks"() : () -> ()
    "transform.apply_patterns.vector.rank_reducing_subview_patterns"() : () -> ()
    "transform.apply_patterns.canonicalization"() : () -> ()
  }) : (!transform.any_op) -> ()
  %4 = "transform.structured.hoist_redundant_vector_transfers"(%3) : (!transform.any_op) -> !transform.any_op
  %5 = "transform.structured.match"(%2) <{interface = 2 : i32}> : (!transform.any_op) -> !transform.any_op
  "transform.apply_licm"(%5) : (!transform.any_op) -> ()
  "transform.loop.hoist_loop_invariant_subsets"(%5) : (!transform.any_op) -> ()
  "transform.yield"() : () -> ()
}) : () -> ()
../../mlir/test/Integration/Dialect/Linalg/CPU/ArmSME/matmul.mlir:71:18: error: bufferization failed
    %bufferize = transform.bufferization.one_shot_bufferize %module
                 ^
```

@tzunghanjuang or @matthias-springer , could you help us with this? This is not really my area of expertise 😅 Link to the test:
* https://github.com/llvm/llvm-project/blob/main/mlir/test/Integration/Dialect/Linalg/CPU/ArmSME/matmul.mlir

https://github.com/llvm/llvm-project/pull/110322


More information about the Mlir-commits mailing list