Skip to content

PDL patterns #279

@giuseros

Description

@giuseros

Hi all,
I am trying to use the PDL patterns to double tile a generic matmul-like operation:

def add_matmul_schedule(module):
  dimM, dimN, dimK = [0, 0], [1, 1], [0, 1]
  isa_linalg_matmul = match_op_with_dynamic_or_static_sizes(
      module,
      equivalent_op_name='linalg.matmul',
      dynamic_spec_list=['d', 'd', 'd'],
      op_dim_spec_list=[dimM, dimN, dimK])
  
  with InsertionPoint(module.body):
    sequence = transform.SequenceOp()
    with ir.InsertionPoint(sequence.body.blocks[0]):
      matched = transform.MatchOp(isa_linalg_matmul)
      tiled = transform.TileOp(matched, sizes=[128, 128, 128], interchange=[0,2,1], pad=False)
      tiled2 = transform.TileOp(tiled, sizes=[8,8,1], interchange=[0,1,2], pad=True, pack_paddings=[1,1,0], hoist_paddings=[4,3,0], transpose_paddings=[[0,1], [0,1], [0,1]])

The second TileOp hits this assertion:

python3: /home/giuseppe/gh_llvm_project/mlir/lib/Dialect/Linalg/Transforms/Transforms.cpp:220: mlir::LogicalResult padOperandToSmallestStaticBoundingBox(mlir::OpBuilder &, linalg::LinalgOp, mlir::OpOperand *, const mlir::linalg::PaddingValueComputationFunction &, const mlir::linalg::PaddingNoFoldComputationFunction &, mlir::Value &): Assertion `staticSizes.size() == shape.size() && "expect the dynamic and static ranks to match"' failed.

While investigating, I was wondering if I am doing the right thing, or something is wrong with my code. @nicolasvasilache is this the way it's supposed to be used?

Thanks,
Giuseppe

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions